similar to: package.skeleton from within function: objects not found

Displaying 20 results from an estimated 5000 matches similar to: "package.skeleton from within function: objects not found"

2011 Jul 25
1
do.call in "with" construction
Dear all, I'd appreciate any help to rectify what must be a misconception of mine how environments work: ########################## myEnv <- new.env() myEnv$a.env <- 1 myEnv$symbols.env <- "a.env" a.global <- 2 symbols.global <- "a.global" myFun <- function(symbols){do.call("print", lapply(symbols, FUN=as.name))} do.call("myFun",
2020 May 12
4
S3 method dispatch for methods in local environments
Dear All, In R 3.6.3 (and earlier), method dispatch used to work for methods stored in local environments that are attached to the search path. For example: myfun <- function(y) { out <- list(y=y) class(out) <- "myclass" return(out) } print.myclass <- function(x, ...) print(formatC(x$y, format="f", digits=5)) myfun(1:4) # prints: [1]
2005 Feb 01
1
Error in load(dataFile, myEnv)
Dear all, I just found that some of the packages are not able to load any more, after I installed R2.0.1 in my Mac, it even affects my old R1.8 installs. It gives me errors when I load packages that contains "myEnv" settings. such as: RMySQL, DBI, Rggobi, etc. But others that does not require "myENV" is all right, like tcltk that only calls the c functions. The errors
2018 Nov 29
4
Unexpected argument-matching when some are missing
When trying out some variations with `[.data.frame` I noticed some (to me) odd behaviour, which I found out has nothing to do with `[.data.frame`, but rather with the way arguments are matched, when mixing named/unnamed and missing/non-missing arguments. Consider the following example: myfun <- function(x,y,z) { ? print(match.call()) ? cat('x=',if(missing(x)) 'missing'
2009 Oct 21
1
formula and model.frame
Suppose I have the following function myFun <- function(formula, data){ f <- formula(formula) dat <- model.frame(f, data) dat } Applying it with this sample data yields a new dataframe: qqq <- data.frame(grade = c(3, NA, 3,4,5,5,4,3), score = rnorm(8), idVar = c(1:8)) dat <- myFun(score ~ grade, qqq) However, what I would like is for the resulting dataframe (dat) to include
2020 May 12
0
S3 method dispatch for methods in local environments
Dear Wolfgang, I think this new behaviour is related to the following R 4.0.0 NEWS item: > S3 method lookup now by default skips the elements of the search path between the global and base environments. Your environment "myenv" is attached at position 2 of the search() path and thus now skipped in S3 method lookup. I have just noticed that
2008 Jan 14
1
rm: failed to get attributes of `/':
Recently I have heard reports like the one below a couple of times: Tineke Casneuf wrote: > However I did encouter an error when trying to install a self-made dummy > package. I am sure it is not due to the package because it can be build on > someone else's windows PC. > > The error message is *rm: failed to get attributes of `/': No such file or > directory. Today I
2006 Jun 02
4
function environment
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Hi, how can I automatically access the functions that I loaded into a separate environment? > save(A,B,file="myfun.r") > load("myfun.r",envir=(ENV<-new.env())) > ls(ENV) [1] "A" "B" ?"[" turned up that I can access the functions via > ENV$A function () { } > ENV$A() NULL Now, how
2010 Oct 20
2
new.env does not recognize parents from subclasses of "environment"
Dear Developers, A lot has been changed in the R12.0 with respect to behavior of "environment" subclasses. Many thanks for that. One small irregularity, though; new.env does not allow the parent to be from S4 subclass. > setClass("myenv", contains="environment") [1] "myenv" > new.env(parent=new("myenv")) Error in new.env(parent =
2017 Jun 18
0
R_using non linear regression with constraints
I've seen a number of problems like this over the years. The fact that the singular values of the Jacobian have a ration larger than the usual convergence tolerances can mean the codes stop well before the best fit. That is the "numerical analyst" view. David and Jeff have given geometric and statistical arguments. All views are useful, but it takes some time to sort them all out and
2012 Feb 01
1
Windows 7 installation of .qz package from SourceForge
Hello, I'm trying to install the package metRology from SourceForge. I save the zip file metRology_0.9-06.tar.gz to my Windows 7 machine, and try to install the package using the RGUI: Packages > Install packages from local zip files > metRology_0.9-06.tar.gz. There's no .zip extension, but R seems to go to work on the installation with a couple warning messages and one error.
2017 Jun 18
3
R_using non linear regression with constraints
I am not as expert as John, but I thought it worth pointing out that the variable substitution technique gives up one set of constraints for another (b=0 in this case). I also find that plots help me see what is going on, so here is my reproducible example (note inclusion of library calls for completeness). Note that NONE of the optimizers mentioned so far appear to be finding the true best
2006 Sep 27
1
potential setClass bug (with user-defined environment)
the following returns an error in an 'exists' call on my machine MyEnv <- new.env() setClass("Numeric", "numeric", where=MyEnv) franklin parlamis > version _ platform powerpc-apple-darwin8.7.0 arch powerpc os darwin8.7.0 system powerpc, darwin8.7.0 status beta major 2 minor 4.0 year
2010 Sep 03
3
S4 Method Signatures
Hello, If the signature of a method defines which generic it implements then I'm confused about why this minimal example I invented won't work : setGeneric("myFun", function(rs, ...){standardGeneric("myFun")}) setGeneric("myFun", function(cs, ...){standardGeneric("myFun")}) setMethod("myFun", "numeric", function(rs, colour =
2006 Feb 02
2
How to get the namespace of a function?
I declared the environment of the function myfun to be NULL as follows: environment(myfun) <- NULL Later on I called that myfun and got an error message because the function index() in the zoo package was called inside myfun and was not visible: Error in myfun(args) : couldn't find function "index" I tried to use zoo::index() instead of index(), but that did not work. In fact,
2011 Feb 02
1
pass nrow(x) to dots in function(x){plot(x,...)}
Dear Rers, I have a function to barplot() a matrix, eg myfun <- function(x, ...) { barplot(x , ... )} (The real function is more complicated, it does things to the matrix first.) So I can do: m1 <- matrix(1:20,4) myfun(m1) myfun(m1, main="My title") I'd like to be able to add the number of rows of the matrix passed to the function to the "..." argument, eg
2009 Jun 12
1
how to trigger variable creation?
Hello R users, i'm wondering how to trigger variable creation. Whenever a variable is created i want my own function myFun(...) to be started. if (exists("x")) {rm(x)} # after removal of x # any of these calls x<-10 # should call myFun x=10 # should call myFun assign(x,10) # should call myFun etc.
2015 Oct 22
2
Changed behaviour when passing a function?
Of course (and unsurprisingly) Duncan is correct. I see that behavior in R 3.1.0, as well as the modern ones Duncan mentioned. What I said is true, as far as it goes, but the symbol being resolved is FUN, so when looking for a function it doesn't find the function version of round. Did you perhaps have a function named FUN in your global environment? If so you are being bitten by what I
2002 Jan 07
1
Mishandling missing "..." (PR#1247)
R> myfun <- function(x, ...) {x[...] <- 0; x} R> myfun(3) Error in myfun(3) : SubAssignArgs: invalid number of arguments It fails because no ... was passed. The workaround (and desired behavior) is: R> myfun <- function(x, ...) {if (missing(...)) x[] <- 0 else x[...] <- 0; x} R> myfun(3) [1] 0 Deja vu? This is the one piece of my PR#1110 (Oct 3, 2001) that I
2011 Jul 23
1
call a function with explicitly not setting an argument
Is there a way to call a function, and explicitly set an argument to 'not specified'? My situation is the following. I have a function which passes on most of its arguments to another function. The second function, myfun2, serializes all arguments and is out of my control. myfun <- function(...){ return(myfun2(...)); } now, the value for arguments of myfun are stored in variables.