Hi all,
Sorry about this, my brain finally ticked over.
I just
need to convert the list of brobs to a numeric vector (which I can do,as
the answer to
the calculation need not be a brob -- just the terms along the way).
so
nums<-sapply(t,as.numeric)
Does the trick in my case, I think.
Matt Redding
-----Original Message-----
From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-project.org]
On Behalf Of Redding, Matthew
Sent: Wednesday, 28 May 2008 10:18 AM
To: r-help at r-project.org
Subject: [R] indexing lists, using brobdingnagian
Dear R-Gurus,
I have ended up with a calculation problem where I need to use brobs.
I have to work my way through a vector with a for loop to act on each
element in a calculation (refering to the previous value in the new
vector of results -- so as far as I know I can't use
"apply") -- this produces a list of brobs.
My problem is, how do I act on, plot this list, or do vector
calculations with the elements? From the other emails I have read there
does not seem to be a means of indexing a range of elements from a list.
library(Brobdingnag)
t<-c(as.brob(5), as.brob(6), as.brob(7), as.brob(8), as.brob(10))
> t
[[1]]
[1] +exp(1.6094)
[[2]]
[1] +exp(1.7918)
[[3]]
[1] +exp(1.9459)
[[4]]
[1] +exp(2.0794)
[[5]]
[1] +exp(2.3026)
> t[2:4]
[[1]]
[1] +exp(1.7918)
[[2]]
[1] +exp(1.9459)
[[3]]
[1] +exp(2.0794)
So if you try plotting that against another variable:
xval<-c(1,2,3,4,5)
plot(t,xval)
you get nothing useful.
Does anyone have some suggestions as to how to make this list of brobs
more useful?
I thought cbind might help (cbind(t)) but that did not work.
Kind regards,
Matt Redding
********************************DISCLAIMER**************...{{dropped:15}
}
______________________________________________
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.
********************************DISCLAIMER****************************
The information contained in the above e-mail message or messages
(which includes any attachments) is confidential and may be legally
privileged. It is intended only for the use of the person or entity
to which it is addressed. If you are not the addressee any form of
disclosure, copying, modification, distribution or any action taken
or omitted in reliance on the information is unauthorised. Opinions
contained in the message(s) do not necessarily reflect the opinions
of the Queensland Government and its authorities. If you received
this communication in error, please notify the sender immediately and
delete it from your computer system network.