Re: [R] Notation for previous observation in a data frame

2012-07-08 Thread arun
Hi, Try this:   dat1<-data.frame(var1=15:25) dat1$var2<-NA  dat1$var2[2:11]<-dat1$var1[1:10]  dat1    var1 var2 1    15   NA 2    16   15 3    17   16 4    18   17 5    19   18 6    20   19 7    21   20 8    22   21 9    23   22 10   24   23 11   25   24 You can also do the same within the sin

Re: [R] Notation for previous observation in a data frame

2012-07-07 Thread Joshua Wiley
Hi Ernie, I'll use the built in mtcars dataset for demonstrative purposes. You have some condition, which can be used to create an index ## show data frame mtcars ## create index based on your condition i <- which(mtcars$carb == 1) ## set those rows of mtcars in your index ## to the index - 1 mt

Re: [R] Notation

2011-11-30 Thread Paul Hiemstra
Hi Silvano, Your function is not part of the standard R installation. After some googling I found out, but next time: PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. The betareg package provides manua

Re: [R] notation question

2011-07-19 Thread Carson Farmer
Thank you Rolf, >> Using the analysis of co-variance example from MASS (fourth edition, p >> 142), what is the correct notation for the formula "Gas, ~ Insul/Temp >    There shouldn't be a comma after ``Gas'' in that formula. >> - 1"? Obviously, if we fit it as two separate models (as in the >> exa

Re: [R] notation question

2011-07-19 Thread Rolf Turner
On 20/07/11 07:24, Carson Farmer wrote: Dear list, I am currently writing up some of my R models in a more formal sense for a paper, and I am having trouble with the notation. Although this isn't really an 'R' question, it should help me to understand a bit better what I am actually doing when fi