2021
03-30
03-30
R语言 Factor类型的变量使用说明
factor类型的创建1.factor()>credit_rating<-c("BB","AAA","AA","CCC","AA","AAA","B","BB")#生成名为credit_rating的字符向量>credit_factor<-factor(credit_rating)#step2.将credit_rating转化为因子>credit_factor[1]BBAAAAACCCAAAAABBBLevels:AAAAABBBCCC>str(credit_rating)#调用str()函数,显示credit_rating结构chr[1:8]"BB""AAA""AA""CCC""AA""AAA""B""BB">str(credit_fac...
继续阅读 >