Re: [R] data management question

2012-02-07 Thread David Winsemius
On Feb 8, 2012, at 12:23 AM, Sebastián Daza wrote: Hi everyone, I would like to have a function to compute some values in a dataset. First, I have to define a value for the lx variable in row 1 (e.g., 100,000), npx is a given proportion. lx of row 2 is equal to lx of row 1 times npx of row 1. I

Re: [R] data management question

2012-02-07 Thread Berend Hasselman
On 08-02-2012, at 06:23, Sebastián Daza wrote: > Hi everyone, > I would like to have a function to compute some values in a dataset. > First, I have to define a value for the lx variable in row 1 (e.g., > 100,000), npx is a given proportion. lx of row 2 is equal to lx of row > 1 times npx of row

[R] data management question

2012-02-07 Thread Sebastián Daza
Hi everyone, I would like to have a function to compute some values in a dataset. First, I have to define a value for the lx variable in row 1 (e.g., 100,000), npx is a given proportion. lx of row 2 is equal to lx of row 1 times npx of row 1. I can do this row by row... data[1,"lx"] <- 10 dat

Re: [R] data management question

2008-05-09 Thread Philipp Pagel
> I want to draw a subset of "ex" by selecting only the A and B units: > > > ex1 <- subset(ex[which(ex$id=="A"|ex$id=="B"),]) or a bit simpler: ex1 <- subset(ex, ex$id %in% c('A','B')) In your expresion you don't need the subset function, as you are already using indexing to extract the desired

[R] data management question

2008-05-08 Thread Deepankar Basu
Hi all, I have a data management question. I am using an panel dataset read into R as a dataframe, call it "ex". The variables in "ex" are: id year x id: a character string which identifies the unit year: identifies the time period x: the variable of interest (which might contain NAs). Here