--
You received this message because you are subscribed to the Google Groups "manipulatr" group.
To post to this group, send email to manip...@googlegroups.com.
To unsubscribe from this group, send email to manipulatr+...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/manipulatr?hl=en.
Hello rlerarnr,
I am trying to adapt your solution for another purpose. I still have a table, the elements of which are dataframes. Now, I'd like to save each dataframe as a csv file. So, my code is:
write2csv<-function(data,file) write.csv(data,file)
m_ply(cbind(data=datalist,file=names(datalist)),write2csv)
This sort of works, but the files produced do not have the ".csv" extension. I don't know how to specify that the extension should be "csv".
l_ply(names(datalist), function(c_name, c_data=datalist[[c_name]]) { #
c_ states for current
write2csv(c_data, file=paste(c_name,".csv",sep="")) # with
workaround for extension
})
But I wonder which solution is more efficient in CPU time and RAM
uses. I usually play with big data so RAM is more important to me.
On other hand when I was looking for a solution first I tried standard
method to get names:
l_ply(datalist, function(c_data, c_name=deparse(substitute(c_data)))
print(c_name))
but I get
[1] ".data[[i]]"
[1] ".data[[i]]"
[1] ".data[[i]]"
So the question is: is there any way to get actual name? (to notice -
in lapply you get "X[[3L]]")
Maybe it is possible to get value of i, then one could use names
(data.list)[i]. I tried mess with parent.frame(-1) but I fail.
On 11 Gru 2009, 17:37, Mark Na <mtb...@gmail.com> wrote:
> Hello rlerarnr,
>
> I am trying to adapt your solution for another purpose. I still have a
> table, the elements of which are dataframes. Now, I'd like to save each
> dataframe as a csv file. So, my code is:
>
> write2csv<-function(data,file) write.csv(data,file)
> m_ply(cbind(data=datalist,file=names(datalist)),write2csv)
>
> This sort of works, but the files produced do not have the ".csv" extension.
> I don't know how to specify that the extension should be "csv".
>
> If you can help, I'd really appreciate it.
>
> Thanks, Mark
>
> > manipulatr+...@googlegroups.com<manipulatr%2Bunsu...@googlegroups.com>