Displaying 4 results from an estimated 4 matches for "pond_id".
2009 Jun 16
3
How to subset my dataframe? (a bit tricky)
...would like to subset my dataframe, keeping only those rows which
satisfy the following conditions:
1) the string "dnv" is found in at least one column;
2) the value in the column previous to the one "dnv" is found in is not "0"
Here's what my data look like:
??? POND_ID 2009-05-07 2009-05-15 2009-05-21 2009-05-28 2009-06-04
4 ? ? ? 101 ? ? ? 0.15 ? ? ? ? ?0 ? ? ? ?dnv ? ? ? ?dnv ? ? ? ?dnv
7 ? ? ? 102 ? ? ? ?? 0 ? ? ? ?dnv ? ? ? ?dnv ? ? ? ?dnv ? ? ? ?dnv
87 ? ?? 103 ? ? ? 0.15 ? ? ?? dnv ? ? ? ? ?1 ? ? ? ? ?1 ? ? ? ? ?1
99 ? ?? 104 ? ? ?? dnv ? ? ? 0.25 ? ? ? ??...
2009 Jun 24
5
How to avoid ifelse statement converting factor to character
...TUS
is converted from a factor to a character.
Is there some way I can avoid this conversion?
Thanks in advance, Mark Na
> str(data)
'data.frame': 2100 obs. of 11 variables:
$ DATE : Factor w/ 5 levels "4-Jun-09","7-May-09",..: 1 1 1 1 1 1
1 1 1 1 ...
$ POND_ID : Factor w/ 113 levels "10","18","19",..: 8 8 8 8 8 8 8 8 8
8 ...
$ STATUS : num 1 1 1 1 1 1 1 1 1 1 ...
$ SPECIES : Factor w/ 25 levels "AGWT","AMCO",..: 10 10 7 7 3 5 5 5 5
2 ...
$ SOCIAL_STATUS : Factor w/ 8 levels "A...
2009 Jun 30
1
How to wrap my (working) code in a loop or function? (loop/function newbie alert)
...MAKE A VECTOR OF START TIMES
t1<-match(times$STOP_DT, data$DATETIME) #MAKE A VECTOR OF STOP TIMES
indices<-mapply(FUN = ":", t0, t1) #MAKES A LIST, EACH ELEMENT CONTAINS
INDICES OF TIMES CORRESPONDING TO ONE WETLAND
idex<-times[rep(1:nrow(times), sapply(indices, length)),
c("POND_ID","OBS","REP","PID"), drop = FALSE] #MAKES A DATAFRAME
tm<-data[unlist(indices), ] #FLATTENS THE LIST OF INDICES INTO A DATAFRAME
extracted<-cbind(idex, tm) #BIND IDEX AND TM
But now that I've split my data into a list with five elements, what I don'...
2009 Jun 23
2
Problem with ifelse statement
...Thanks!
Thanks, Mark Na
> str(data)
'data.frame': 2100 obs. of 13 variables:
$ DATE :Class 'Date' num [1:2100] 14399 14399 14399 14399 14399 ...
$ OBS : Factor w/ 7 levels "AJG","LEB","MB",..: 3 3 3 3 3
3 3 3 3 3 ...
$ POND_ID : Factor w/ 118 levels "1","10","100",..: 86 86 86
86 86 86 86 86 86 86 ...
$ STATUS : num 1 1 1 1 1 1 1 1 1 1 ...
$ SPECIES : Factor w/ 25 levels "AGWT","AMAV",..: 16 16 12 12
4 7 7 7 7 3 ...
$ SOCIAL_STATUS : Factor w/ 9...