jeudi 26 février 2015

xlsx package in R converting numeric dataframe to text in xlsx file

I have a dataframe in R consisting of 0s and 1s. When I write it to an xlsx file and open this file in microsoft spreadsheet, it show an error on each cell with number : "number stored as text". Is there a way to fix it in R. Here is a sample of what I did:



write.xlsx(result,"test.xlsx",sheetName="Sheet1",row.names=F)


sapply(result,mode) GO_ids GO.0007411 GO.0006915 GO.0006914 GO.0006464 GO.0006298 GO.0018108 "numeric" "numeric" "numeric" "numeric" "numeric" "numeric" "numeric" GO.0006355 GO.0007155 GO.0030036 GO.0030155 "numeric" "numeric" "numeric" "numeric"



Thanks

Aucun commentaire:

Enregistrer un commentaire