read.xlsx and colClasses
问题 Does anyone know why argument colClasses does not seem to work in read.xlsx ? I create a sample *.xlsx file: > library(xlsx) > d1 = data.frame(A=LETTERS[1:3], B=letters[1:3], C=1:3, D=c(1.1, NA, NA)) > str(d1) 'data.frame': 3 obs. of 4 variables: $ A: Factor w/ 3 levels "A","B","C": 1 2 3 $ B: Factor w/ 3 levels "a","b","c": 1 2 3 $ C: int 1 2 3 $ D: num 1.1 NA NA > write.xlsx(d1, 'test.xlsx', sheetName='Sheet1', row.names=F, showNA=F) then try to read it with read.xlsx , without and with