Re: [R] Merging columns along time line

2010-07-14 Thread Wu Gong
Correction: b$label <- cut(b$timestamp, breaks=bks, labels=lbs, include.lowest = T, right=F) - A R learner. -- View this message in context: http://r.789695.n4.nabble.com/Merging-columns-along-time-line-tp2289147p2289401.html Sent from the R help mailing list archive at Nabble.com. ___

Re: [R] Merging columns along time line

2010-07-14 Thread Wu Gong
I take this case as cut a data set by breaks and assign each segment a label name. a <- data.frame(timestamp=c(3,5,8), mylabel=c("abc","def","ghi")) b <- data.frame(timestamp=c(1:10)) bks <- c(a$timestamp,max(b$timestamp)) lbs <- a$mylabel b$label <- cut(b$timestamp, breaks=bks, labels=lbs, inclu

[R] Merging columns along time line

2010-07-14 Thread Ralf B
I am resending this, as I believe it has not arrived on the mailing list when I first emailed. I have a set of labels arranged along a timeframe in a. Each label has a timestamp and marks a state until the next label. The dataframe a contains 5 such timestamps and 5 associated labels. This means,

Re: [R] merging columns

2010-02-03 Thread Matthew Dowle
Yes. data.df[,wcol,drop=FALSE] For an explanation of drop see ?"[.data.frame" "Chuck White" wrote in message news:20100202212800.o8xbu.681696.r...@mp11... > Additional clarification: the problem only comes when you have one column > selected from the original dataframe. You need to make the fo

Re: [R] merging columns

2010-02-02 Thread Chuck White
Additional clarification: the problem only comes when you have one column selected from the original dataframe. You need to make the following modification to the original example: data.df <- data.frame(aa=c(1,1,0), cc=c(1,0,0), aab=c(0,1,0), aac=c(0,0,1), bb=c(1,0,1)) And, the following seem

[R] merging columns

2010-02-02 Thread Chuck White
Hello -- I am trying to merge columns in a dataframe based on substring matches in colnames. I would appreciate if somebody can suggest a faster/cleaner approach (eg. I would have really liked to avoid the if-else piece but rowSums does not like that). Thanks. data.df <- data.frame(aa=c(1,1,0),

[R] merging columns from a large data set

2009-09-26 Thread Amit Kumar
Hi! All I am trying to merge very large data sets. Here fullset1 contains 13 data sets. Each data set has columns which I need to merge. Here I am trying to merge columns 2,6,10,14till end for all 13 data sets in fullset1. But I am only getting 2nd column here. Rchan1 = sapply(1:length(fullse