Skip to content
Prev 854 / 398502 Next

R-beta: S Compatibility (again)

On Sun, 12 Apr 1998, Bill Venables wrote:
While language manipulation is much more limited than in S, you probably
could write a version of deriv() (if it didn't already exist) since
expressions can be manipulated quite well.

eg
R> a
expression(sin(cos(x + 1)))
R> a[[1]]
sin(cos(x + 1))
R> a[[1]][[1]]
sin
R> a[[1]][[2]]
cos(x + 1)
R> a[[1]][[2]][[2]]
x + 1
R> a[[1]][[2]][[2]][[1]]
+
R> a[[1]][[2]][[2]][[2]]
x
R> a[[1]][[2]][[2]][[3]]
[1] 1
R> a[[1]][[1]]<-as.name("cos")
R> a
expression(cos(cos(x + 1)))


Thomas Lumley
------------------------
Biostatistics		
Uni of Washington	
Box 357232		
Seattle WA 98195-7232	
------------------------

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._