[英]How to get an output in groupwise format and export the same format in a csv file?
[英]unable to export same format data from csv file
我有一個.csv
文件,其中包含50列,包括文本,數字,數量和百分比。 當我將數據導出到R中的.xlsx
,所有數量和百分比列都將轉換為文本。 有什么幫助嗎?
我的代碼如下:
datafile <- choose.files("", caption = " Select files ")
data <- read.csv(datafile, header = TRUE, sep = "," )
write.xlsx(data, file = "abc.xlsx" , sheetName = "UtilizationReportGRE", row.names = F)
Write.xlsx將因子轉換為字符串。 在使用write.xlsx之前,請更改數據以使數字列變為數字等。 另請參見如何將數據框列轉換為數字類型?
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.