Displaying 4 results from an estimated 4 matches for "locid".
Did you mean:
ocid
2005 Oct 12
2
subsetting with by() or other function??
I think I must be missing something obvious, but I'm having trouble
getting a data transformation to work on groupings of data within a data
frame (csss3) as defined by 2 factors (population, locid). The data are
sorted by year within locid within population and I want to lag another
variable (dbc), i.e, shift them down by 1 row replacing the first row with
NA, within groups defined by locid nested within population. I thought I
could do something using by(csss3,list(locid, population),...
2005 Oct 13
1
subsetting data frame using by() or tapply() or other
...not dimensionally consistent with the data frame (data). So
how do I go from the list output of tapply() to create a dimensionally
consistent vector that can create the new variable in my original data
frame? I've been trying to use a function like
data$LAG1DBC <- tapply(data$DBC, data$LOCID, function(x) c(NA,
x[-length(x)]))
which creates a list of dimension much smaller than the nrows in data. And
I've tried things like using as.data.frame.array() or as.data.frame.list()
in front of tapply() and still have the same problem. I know this can't
be that unusual of a data man...
2013 Mar 08
2
Coversion from yearly to weekly data
Dear all, I have a big data matrix and I want to convert those data into
weekly basis which means 7 days needs to be avaraged and aggregate a single
value
> dput(test)
structure(list(locid = structure(c(1L, 1L, 1L, 1L, 1L, 1L, 1L,
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
1...
2008 Jan 15
1
error in my selection
...immediate purpose they are not of interest now.
Code (and i hope it does not come scrambled):
----------------------
> x3 <- read.csv("unique_veg_id.csv")
### columns in my data:
> dimnames(x3)[[2]] [1] "LocatID" "Region" "Total" "LocID" "UTMX" "UTMY" "Class" "cat3_name" "EventID" "day_sampl" "uniqueID" > > x3_reg1 <- x3[x3$Region == "JELA_reg1",]> > ma1 <- ftable(xtabs(Total ~ uniqueID + cat3_name, data=x3_re...