[R] Accessing a list

Greg Snow 538280 at gmail.com
Thu Apr 26 21:13:54 CEST 2012


The latest version of fortunes (from R-forge, not sure about CRAN)
have fortunes up to number 317 which is from just a couple of days ago
(and 312 is the quoted one from February).  For some reason some of
the instances of R on my computer stop at 291, others go up to 317
(running a new instance of R gives all 317, so the problem instances
must still have links to the older version in memory or something).  I
don't know how long it has been around, but I notice that the latest
version now installs with a pdf file in the doc folder with all the
fortunes for when we want a more sequential stroll or a different form
of searching, no more "i<- i + 1; fortune(i)" with a bunch of up arrow
followed by Enter.

Thanks to Achim and the others who maintain the fortunes package and
help preserve the wit and wisdom of the R community and make it easier
for us to learn from the mistakes of others (or others to learn from
my mistakes).

On Wed, Apr 25, 2012 at 5:31 PM, David Winsemius <dwinsemius at comcast.net> wrote:
>
> On Apr 25, 2012, at 6:02 PM, Greg Snow wrote:
>
>> I believe that fortune(312) applies here.  As my current version of
>> fortunes does not show this I am guessing that it is in the
>> development version and so here is what fortune(312) will eventually
>> print (unless something changes or I got something wrong):
>>
>> The problem here is that the $ notation is a magical shortcut and like
>> any other magic if used incorrectly is likely to do the programmatic
>> equivalent of turning
>> yourself into a toad.
>> —Greg Snow (in response to a user that wanted to access a column whose
>> name is
>> stored in y via x$y rather than x[[y]])
>> R-help (February 2012)
>
>
> I second this self-numeration, ...  errr,  self-nomination. I thought it was
> by the maintainer of the mind reading machine, but I see on investigation
> that was Dirk E. I see that 291 is the highest current fortune but ... hey
> ... what the heck ... why not have some NULL fortunes hanging around?
>
> --
> David
>
>>
>> On Tue, Apr 24, 2012 at 9:42 PM, Jim Silverton <jim.silverton at gmail.com>
>> wrote:
>>>
>>> Hi,
>>> I have the following problem- I want to access a list whose elements are
>>> imp1, imp2, imp3 etc I tried theusing the paste comand in a for loop see
>>> the last for loop below. But I keep calling it df but df = imp1 (for the
>>> first run). Any ideas on how I can access the elements of the list?
>>>
>>> Isaac
>>>
>>>
>>>
>>> require(Amelia)
>>> library(Amelia)
>>> data.use <- read.csv("multiplecarol.CSV", header=T)
>>> names(data.use) = c("year", "dischargex1", "y", "pressurex2" , "windx3")
>>>
>>> ts <- c (c(1:12), c(1:12), c(1:12), c(1:12), c(1:12), c(1:12), c(1:12),
>>> c(1:6) )
>>> length(ts)
>>> data.use = cbind(ts, data.use)
>>>
>>> #a.out2 <- amelia(data.use, m = 1000, idvars = "year")
>>>
>>>
>>> n.times = 100
>>> a.out.time <- amelia(data.use, m = n.times, ts="ts", idvars="year",
>>> polytime=2)
>>>
>>> constant.col = dischargex1.col = pressurex2.col = windx3.col =
>>> rep(0,n.times)
>>>
>>> for (i in 1: n.times)
>>> {
>>> x = c("imp",i)
>>> df = paste(x, collapse = "")
>>> data1 = a.out.time[[1]]$df
>>> attach(data1)
>>> y = as.numeric(y)
>>> dischargex1 = as.numeric(dischargex1)
>>> pressurex2 = as.numeric(pressurex2)
>>> windx3 = as.numeric(windx3)
>>> multi.regress = lm(y~ dischargex1 + pressurex2 + windx3)
>>> constant.col[i] = as.numeric(multi.regress[[1]][1])
>>> dischargex1.col[i] = as.numeric(multi.regress[[1]][2])
>>> pressurex2.col[i] = as.numeric(multi.regress[[1]][3])
>>> windx3.col[i] = as.numeric(multi.regress[[1]][4])
>>> }
>>>
>>>
>>> --
>>> Thanks,
>>> Jim.
>>>
>>>       [[alternative HTML version deleted]]
>>>
>>> ______________________________________________
>>> 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.
>>
>>
>>
>>
>> --
>> Gregory (Greg) L. Snow Ph.D.
>> 538280 at gmail.com
>>
>> ______________________________________________
>> 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.
>
>
> David Winsemius, MD
> West Hartford, CT
>



-- 
Gregory (Greg) L. Snow Ph.D.
538280 at gmail.com



More information about the R-help mailing list