search for: myenv

Displaying 18 results from an estimated 18 matches for "myenv".

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 are like: Error in load(dataFile, myEnv) : unused argument(s) ( ...) Error in library(DBI) : .First.lib failed for 'DBI...
2020 May 12
4
S3 method dispatch for methods in local environments
...) { 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] "1.00000" "2.00000" "3.00000" "4.00000" rm(print.myclass) myenv <- new.env() myenv$print.myclass <- local(function(x, ...) print(formatC(x$y, format="f", digits=5)), myenv) attach(myenv) myfun(1:4) # still prints: [1] "1.00000" "2.00000" "3.00000" "4.00000" But since R 4.0.0, this no longer words and the...
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", list(symbols.global)) #prints a.global -- so...
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 = new("myenv")) : 'enclos' must be an environment I wonder if this is a "planed" behavior. The use of .xData slot obviously works: > n...
2008 Jan 28
1
package.skeleton from within function: objects not found
...create a package skeleton for a new source package from within a function. Objects that are created in this function are to be included in my package, but for some reason, I get an error message saying that these objects cannot be found. Here is the code: ###### myfun <- function(pkgName,x){ myenv <- new.env() apply(x, 1, function(row){ assign(row[1], row[2], envir=myenv) }) f <- function(x,y) x+y e <- rnorm(1000) # browser() package.skeleton(name = pkgName, list=c("f","e", "myenv")) return(myenv) } x <- data.frame(keys = LETTERS[1:5], v...
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 attr(methods(class="myclass"), "info") getS3method("print", "myclass") both still find your function in myenv although the generic's...
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 min...
2016 Apr 22
0
non-numeric argument to binary operator problem in stock analysis
...es to get the returns of my simulated portfolio but, I can not get returns as the non-numeric argument to binary operator problem in stoc thank you guys first. library(quantmod)library(quadprog)library(stockPortfolio)library(fPortfolio)library(tseries)source("efficientFrontierFunction.r") myenv <- new.env()##Calculate the mean and sd of the monthly returns of each stocksPotf <- c('IBM', 'KO', 'C', 'TSLA', 'F')getSymbols(Potf, from="2011-01-01", env=myenv)ts<-do.call(merge,eapply(myenv, Ad)) #we allocate equal weights to every stoc...
2005 May 21
2
Possible (ab)use of lexical scoping in R ?
Dear list, I wish to define a set of functions *auxilliary* to another set of "main" ones, and I wonder if there is some "clever" way do do this using lexical scoping. Looking for that in the list's archives did not get me easily understood answers. Perusing MASS (1st, 2nd, 3rd and 4th editions!) and "Programming S" wasn't of much help either... R easily
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'
2008 Apr 18
3
Function redefinition - not urgent, but I am curious
This is just my curiousity working. Suppose I write: f1 <- function(x) x + 1 f2 <- function(x) 2 * f1(x) f2(10) # 22 f1 <- function(x) x - 1 f2(10) # 18 This is quite obvious. But is there any way to define f2 in such a way that we "freeze" the definition of f1? f1 <- function(x) x + 1 f2 <- function(x) # put something here 2 * f1(x) # probably put something else here
2011 Jun 16
7
Problem with usage of arrays
...;'t use array in puppet. Here is my codesnipplet: $callapidata = [ ''wert1'',''wert2''] notice $callapidata[1] A puppetrun results in: Could not retrieve catalog from remote server: Error 400 on SERVER: can''t convert String into Integer at /etc/puppet/myenv/modules/ uc4client/manifests/init.pp:41 on node testnode Thanks for your help. Greetings Roband -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from...
2007 Jan 10
2
problems with optim, "for"-loops and machine precision
...1","d_21","I_21","M_21","NLL_21", "NLL23_min_21","conv23","conv21") for (s in 1:500) { assign("data",read.table(paste("populations/TE23simset_",s,".txt",sep="")),e nv=MyEnv) #reading a data set M23=optim(rep(0.1,6),NLL23,method="L-BFGS-B",lower=0, upper=c(Inf,Inf,Inf,Inf,1,1),control=c(maxit=150)) if (M23$convergence==0) { M21=optim(rep(0.1,7),NLL21,method="L-BFGS-B",lower=0, upper=c(Inf,Inf,Inf,Inf,Inf,1,1...
2007 Feb 08
0
strategies for incorporating a data= argument
...evaluated in an environment containing the elements of data (or attach(data) before evaluating function; or with(data,...)) advantages: works well for a formula interface is there a better way to add objects from a list to an environment than mapply(function(name,obj) { assign(name,obj,envir=myenv) }, names(mylist),mylist) ? e.g. fn <- function(mu,sd) { -sum(dnorm(x,mu,sd)) } mle(minuslogl=fn,...,data=list(x=x)) For anyone who has read this far: right now I am calling my extended function mle(), but that seems to be asking for trouble [i.e. confused questions from...
2004 Jul 01
2
RMySQL
Hi!! I want some help to install the RMySQL package. I've tried to configure some things but i'm still getting erros. Anybody could help me?? Thank's Talita Perciano Costa Leite Graduanda em Ci??ncia da Computa????o Universidade Federal de Alagoas - UFAL Departamento de Tecnologia da Informa????o - TCI Constru????o de Conhecimento por Agrupamento de Dados - CoCADa
2013 Jul 26
1
How to best implement package options?
Dear developeRs, I have a package, pls, that implements package options. The users are supposed to use a function pls.options() to manipulate them. If a user changes the options, they are stored in .GlobalEnv. I was recently informed that this is against current CRAN submission policies, so I need to change that. I have looked at several different packages that implement package options, and
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
2002 Jul 23
2
Irix UseLogin wtmp/utmp bug
...lem. Here is what I have found, if anyone has any info that would be great else I will have to live with this: The login program is execl'd in the sesssion.c file using the execl() call: ---------- static void launch_login(struct passwd *pw, const char *hostname) { char *env_init[] = {"MYENV=null", NULL}; /* Launch login(1). */ fprintf(stderr, "X11 forwarding not supported with IRIX login.\n"); fprintf(stderr, "Must enter password again to get AFS token,\n"); /* execl(LOGIN_PROGRAM, "login", "-h", hostname, *...