Converting Rdata files to CSV - Error in data.frame arguments imply differing number of rows

前端 未结 2 1410
孤独总比滥情好
孤独总比滥情好 2021-01-16 05:40

I\'m trying to use the R code from this answer to convert a bunch of rdata files to CSV.

resave <- function(file){
  e <- new.env(parent = emptyenv())
         


        
2条回答
  •  猫巷女王i
    2021-01-16 06:06

    That answer was designed to handle object of class-'data.frame'. You only have an object of class-'list' which happens to have items that are dataframes. So there isn't an object with the name "2" in you workspace but there is an element in the 'dataa'-list that is named "2" and all of the other elements appear to also be dataframes, so why not use:

    lapply( names(dataa), function(nam) write.csv( data[[nam]], file=paste0(nam, ".Rdata") ) )
    

提交回复
热议问题