Re: [R] Simple Model in R

2013-09-07 Thread Bert Gunter
Folks: 1. Ankur needs to read "An Introduction to R" or other R tutorial (on the web, say), as it appears that he has not made much of an effort to learn how R works. In particular, R is not a data base and does not (normally, at user level) use pointers/references. So no automatic updating. 2. I

Re: [R] Simple Model in R

2013-09-07 Thread Rui Barradas
Hello, What you can do is to write a function to do the change. When you want to change a value in column Value, it will update the value in column New. Something like this: fun <- function(data, row, newval){ data$Value[row] <- newval data$New <- c(NA, diff(data$Value))

Re: [R] Simple Model in R

2013-09-07 Thread Ankur Seth
Is there a way in which I can setup a model like that? Regards, Ankur Seth On Sat, Sep 7, 2013 at 4:49 PM, Rui Barradas wrote: > Hello, > > It will not change the value automatically, you will have to rerun the > code. > > Rui Barradas > > Em 07-09-2013 11:52, Ankur Seth escreveu: > >> Thanks

Re: [R] Simple Model in R

2013-09-07 Thread Rui Barradas
Hello, No, I don't believe so. If you change one column and want another column to change you have to tell R to do it. Rui Barradas Em 07-09-2013 12:19, Ankur Seth escreveu: Is there a way in which I can setup a model like that? Regards, Ankur Seth On Sat, Sep 7, 2013 at 4:49 PM, Rui Barr

Re: [R] Simple Model in R

2013-09-07 Thread Rui Barradas
Hello, It will not change the value automatically, you will have to rerun the code. Rui Barradas Em 07-09-2013 11:52, Ankur Seth escreveu: Thanks Rui, but this does not change the value in the new column automatically if I change the value in the data column. Any ideas? Regards, Ankur Seth

Re: [R] Simple Model in R

2013-09-07 Thread Ankur Seth
Thanks Rui, but this does not change the value in the new column automatically if I change the value in the data column. Any ideas? Regards, Ankur Seth On Sat, Sep 7, 2013 at 2:11 PM, Rui Barradas wrote: > Hello, > > Try the following. > > dat <- read.table(text = " > > Date

Re: [R] Simple Model in R

2013-09-07 Thread Rui Barradas
Hello, Try the following. dat <- read.table(text = " DateValue 08/01/2013100 08/02/2013 100.5 08/03/2013 102 ", header = TRUE) dat$New <- c(NA, diff(dat$Value)) dat Hope this helps, Rui B

[R] Simple Model in R

2013-09-07 Thread Ankur Seth
Hello All, I am trying to build a model in R. I am facing the following problem... My Data Frame contains the following data... DateValue 08/01/2013100 08/02/2013 100.5 08/03/2013 102 No