similar to: using by() in a function

Displaying 20 results from an estimated 3000 matches similar to: "using by() in a function"

2000 Apr 28
1
Using 'by()' in a function
I have a list of dataframes, and want to apply a function to subsets of the rows of each dataframe. It seemed natural to write a function that takes a dataframe as an argument, and uses 'by() within it to apply the function to the dataframe subsets. However, I cannot get it to work. The problem seems to be passing the data argument of by() as a function argument. Is this bug, or am I
2003 Apr 04
3
creating function bodies using body()
I'm having trouble figuring out how to create a function using "body<-" (). The help file for body() says that the argument should be a list of R expressions. However if I try that I get an error: > tmpfun <- function(a, b=2){} > body(tmpfun) <- list(expression(z <- a + b),expression(z^2)) Error in as.function.default(c(formals(f), value), envir) :
2000 Jul 13
1
documentation for contrasts and contrasts<- (PR#607)
The documentation (in ver 1.1) for contrasts and contrasts<- does not list all the arguments for those functions. In addition to x, the factor whose contrasts are being extracted or set, contrasts() has the argument 'contrasts=TRUE', and contrasts<-() has the argument 'how.many'. It was this latter that had me flummoxed, because I wanted to reparametrize a model by
2000 Aug 01
1
R_FindSymbol
I have written a function that uses LSODA from NETLIB to solve initial value problems, given a system of ODEs written as an R function. There are times when it would be convenient to use the code with an ode system written in a compiled language. Certainly, that can be done using .C or .Fortran within an R function, but that seems inefficient (indeed, it does not enormously speed up the
2001 May 30
1
Rcmd REMOVE does not allow --library argument (PR#957)
This is in Windows 98. The problem exists in both rw1021 and rw1023, using ActiveState Perl builds 620 and 626: C:\>Rcmd REMOVE --library=C:/R/Rlibs RBMDS Unknown option: library Usage: Rcmd REMOVE [options] pkgs Remove the add-on packages specified by pkgs from the default library tree (/library) or the tree specified via `--library'. Options: -l, --library=LIB remove packages
2001 Mar 08
2
surprising behavior of match.arg() (PR#872)
If a function needs to be passed as an argument to another function, default arguments to the function being passed are lost. Consider this example: fun1 <- function(x, A=c("power","constant")) { arg <- match.arg(A) cat(paste("A is:",paste(A,collapse=", "),"\narg is:",arg,"\n")) cat("formals:\n") print(formals())
2003 Feb 11
3
Problems with Rcmd check on Win 2000 & rw1062
When I run Rcmd check on a package on my Windows 2000 machine, I get a series of error messages like the following: * checking generic/method consistency ...c:\DOCUME~1\R5018~1.WOO\LOCALS~1\Temp/R utils138414013: cannot open c:DOCUME~1R5018~1.WOOLOCALS~1Temp/Rin138408157: no s uch file It looks as if a Windows style path to the temp directory is not being interpreted correctly, with backslashes
2002 Mar 19
1
pdf page limit
I KNEW I shouldn't trust my memory; the pdf() help page documents a page limit of 500; I don't seem to be exceeding this, however. R. Woodrow Setzer, Jr. Phone: (919) 541-0128 Experimental Toxicology Division Fax: (919) 541-5394 Pharmacokinetics Branch NHEERL MD-74; US EPA; RTP, NC 27711
2000 Dec 15
1
resolution of windows metafiles
I am having trouble getting smooth-appearing curves in figures produced as windows metafiles using R (R-1.1.1 on Windows 98). When I import them into a word processor (either MS Word 97, or WordPerfect 9.0), the figures appear only slightly bumpy on screen, but when printed, there is a clear jaggedness reminiscent of aliasing. Is there a fix for this (if the answer is "upgrade to 1.2",
2002 Jun 28
3
rw1051 binary dist missing dyn.load documentation (PR#1719)
The binary package (version of 6/17) of rw1051 for Windows is missing html documentation for dyn.load() The file is present in $R_HOME/library/base/html, but has zero bytes. dyn.load help IS accessible through the windows help system. platform i386-pc-mingw32 arch i386 os mingw32 system i386, mingw32 status major 1 minor 5.1 year 2002 month 06 day 17 language R
2001 Jun 01
1
formulas in variables in modeling functions
I first noticed this in gnls, but it also happens in lm, so I suspect the following phenomenon is universal in modeling functions. Modify the example from the lm help: model <- as.formula(weight ~ group) lm(model) The result will be printed: > lm(model) Call: lm(formula = model) ^^^^^^^^^^^^^^^^^ Coefficients: (Intercept) groupTrt 5.032 -0.371 This is because in lm,
2001 Dec 13
3
R-1.4.0: how to use getSymbolInfo()?
I have a package that solves systems of ordinary differential equations coded as an R function (odesolve, on CRAN). The function is passed to R code, and c and Fortran code called by it uses lang4() and eval() to evaluate the R function inside a compiled c function to use in a compiled ODE solver. This works quite well, but can be slow. I'd like to be able to supply the name of a compiled
2000 May 24
1
Problem w/cygwin1.1 (maybe)
I am using rw1001 on Windows 98. I have a package that involves both c and fortran code, which compiled successfully under cygnus b20.1 with Mummit Kahn''s port of gcc 2.95.2. I have upgraded to the new net release of cygwin (version 1.1, including the recent cygwin package upgrade to 1.1.1). Now when the dll for my package is being created, I get the string of errors like: [...] gcc
2000 Oct 25
3
.Alias
Probably I've just misread the documentation, but I don't understand the behavior of .Alias. Consider this (on R-1.1.1, both Windows and SGI): > tmp <- matrix(nrow=3,ncol=2) > new <- .Alias(tmp) > new[1,1] <- 1 > tmp [,1] [,2] [1,] NA NA [2,] NA NA [3,] NA NA > new [,1] [,2] [1,] 1 NA [2,] NA NA [3,] NA NA I expected tmp[1,1] to
2002 Jun 04
4
par(xaxp)
I think this is a bug; at least this behavior is not documented in plot or plot.default. plot.default resets xaxp, and leaves xaxp reset when it exits: par(xaxp=c(0,1,4)) print(par("xaxp")) plot(c(0,1),c(0.2,0.3)) print(par("xaxp")) R. Woodrow Setzer, Jr. Phone: (919) 541-0128 Experimental Toxicology Division
2001 Mar 20
2
Are sockets supported on Irix?
When I try to open a server socket on the system setup listed below, I get the following error: > a <- make.socket(port=8091,server=TRUE) Error in make.socket(port = 8091, server = TRUE) : sockets are not available on this system I just wanted to make sure that sockets were generally available for this platform (or, perhaps, I need to upgrade to 1.2.2 on this system), before I got
2001 Sep 21
2
memory usage
Does the following indicate that I have a memory leak? > gc(TRUE) Garbage collection 22891 = 21012+1557+322 (level 2) ... 483257 cons cells free (59%) 11.0 Mbytes of heap free (82%) used (Mb) gc trigger (Mb) Ncells 334906 9.0 818163 21.9 Vcells 309342 2.4 1746173 13.4 > memory.size()/1024/1024 ## in MB [1] 643.8978 > sum(sapply(ls(all.names=TRUE),object.size)) [1] 1776
2001 Sep 12
1
error in nlme
I'm getting an error from nlme that has me stymied. I have a data set ,'mydata', with variables: AChE, Dose, sex, set, and mrid; 'set' and 'mrid' indicate two levels of nesting, with 'set' nested within 'mrid'. I want to fit the model: mod <- nlme(AChE ~ Cexp(Dose, A, B, m), data=mydata, fixed = A+B+M~sex, random=A+B+m~sex | mrid/set,
2005 Mar 02
1
Using varPower in gnls, an answer of sorts.
Back on January 16, a message on R-help from Ravi Varadhan described a problem with gnls using weights=varPower(). The problem was that the fit failed with error Error in eval(expr, envir, enclos) : Object "." not found I can reliably get this error in version 2.0.1-patched 2004-12-09 on Windows XP and 2.0.1-Patched 2005-01-26 on Linux. The key feature of that example is that the
2001 Jul 31
4
nlme: bug in getCovariateFormula (PR#1038)
I found that predict.gnls failed with a wierd error message about a non-numeric argument to a binary vector in one of three nearly identical uses. Error in Inh/Ki : non-numeric argument to binary operator (Inh and Ki are arguments to the function used in the formula for the object whose predictions were requested). It turns out that the problem is in getCovariateFormula(). The final line in