similar to: growing a list sequentially -- memory management

Displaying 20 results from an estimated 800 matches similar to: "growing a list sequentially -- memory management"

2008 Oct 20
2
Extracting variables with a given prefix in the parent environment
hi, get.vars.name.prefix<-function(prefix){ result<-list() len<-nchar(prefix) var.names<-ls(name=1,pattern=prefix) #name=1 probably wrong option print(var.names) for(i in 1:length(var.names)){ name<-var.names[i] field<-substr(name,len+1,nchar(name)) result[[field]]<-get(name) } result } for example x.1<-1 x.2<-2 get.vars.name.prefix("x.") should
2008 Oct 27
3
Arrays of Trellis plots
hello, the example below does not work. (i know it's not supposed, but it makes it clear what i'm trying to achieve) par(mfrow=c(2,1)) xyplot(y~x2|x1,data=dataframe1,pch=20) xyplot(y~x2|x1,data=dataframe2,pch=20) i know i could probably merge the two datasets and do something like xyplot(y~x2|x1+dataset,data=merged) any other suggestion? thanks. [[alternative HTML version deleted]]
2008 Oct 13
1
Trellis, conditioning on more than 2 variables,
hello, i need help with: data$f1<-as.factor(data$f1) data$f2<-as.factor(data$f2) s3<-equal.count(data$s2,number=3) densityplot(~y| f1 + f2 + s3, data=mydata ) this produces 3 plots, *successively*, one for each value of s3. i was hoping it would produce one plot. is trellis limited to 2 conditional variables? if not, what are the appropriate commands? thanks! [[alternative HTML
2008 Mar 21
4
difference between 2 ecdfs
hi, a) i have something like: ecdfgrp1<-ecdf(subset(mydata,TMT_GRP==1)$Y); ecdfgrp2<-ecdf(subset(mydata,TMT_GRP==2)$Y); how can i plot the difference between these 2 step functions? i could begin with ecdfrefl<-function(x){ecdfgrp2(x)-ecdfgrp1(x);} ... what next? b) if i have a vector with repeated numeric values how can i get the subset without repeated values .e.g (0,4,0,2,2)
2008 Nov 19
1
rkward on Ubuntu heron with R2.8.0
I am running R on Ubuntu Heron. I recently updated to R 2.8.0 from the default (2.6) in the Ubuntu heron repository by adding deb http://cran.stat.sfu.ca/bin/linux/ubuntu hardy/ I updated all packages installed in /usr/lib/R/site-library and those in my home directory /home/duncan/R/i486-pc-linux-gnu-library/2.6 without obvious issues. I installed adehabitat and gpclib, which should be good
2008 Oct 17
1
R-code in Latex --- $ sign causes error
hi, here's what i have: \lstset{ basicstyle=\ttfamily, keywordstyle=\bfseries, showstringspaces=false, columns = fullflexible, mathescape = true, language=R } \begin{lstlisting} lst$val<-val \end{lstlisting} ./software.tex:16:Extra }, or forgotten \endgroup. lst$ the culprit here is the $ sign. thanks. ps: i'm posting here rather than Latex is bec i guess an R user is
2008 Mar 27
1
histogram for integer data
hi, library(lattice) x<-c(-1,-1,-1,0,0,0,0,1,1,2) rng<-range(x) histogram(x,endpoints=c(rng[1]-0.5,rng[2]+0.5),nint=length(unique(x))) instead of contiguous bins, i'd like spaces between them to indicate that the data is discrete, or even better, line segments positioned at integer values. i know how to do this with plot, but i need it with histogram, so that in more complicated
2008 Oct 20
1
passing a list where names arguments are expected
hi, say i have a function f and i'd like to to call it like this: 1) f(list(a=...,b=...)) but i can't do it, because f is defined as: 2) f<-function(a=NULL,b=NULL){...} is there a way that i can approximate 1), such as mapping list(a=,...b=...) to "list(a=,...b=...)" and then replacing "list" by "f", and then evaluating the expression? thanks.
2008 Oct 24
1
changed behaviour of 'get' in 2.8.0: request for unchange
There is an unannounced and non-backwards-compatible change to the behaviour of 'get' in R2.8.0. 'get'ting a missing value now causes an error, whereas hitherto it's just returned a "missing" object. For example, in R2.8.0 this happens: test> getto <- function( x) get( 'x', sys.frame(1)) test> getto() Error in get("x", sys.frame(1)) :
2011 Jun 09
1
a bug in heatmap.plus?
Hi Allen and list, See the code below.? I've tried it on R2.13 and R2.8.0 using either heatmap.plus 1.3 or the latest.? All gave the same results.? The problem is in the last line: when I tried to plot two different color bars, the one corresponding to "cm.colors(10)" is not correct (it starts with one black and one red.? Not sure where they're from?) Any ideas? Thanks!
2009 Feb 27
1
Sweave doesn't do csv.get()
Hi Everybody I use R2.8.0 on Mac OS X. I set up LyX 1.6.1 to use Sweave today. I can compile the test file I found on CRAN ( http://cran.r-project.org/contrib/extra/lyx/) without a problem and the output looks very nice. In the test file the following R code is used. <<myFirstChunkInLyX>>= xObs <- 100; xMean <- 10; xVar <- 9 x <- rnorm(n=xObs, mean=xMean, sd=sqrt(xVar))
2009 Mar 20
4
how to make aggregation in R ?
Hi, I am trying to aggregate the sum of my test data.frame as follow: testDF <- data.frame(v1 = c("a", "a", "a", "a", "a", "b", "b", "b", "b", "b", "c", "c", "c", "c", "c", "d", "d", "d", "d",
2008 Dec 01
1
Coercing a list of variables in a function call
This is hopefully a trivial problem for list subscribers, but I am very new to writing R functions. I wish to call an R function written by myself from another program to fit a model. I need to tell it which of the independent variables are factors. I need to do this in a generic way, so that when the list is passed, R will work through the variables in the data frame and coerce them into being
2006 Jul 30
3
Where to store filesystem path?
Hello, My app needs to know where to store files but the path is different for dev and production. What is the best way to do it? - something like $path = ''/home/myrailsapp/public/files/'' in development.rb and $path = ''/home/my_remote_prod_sapp/public/files/'' in production.rb? - do a test to check the env and add the path in application.rb? - do a test to
2009 Feb 01
0
possible memory leak involving looping, optimization, and gam
When I run the gam function as part of an optimization and do the optimization many times using a loop, I'm finding that memory use increases over time (based on simply monitoring top). Below is some example code that involves varying the penalty parameter in gam, trying to find the value that gives exactly 50 edf for a simple smoothing problem. I thought I would post to the list to see if
2009 May 18
0
R 2.9.0 slower than R 2.8.1 for the data.frame function
Dear developers, I have noticed difference in computation time for the data.frame function between R2.9.0 and R2.8.1. The older release is more efficient: typically, R2.9.0 spends three more time in the data.frame function. Therefore, when many calls of this kind is done inside a function, the additional time spent with R2.9.0 may be several minutes. Looking at the profiling results (see file
2008 Nov 15
1
PostScript File Dimensions
Hi List, here I go again. Well I need to save plotted objects as .eps using the postscript() function, well I can do that but all resulting object are perfect squared dimensions (x = y). I need a rectangular output something like x = 2y dimension. Is it possible? The I’m new to R and postscript image format! I’m doing this…
2009 Mar 04
0
inserting lines in large data set
Hello, I need to insert a line after every eigth row (group/suset) which should contains the following: <(an incremented ID),0,1,1,1,1> I have two problems with constructing my code: 1. I am getting NAs in three of the columns and 2) I can not find a way to write the ID (group name) at the beginning of the inserted line. Below the # sign I show one of the ways I tried from a variation
2008 Oct 05
2
trouble with character \u00e2
Greetings R-wizards: For historical reasons I have filenames with the character "?" and have successfully used "\u00e2" in its place, with the hoped-for result on all my on-screen plots. However since R2.7.0 I have trouble with savePlot() when the file name includes that character as it does in this example: savePlot(paste("diagnostic ? vs a ", file.label,
2008 Sep 03
1
ugly plots with xlim/ylim exceeding data range (changed since R2.6.1)
The behaviour of the plot function when used with xlim/ylim and the matplot function as in the following simple example changed between R2.6.1 and 2.7.0+ producing ugly plots in the new versions. In case of plot it looks like the pretty function is called with wrong arguments (i.e. range of supplied data rather than values of xlim and ylim): m = matrix(c(-0.033, 0.009, 0.064, 0.050, 0.097,