search for: 151orange

Displaying 1 result from an estimated 1 matches for "151orange".

2012 Jun 28
3
Nested For Loop
I am creating a nested for loop and following are the codes I'm using, but I am not acheiving what I want. I have a vector d<-151:159 I have another vector e<-e<-c("apple", "orange", "banana") I need to create f as 151apple 151orange 151banana . . 159apple 159orange 159banana Here is how I wrote nested for loop... for (i in 1:length(d)) { for (j in 1:length(e)) { x[j]<-paste(d[i],e[j],sep="") print(x[j]) } } The result of the above codes is.... > for (i in 1:length(d)) + { for (j in 1:length(e)) + { + x[j]&l...