Readers,

Could someone please explain how to apply the function 'ifelse' to change a vector, for various conditions?

testseq<-seq(1:20)
testchange<-ifelse(testseq<=4,'x',testseq)
testchange<-c(ifelse(testseq<=4,'x',testseq),ifelse(testseq>=5,'y',testseq))

The last instruction causes the vector 'testchange' to change dimensions, when the result wanted is:

testchange
x x x x y y y y y y y y y y y y y y y y



--
To unsubscribe e-mail to: users+unsubscr...@global.libreoffice.org
Problems? http://www.libreoffice.org/get-help/mailing-lists/how-to-unsubscribe/
Posting guidelines + more: http://wiki.documentfoundation.org/Netiquette
List archive: http://listarchives.libreoffice.org/global/users/
All messages sent to this list will be publicly archived and cannot be deleted

Reply via email to