[datatable-help] data.table on existing data.frame list

iembry iruckaE at mail2world.com
Mon Aug 5 17:36:30 CEST 2013


Hi all, I am new to data.table and I have some questions.

Since fread is still in development stage, I have not used it to read my
data files stored on the disk. I have used read.table and the objects are
stored as data.frame. 

How do I use data.table on those existing data.frame objects?

This is a reproducible example:

dput(df) 
structure(list(a = c(5, 6, 6), b = c(20.2, 32.9, 0.99), cdo = c(0.2, 
32, 90.34)), .Names = c("a", "b", "cdo"), row.names = c(NA, -3L 
), class = "data.frame")


In my real data set, I have a list of many data frames where I will need to
change an existing column. 

For example, in the "df" data.frame, how would I make a revised "a" = "a" +
"b"?

The code below represents what I am attempting to do with my real data set:

getratings2 <- lapply(seq_along(dailyvaluesneednew$site_no), function(u)
getratings[[u]]$y <- getratings[[u]]$y + getratings[[u]]$shift)

In this case, I would like to make the column named "y" = "y" + "shift" and
perform that operation for each data.frame in the list.

Thank you.

Irucka Embry



--
View this message in context: http://r.789695.n4.nabble.com/data-table-on-existing-data-frame-list-tp4673142.html
Sent from the datatable-help mailing list archive at Nabble.com.


More information about the datatable-help mailing list