Re: [R] noob requesting help

2012-06-18 Thread capital_P
Rui Barradas wrote > > sorry about the misleading tip. > This should do it. > > do.call(rbind, dep) > No problem at all. That did the trick. Thank you both so much for your help. I am forever in your debt. -- View this message in context: http://r.789695.n4.nabble.com/noob-requesting-help-

Re: [R] noob requesting help

2012-06-18 Thread Rui Barradas
Hello, Ok, sorry about the misleading tip. This should do it. do.call(rbind, dep) Rui Barradas Em 18-06-2012 13:32, capital_P escreveu: Rui Barradas wrote Try names(departures) <- NULL dep <- data.frame(departures[ !sapply(departures, is.null) ]) You now have data.frame 'dep'. dep <

Re: [R] noob requesting help

2012-06-18 Thread capital_P
Rui Barradas wrote > > Try > > names(departures) <- NULL > dep <- data.frame(departures[ !sapply(departures, is.null) ]) > > You now have data.frame 'dep'. > dep <- data.frame(departures[ !sapply(departures, is.null) ]) Error in data.frame(`121.1` = list(device_info_serial = integer(0), hour

Re: [R] noob requesting help

2012-06-18 Thread Rui Barradas
Hello, Have you tried what I wrote in my last post? Revised: # Make a copy first, and operate on the copy. dep <- departures names(dep) <- NULL dep <- data.frame(dep) Rui Barradas Em 18-06-2012 11:09, capital_P escreveu: David Winsemius wrote That's going to remove a lot of rows. Since y

Re: [R] noob requesting help

2012-06-18 Thread capital_P
David Winsemius wrote > > That's going to remove a lot of rows. > > Since you are not telling us what columns correspond to those > concepts, I'm going to use the terms you are. Something along the > lines of: > > require(lattice) > histogram( ~ hours | bird, data=dat2, nint =24 , xlim=c(0

Re: [R] noob requesting help

2012-06-17 Thread David Winsemius
On Jun 17, 2012, at 7:19 AM, capital_P wrote: Rui Barradas wrote It's stringsAsFactors = FALSE, just one '='. sapply(dat, length) It should return 4 times the value 34773. use dput() it worked! dat2 <- data.frame(dat, stringsAsFactors = FALSE) sapply(dat2, length) device_info_ser

Re: [R] noob requesting help

2012-06-17 Thread Rui Barradas
Hello, Try names(departures) <- NULL dep <- data.frame(departures[ !sapply(departures, is.null) ]) You now have data.frame 'dep'. Rui Barradas Em 17-06-2012 12:19, capital_P escreveu: Rui Barradas wrote It's stringsAsFactors = FALSE, just one '='. sapply(dat, length) It should return 4

Re: [R] noob requesting help

2012-06-17 Thread capital_P
Rui Barradas wrote > > It's stringsAsFactors = FALSE, just one '='. > > sapply(dat, length) > > It should return 4 times the value 34773. > > use dput() > it worked! > dat2 <- data.frame(dat, stringsAsFactors = FALSE) > sapply(dat2, length) device_info_serial hour

Re: [R] noob requesting help

2012-06-17 Thread Rui Barradas
Hello, It's stringsAsFactors = FALSE, just one '='. Your data structure, a list, seems to have elements, vectors, of the same lengths, all of them are of length 34773. You can check it with sapply(dat, length) It should return 4 times the value 34773. If so, there's no reason for David's su

Re: [R] noob requesting help

2012-06-16 Thread R. Michael Weylandt
On Jun 16, 2012, at 1:56 PM, capital_P wrote: > > David Winsemius wrote >> >>> Try >>> >>> dat2 <- data.frame(do.call(cbind, dat), stringsAsFactors=FALSE) >> >> Use instead: >> >> dat2 <- data.frame( dat, stringsAsFactors=FALSE) >> > > Both do not seem to work: > >> dat2 <- data.frame(d

Re: [R] noob requesting help

2012-06-16 Thread capital_P
David Winsemius wrote > >> Try >> >> dat2 <- data.frame(do.call(cbind, dat), stringsAsFactors=FALSE) > > Use instead: > > dat2 <- data.frame( dat, stringsAsFactors=FALSE) > Both do not seem to work: > dat2 <- data.frame(do.call(cbind, dat), stringsAsFactors=FALSE) Error: cannot allocate vect

Re: [R] noob requesting help

2012-06-14 Thread Rui Barradas
Hello, Thanks, I wasn't really liking it very much but it more of a diffuse feeling than of a founded thought. It's good to see an example. Rui Barradas Em 14-06-2012 14:22, David Winsemius escreveu: On Jun 14, 2012, at 3:20 AM, Rui Barradas wrote: Hello, Now the output of str() says 'da

Re: [R] noob requesting help

2012-06-14 Thread David Winsemius
On Jun 14, 2012, at 3:20 AM, Rui Barradas wrote: Hello, Now the output of str() says 'dat' is a list not a data.frame. That's why R is complaining about dimensions (lack of, in this case). Try dat2 <- data.frame(do.call(cbind, dat), stringsAsFactors=FALSE) The construction data.frame(cb

Re: [R] noob requesting help

2012-06-14 Thread Rui Barradas
Hello, Now the output of str() says 'dat' is a list not a data.frame. That's why R is complaining about dimensions (lack of, in this case). Try dat2 <- data.frame(do.call(cbind, dat), stringsAsFactors=FALSE) Then run the lapply() Also, if dput(head(dat, 20)) is very big, ommit the argument

Re: [R] noob requesting help

2012-06-13 Thread capital_P
Rui Barradas wrote > > Sorry, but the output of dput() starts with 'structure', not like what > you've posted. > And there are much more than 20 dates in the beginning. > > The posting guide is easy to find > apologies for my earlier ignorance. It seems the output of dput(head(data, 20) is t

Re: [R] noob requesting help

2012-06-08 Thread Rui Barradas
Hello, Try something along the lines of res <- lapply(split(dat, list(dat$id, dat$trip)), function(x) x[x$time == min(x$time), ]) do.call(rbind, res) Note that 'data' is an R function, so I've called it 'dat'. And that the column names are not exactly the same. Also, you should follow the