[R] noob requesting help
capital_P
petervw48 at hotmail.com
Fri Jun 8 15:02:03 CEST 2012
I'm fairly new to R and still learning how to use it. I could really use some
help with the following problem.
I have a huge .csv file containing thousands of measurements on 34 different
birds. Measurements include longitude, latitude, altitude, speed, time, etc.
All birds have a different number (ranging from 121 to 542). All
measurements have a tripID (1 for the first trip of every bird, 2 for the
second, etc.)
I need to create a vector containing only the first measurement of every
trip. I need this to see at what time a bird leaves the nest and eventually
make a histogram out of that.
I need to write a piece of code that would look something like this:
bird121trip1 <- (data[which(data$device_info_serial == 121 &
[which(data$tripID == 1)] & [which(data$time == "lowest"),]
bird121trip2 <- (data[which(data$device_info_serial == 121 &
[which(data$tripID == 2)] & [which(data$time == "lowest"),]
bird130trip1 <- (data[which(data$device_info_serial == 130 &
[which(data$tripID == 1)] & [which(data$time == "lowest"),]
etc.
trip.departures <- c(bird121trip1, bird121trip2, bird130trip1, etc)
I could do it like I described above (although I would have to replace
"lowest" with something that actually works), but I have 34 birds and many
of them have hundreds of different trips. I'm sure there's an easier and
faster way to do that.
Any help would be greatly appreciated. Thanks in advance.
--
View this message in context: http://r.789695.n4.nabble.com/noob-requesting-help-tp4632803.html
Sent from the R help mailing list archive at Nabble.com.
More information about the R-help
mailing list