如何在str(dataframe)的输出中识别dataframe的哪个columnname是“chr”?
df = read.table(myfile.txt)
str(df)
换句话说,如何知道数据框中每一列的类型?> str(df)
>>>str(df)
'data.frame': 5 obs. of 6 variables:
$ gender: Factor w/ 2 levels "F","M": 2 1 2 2 2
$ age : num 51.1 51.5 52.3 54 52.4
$ Col1 : int 46 47 45 38 41
$ Col2 : int 38 NA 38 40 27
$ Col3 : num 0.6 0.4 0.9 0.8 0.8
$ col4 : int 1 1 1 1 0