'create multiple tab in CSV file through R

I have a query in R, for loading data into .xlsx multiple tabs we use below code

write.xlsx(newtrain, 
           file = 'path/file.xlsx',
           sheetName = 'sheet 1',append=TRUE, row.names=FALSE)  
write.xlsx(newtrain, 
           file = 'path/file.xlsx',
           sheetName = 'sheet 2',append=TRUE, row.names=FALSE) 

same way I wanted to create for .csv file.



Solution 1:[1]

you can simply write csv using below code

write.csv(MyData, file = "MyData.csv",row.names=FALSE)

But if you want multiple sheet like xlsx so please refer below link.

how to write multiple dataframe to multiple sheet of one csv excel file in R?

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Sahil Desai