On Saturday 15 October 2016 01:39 AM, libreoffice-ml.mbou...@spamgourmet.com 
message wrote:
> 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))

it is an example of R script.
I'm not familiar with whatever language that is (presumably one of the
macro languages supported by LibreOffice?),
i am not sure if R scripts are supported for macros in libreoffice. one 
extension was available for OO but it has been discontinued for a long time.
but I would have thought
your second condition would need to be in what appears to be the "else"
block of the first condition, i.e.:
or maybe, if the 'c' indicates a condition:
just posting the solution here for closing the thread:

testchange <- cut(testseq, breaks=c(0,4,21), labels=c("x","y"))
(credit goes to Pikal for sharing the answer in R mailing list)



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