Re: [R] using if else function to complete a column in data frame

2017-01-08 Thread David Winsemius
> On Jan 8, 2017, at 9:21 PM, Cacique Samurai wrote: > > Hello all! > > I´m trying to complete the "movimento" column in dataframe based in > the values of "kmr" column in two sequential lines, as below: > > data example (dput in the end of email): > > IDkmr movimento > 510.70

Re: [R] using if else function to complete a column in data frame

2017-01-08 Thread PIKAL Petr
Hi Split option seems to me the most effective and ifelse is in this case not necessary. You can use this function to estimate levels fff <- function(x) sign(diff(x)) test.s <- split(test, test$ID) for (i in 1:length(test.s)) test.s[[i]]$movimento[-1] <- fff(test.s[[i]][,2]) test <- do.call(rbi

[R] R install/libraries

2017-01-08 Thread Chris
I'd appreciate a tip on (re-)installing libraries for R on my windows machine  I have a windows (Windows 7)  computer and a recent version of R installed (3.3.2).  I discovered that when I install R libraries they install to the "my documents" folder rather than to "program files"This seems to al

[R] gridExtra-arrangeGrob

2017-01-08 Thread Felipe Carrillo via R-help
 Hi;The code below used to work on my older version of gridExtra but doesn't work with the new version. Could someonegive me a hint on how to translate this code to the new version of gridExtra code? Thank you beforehand. p1 <- ggplot(iris,aes(Sepal.Length,  Petal.Length, colour=Species)) + geom_

[R] using if else function to complete a column in data frame

2017-01-08 Thread Cacique Samurai
Hello all! I´m trying to complete the "movimento" column in dataframe based in the values of "kmr" column in two sequential lines, as below: data example (dput in the end of email): IDkmr movimento 510.700 314.20NA 110.700 278.74NA 210.700 278.74N

Re: [R] Linear optimization with quadratic constraints

2017-01-08 Thread ProfJCNash
Small example code to set up the problem? JN On 2017-01-07 06:26 AM, Preetam Pal wrote: > Hi Guys, > Any help with this,please? > Regards, > Preetam > > On Thu, Jan 5, 2017 at 4:09 AM, Preetam Pal wrote: > >> Hello guys, >> >> The context is ordinary multivariate regression with k (>1) regress