Hi guys,

Suppose I have an extremely large data frame with 2 columns and .5 mil
rows. For example, the last 6 rows may look like this:
.
..
...
89         100
93         120
95         125
101        NA
115        NA
123        NA
124        NA

I would like to manipulate this data frame to output a data frame that
looks like:,

100        89, 93, 95
120        101, 115
125        123, 124

What would be the absolute quickest way to do this, given that there are
many rows? Currently I have this:

# m is the large two column data frame
end <- na.omit(m[,'V2']);
out <- data.frame(End=end,
Start=unname(sapply(split(m[,'V1'],findInterval(m[,'V1'],end))[as.character(0:c(length(end)-1))],paste,collapse='.')))

However this is taking a little bit too long.

Thank you for your help!

        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to