similar to: Extracting variables with a given prefix in the parent environment

Displaying 20 results from an estimated 20000 matches similar to: "Extracting variables with a given prefix in the parent environment"

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)
2009 Sep 28
1
model.matrix troubles with AlgDesign
Dear DevelopeRs, in continuing with my suite of packages on experimental design, I am stuck with an issue that appears to be related to package AlgDesign - I have tried to get it solved by Bob Wheeler, but he seems to be stuck as well. Whenever AlgDesign is loaded, some of my code does not work any more. For example, in a fresh R session: require(DoE.base) fac.design(nlevels=c(2,6,2))
2012 Feb 23
1
segfault when using data.table package in conjunction with foreach
Hi all, I'm trying to use the package read.table within a foreach loop. I'm grabbing 500M rows of data at a time from two different files and then doing an aggregate/tapply like function in read.table after that. I had planned on doing a foreach loop 39 times at once for the 39 files I have, but obviously that won't work until I figure out why the segfault is occurring. The
2010 Mar 29
3
one way to write scripts in R
Dear R users, A colleague of mine asked me how to write a script (an executable text file containing R code) in R. After I showed him, he said that after extensive searching of the R archives, he had not found anything like these techniques. He suggested that I share these methods to enable others to leverage R as a better alternative to bash/perl scripts. So in the interest of giving back to
2009 Aug 11
1
Passing a list object to lapply
Hello, I'm having difficulty passing an object name to a lapply function. Can somebody tell me the trick to make this work? #Works T13702 <- TRACKDATA[["13702.xls"]][["data"]] min(unlist(lapply(list(T13702), function(x) mdy.date(x[1, 2], x[1, 1], x[1, 3])))) 16553 #Works d<-2 assign(paste("T",substr(names(TRACKDATA)[d],1,(nchar(names(TRACKDATA)[d]
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 Nov 13
2
growing a list sequentially -- memory management
hello, i have something like: out<-list() for(i in 1:n){ data<-gen(...) #fixed size data out[[i]]<- fun(data) } > object.size(out[[1]]) 6824 In principle 1 GB should allow n = 1024^3/6824 = 157347? i have about 2GB are not taken by other processes. however, I can see the memory shrinking quite rapidly on my system monitor and have to stop the simulation after only n=300. why
2007 Mar 04
1
Problem using callNextMethod() in S4
Dear all, Maybe, I am doing something wrong, but using R-2.5.0 on my Intel-Mac, I have problems using function callNextMethod() in method initialize. I am loading the following code as file "testS4.R": setClass("baseClass", representation(myname = "character", mydir = "character", "VIRTUAL"),
2015 Oct 05
9
Error generated by .Internal(nchar) disappears when debugging
On 05/10/2015 7:24 PM, Matt Dowle wrote: > Joris Meys <jorismeys <at> gmail.com> writes: > >> >> Hi all, >> >> I have a puzzling problem related to nchar. In R 3.2.1, the internal > nchar >> gained an extra argument (see >> https://stat.ethz.ch/pipermail/r-announce/2015/000586.html) >> >> I've been testing code using the
2015 Oct 05
2
Error generated by .Internal(nchar) disappears when debugging
Hi all, I have a puzzling problem related to nchar. In R 3.2.1, the internal nchar gained an extra argument (see https://stat.ethz.ch/pipermail/r-announce/2015/000586.html) I've been testing code using the package copula, and at home I'm still running R 3.2.0 (I know, I know...). When trying the following code, I got an error: > library(copula) > fgmCopula(0.8) Error in
2010 Jun 03
2
lapply or data.table to find a unit's previous transaction
I have a dataset of property transactions that includes the transaction ID (TranID), property ID (UnitID), and transaction date (TranDt). I need to create a data frame (or data table) that includes the previous transaction date, if one exists. This is an easy problem in SQL, where I just run a sub-query, but I'm trying to make R my one-stop-shopping program. ?The following code works on a
2012 Sep 14
1
please comment on my function
this function is supposed to canonicalize the language: --8<---------------cut here---------------start------------->8--- canonicalize.language <- function (s) { s <- tolower(s) long <- nchar(s) == 5 s[long] <- sub("^([a-z]{2})[-_][a-z]{2}$","\\1",s[long]) s[nchar(s) != 2 & s != "c"] <- "unknown" s }
2010 Feb 08
2
Error on start R in server
Hello all, (Thank for your reply) I have a web-application in Apache Tomcat, when i start R in this application, I used packe RSJava Code ROmegahatInterpreter interp; String [] rargs = {"--no-save"}; REvaluator e; interp = new ROmegahatInterpreter ( ROmegahatInterpreter.fixArgs(rargs),false ); e =new REvaluator (); Errors ================ R version 2.10.1 (2009-12-14)
2009 Dec 30
1
seg-fault... but on what
I got the following after running succesfully through this loop 28 million times... the loop opens text files in a directory and inserts line by line into a database... *** caught segfault *** address 0xc0000010, cause 'memory not mapped' Traceback: 1: .getGeneric(f, where, package) 2: getGeneric("coerce", where = where) 3: as(obj, "integer") 4:
2005 Feb 11
3
getAnywhere and functions starting with "." (PR#7684)
Full_Name: Mark Bravington Version: 2.0.1 OS: Windows XP Submission from: (NULL) (140.79.22.104) 'getAnywhere' crashes when its argument starts with a period: > getAnywhere( '.onLoad') Error in exists(x, envir, mode, inherits) : invalid first argument One fix might be to replace the line if ( !is.null(f <- getS3method(gen, cl, TRUE))) { with if ( nchar( gen)
2015 Oct 06
1
Error generated by .Internal(nchar) disappears when debugging
On 05/10/2015 8:25 PM, Matt Dowle wrote: > > On Mon, Oct 5, 2015 at 4:57 PM, Duncan Murdoch <murdoch.duncan at gmail.com > <mailto:murdoch.duncan at gmail.com>> wrote: > > On 05/10/2015 7:24 PM, Matt Dowle wrote: > > Joris Meys <jorismeys <at> gmail.com <http://gmail.com>> writes: > > > >> > >> Hi all,