I'm pretty new in R, trying to create a dataframe with several factors, one of them ("probability") needs to consist of a sequence of ascending values (30, 40, 50, 60, 70) 25 times, followed by a sequence of descending values (70, 60, 50, 50, 30) for 25 times.
here's what i have tried so far:
probability = c(seq(30, 70, 10, along_with=1:25), rev(seq(30, 70, 10, along_with=1:25))),
probability = rep(c(c(30, 40, 50, 60, 70), len=25), rep(c(70, 60, 50, 40, 30), len=25)),
probability = rep(c(c(30, 40, 50, 60, 70), c(70, 60, 50, 40, 30), each=25)),
I would appreciate any help from you guys...
Thanks!
I think you need this:
probability_ascending<-rep(c(30, 40, 50, 60, 70),25)
probability_descending<-rep(c(70, 60, 50, 40, 30),25)
If you want it in one vector:
probability<-c(rep(c(30, 40, 50, 60, 70),25),rep(c(70, 60, 50, 40, 30),25))