[R] Multi-line input to rsympy

From: Joanna Lewis <joanna.lewis_at_ucl.ac.uk>
Date: Fri, 04 Mar 2011 11:48:06 +0000


Dear R users,

I have been using rsympy to solve a set of simultaneous equations from R. There are two solutions for the variable I'm interested in, xx[0] and xx[1], which are in terms of symbols called lam and conc. I'd like to pick out the one which is positive at (lam=0, conc=0) and call it mysol.

In python I could write:

if (xx[0].subs(lam,0)).subs(conc,0)>0:
  mysol=xx[0]
else:
  mysol=xx[1]

but I'm not sure how to do it from R via rsympy. The various combinations of \t and \n characters and spaces I've tried haven't worked, and I haven't been able to find any examples online or in the help file.

Do you know whether it is possible to enter multi-line input using rsympy, and if so how?

Thank you in advance,
Joanna



R-help_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. Received on Fri 04 Mar 2011 - 14:22:48 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Sat 05 Mar 2011 - 22:00:19 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive