Re: [R] How can we access an element in a structure

2013-06-10 Thread Pascal Oettli
Hello, Already asked and answered here: http://stackoverflow.com/questions/4034436/extract-the-gradient-from-the-deriv-command Regards, Pascal 2013/6/11 jpm miao > Hi, > > I have a structure, which is the result of a function > How can I access the elements in the gradient? > > > dput(te

Re: [R] How can we access an element in a structure

2013-06-10 Thread Jorge I Velez
Hi Miao, Try attributes(test1)[[1]] HTH, Jorge.- On Tue, Jun 11, 2013 at 3:49 PM, jpm miao wrote: > Hi, > > I have a structure, which is the result of a function > How can I access the elements in the gradient? > > > dput(test1) > structure(-1.17782911684913, gradient = structure(c(-0.0

[R] How can we access an element in a structure

2013-06-10 Thread jpm miao
Hi, I have a structure, which is the result of a function How can I access the elements in the gradient? > dput(test1) structure(-1.17782911684913, gradient = structure(c(-0.0571065371783791, -0.144708170683529), .Dim = 1:2, .Dimnames = list(NULL, c("x1", "x2" > test1[[1]] [1] -1.177829 >