[R] How insert data to a column in existing csv file?

David Winsemius dwinsemius at comcast.net
Thu Apr 12 14:16:58 CEST 2012


On Apr 12, 2012, at 5:18 AM, Yellow wrote:

> I was working with some excel files with a lot of data.
> And by hand it is impossible to handle them.
> So they are now converted to .csv.
>
> With headers above the columns, like:
> Data1, Data2, Data3
>
> But now I needed to calculate the log2 value of Data1 and place the  
> result
> under Data2.
> I can't find how to do that.

First you need to explain more clearly what you mean by "place the  
result
under Data2". Is this a display concern? Or are you trying to  
interleave rows of original data and logged data using a column  
organization? Why only Data2? What should go in the rows for Data1 and  
Data3? ? What is the goal of this effort?


> Does anyone else know?
>
> I have the log2 values, but how do I get then inside the .csv file  
> under
> Data2?

Post some sample code that constructs the data.frames and the code you  
used.

>
> I already tried write.table(), buy that wasn't it.
> And I am kinda stuck on this now.....


-- 
David Winsemius, MD
West Hartford, CT



More information about the R-help mailing list