Quantcast
Channel: Active questions tagged r - Stack Overflow
Viewing all articles
Browse latest Browse all 201919

R export doesn't recognize the existing dataframe

$
0
0

I have some data frames I created in R and I want to export them to excel, but R doesn't recognize the dataframe already exists and it creates the file with the sheets but no data. So using the code below I get Total_Arizona spreadsheet but there is no data in it. Total_Arizona is a dataframe in global environment.

 `Monthly_Report <- createWorkbook()
 for (i in levels(Data$State)) {
 addWorksheet(Monthly_Report, paste0("Total_", i)) 
 writeData(Monthly_Report, sheet = paste0("Total_", i), x=paste0("Total_", i),  startCol = 1, 
 startRow = 1)}
 saveWorkbook(Monthly_Report, "Monthly_Report.xlsx")`

Viewing all articles
Browse latest Browse all 201919

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>