当我从access或excel中读取数据时,R
会转换" string"中的变量格式。到" int"。
这是一个小样本:
NumberFit stringFit LetterFit
0 000000000 0
1 000000001 U
2 000000010 L
3 000000011 LU
将数据导入R
后,我有:
<-States
NumberFit stringFit LetterFit
0 0 0
1 1 U
2 10 L
3 11 LU
> str(States)
'data.frame': 514 obs. of 3 variables:
$ NumberFit: int 0 1 2 3 4 5 6 7 8 9 ...
$ stringFit: int 0 1 10 11 100 101 110 111 1000 1001 ...
$ LetterFit: Factor w/ 514 levels "0","B","BD","BDL"
但是,我需要数据的字符串格式。有人能帮助我吗?