search for: ifnotfound

Displaying 20 results from an estimated 21 matches for "ifnotfound".

2020 Jun 23
1
mget(missingArgument)?
Currently, when mget() is used to get the value of a function's argument with no default value and no value in the call it returns the empty name (R_MissingArg). Is that the right thing to do or should it return 'ifnotfound' or give an error? E.g., > a <- (function(x) { y <- "y from function's environment"; mget(c("x","y","z"), envir=environment(), ifnotfound=666)})() > str(a) List of 3 $ x: symbol $ y: chr "y from function's environment" $...
2012 Oct 24
0
Shouldn't the \usage section tell the truth?
Hi, The signature of mget() changed between R-2.15.1 and recent R-devel. In R-2.15.1: > args(mget) function (x, envir, mode = "any", ifnotfound = list(function(x) stop(paste0("value for '", x, "' not found"), call. = FALSE)), inherits = FALSE) NULL In R-devel: > args(mget) function (x, envir, mode = "any", ifnotfound = list(function(x) stop(gettextf("value for %s not found&q...
2015 Jan 09
2
RFC: getifexists() {was [Bug 16065] "exists" ...}
...-0800 writes: >> On Thu, Jan 8, 2015 at 11:57 AM, <luke-tierney at uiowa.edu> wrote: >>> On Thu, 8 Jan 2015, Michael Lawrence wrote: >>> >>> If we do add an argument to get(), then it should be named consistently >>>> with the ifnotfound argument of mget(). You are right... I forgot to say so earlier in the thread. The definition now is get0 <- function (x, envir = pos.to.env(-1L), mode = "any", inherits = TRUE, ifnotfound = NULL) .Internal(get0(x, envir, mode, inherits, ifnotfound)) &g...
2005 May 12
2
mget empty strings
Dear R community, I am a beginner to R and have a question concerning mget, about I could not find anything in the various documentation. I have a column in a dataframe x for which I want to get values in y: mget(x[,1], env=y, ifnotfound=NA) I receive an error mesage: Error in mget(x[, 1], env = y, ifnotfound = NA) : attempt to use zero-length variable name this is probably due to the fact that some of the values in x[,1] are empty ("") I would like to get a "NA" for these values, and the found val...
2013 Aug 14
1
local variable assignment: first copies from higher frame?
...' structure, like so: tempf <- function(x, local = TRUE) { executing_environment <- environment() closure_environment <- parent.env(executing_environment) print(executing_environment) cat(str(mget("my_list", envir = executing_environment, inherits = FALSE, ifnotfound = NA)[[1]])) print(closure_environment) cat(str(mget("my_list", envir = closure_environment, inherits = FALSE, ifnotfound = NA)[[1]])) if(local) { my_list$x <- x } else { my_list$x <<- x } print(executing_environment) cat(str(mget("m...
2007 May 01
1
Possible problem with S4 dispatch
...) [1] "AnnotationDbi" ## See what selectMethod has to say (it finds the method I'm expecting) Browse[1]> selectMethod("mget", signature(x="character", envir=class(LLe))) Method Definition: function (x, envir, mode = "any", ifnotfound = list(function(x) stop(paste("value for '", x, "' not found", sep = ""), call. = FALSE)), inherits = FALSE) { .checkNamesAreStrings(x) .checkNamesExist(x, names(envir)) as.list(envir, names = x) } <environment:...
2005 May 04
1
error with the function GOHyperG from GOstats package
I am running R 2.0.0, GOstats 1.1.1 and GO 1.7.0, and when I use the function GOHyperG, I have the following error: w1<-as.list(hgu95av2LOCUSID) w2<-unique(unlist(w1)) set.seed(123) myLL<-sample(w2,100) xx <- GOHyperG(myLL) Error in mget(x, env = GOTERM, ifnotfound = NA) : recursive default argument reference In fact first I tried this function with my locusId ' list (with affymetrix hgu133plus2), but I had the same error... Any help is appreciated Regards, Sabrina Sabrina Carpentier Service Bioinformatique Institut Curie - Bat. Trouillet Rossigno...
2011 Nov 08
1
Question
Hi My name is Rocky and I am trying to use the org.Dm.eg.db library. When I am using the org.Dm.egFLYBASE2EG[fb_ids] it is stopping at a point where it cannot find any value for a given ID such as the following: Error in .checkKeys(value, Rkeys(x), x@ifnotfound) : value for "FBgn0004461" not found Then the whole thing stops. I cannot retrieve any information on the values that has been found until this ID was reached. Can anyone help in retrieving all the IDs without stopping at a certain ID or if the value for the ID not found just generate a...
2012 Nov 02
1
Bioconductor, merging annotation with list of probeids
Hi all, Im very new to R so please forgive my poor language! I've been trying to map on my list of probeids the relative annotation but unsuccessfully. I get this error symbols <- mget(probes,mouse4302SYMBOL,ifnotfound=NA) Error in .checkKeysAreWellFormed(keys) : keys must be supplied in a character vector with no NAs Thanks for your help! Brawni -- View this message in context: http://r.789695.n4.nabble.com/Bioconductor-merging-annotation-with-list-of-probeids-tp4648251.html Sent from the R help mailing...
2015 Jan 08
2
RFC: getifexists() {was [Bug 16065] "exists" ...}
On Thu, Jan 8, 2015 at 11:57 AM, <luke-tierney at uiowa.edu> wrote: > On Thu, 8 Jan 2015, Michael Lawrence wrote: > > If we do add an argument to get(), then it should be named consistently >> with the ifnotfound argument of mget(). As mentioned, the possibility of a >> NULL value is problematic. One solution is a sentinel value that indicates >> an unbound value (like R_UnboundValue). >> > > A null default is fine -- it's a default; if it isn't right for a > particular ca...
2024 Feb 18
1
Capturing Function Arguments
..., n, params[[n]], e, e) ) # match the evaluated arguments against the names of the formals args <- as.list(match.call(f0, as.call(c('f0', list(...)))))[-1] for (n in names(args)) assign(n, args[[n]], envir = e) # evaluate everything, default argument or not mget(names(params), e, ifnotfound = list(.makemissing())) } f0 <- function(x, y = 2 * z, z, a = NULL, b) NULL a <- 1 identical( f(a, z = 1 + 100), list(x = 1, y = 202, z = 101, a = NULL, b = rlang::missing_arg()) ) # [1] TRUE -- Best regards, Ivan
2016 Sep 05
1
mget call can trigger C stack usage error
Hi all, not sure if you will call this a bug or something else but the following silly call trigger a low level error: foo <- list(x=1) class(foo) <- "new" print.new <- function(x, ...) print(mget(names(formals()))) foo > Error: C stack usage 7969412 is too close to the limit -- Alexandre Courtiol http://sites.google.com/site/alexandrecourtiol/home *"Science is
2024 Jan 18
2
Should subsetting named vector return named vector including named unmatched elements?
...[select] |> setNames(select)` solves, but it feels to me like something that could be a default behaviour. On slightly unrelated note, when I was asking if there is a better solution, the `menu[select]` seems to allocate more memory than `menu_env = list2env(menu); mget(select, envir = menu, ifnotfound = list(NULL)`. Or the sapply solution. Is this a benchmarking artifact? https://stackoverflow.com/q/77828678/4868692
2006 Jan 27
3
substituting an object not found
Is there any function in R like is.not.found(x, y) meaning if you can't find object x, then use object y?? Mikkel Grum
2012 Mar 19
1
hgu133plus2hsentrezgprobe library
Hello R community, I am processing raw Affymetrix CEL files and I am using the Michigan custom CDF library hgu133plus2hsentrezgprobe. I have been looking for documentation on the function that it contains...I am specifically interested in converting probe names to gene symbols. Does anybody know where I can find it? Thank a lot! Eleni [[alternative HTML version deleted]]
2015 Jan 09
0
RFC: getifexists() {was [Bug 16065] "exists" ...}
...8 Jan 2015 14:02:26 -0800 writes: > On Thu, Jan 8, 2015 at 11:57 AM, <luke-tierney at uiowa.edu> wrote: >> On Thu, 8 Jan 2015, Michael Lawrence wrote: >> >> If we do add an argument to get(), then it should be named consistently >>> with the ifnotfound argument of mget(). As mentioned, the possibility of a >>> NULL value is problematic. One solution is a sentinel value that indicates >>> an unbound value (like R_UnboundValue). >>> >> >> A null default is fine -- it's a default; if i...
2004 Apr 14
2
attaching data.frame/list within a function
I'm trying to find a good way of attaching a list within a function such that the attached variables (the list's members) precede the global environment (.GlobalEnv) in the search list. Here is a non-working example using attach(), which hopefully explains better what I'm trying to do: > foo <- function(x=0, input=list(a=10)) { + attach(input) + on.exit(detach(input)) +
2015 Jan 08
4
RFC: getifexists() {was [Bug 16065] "exists" ...}
If we do add an argument to get(), then it should be named consistently with the ifnotfound argument of mget(). As mentioned, the possibility of a NULL value is problematic. One solution is a sentinel value that indicates an unbound value (like R_UnboundValue). But another idea (and one pretty similar to John's) is to follow the SYMSXP design at the C level, where there is a structur...
2024 Feb 17
2
Capturing Function Arguments
I'm wrapping a function in R and I want to record all the arguments passed to it, including default values and missing values. I want to be able to snoop on function calls in sourced scripts as part of a unit testing framework. I can capture the values fine, but I'm having trouble evaluating them as if `force()` had been applied to each of them. Here is a minimal example: f0 <-
2015 Jan 08
0
RFC: getifexists() {was [Bug 16065] "exists" ...}
On Thu, 8 Jan 2015, Michael Lawrence wrote: > If we do add an argument to get(), then it should be named consistently > with the ifnotfound argument of mget(). As mentioned, the possibility of a > NULL value is problematic. One solution is a sentinel value that indicates > an unbound value (like R_UnboundValue). A null default is fine -- it's a default; if it isn't right for a particular case you can provide something el...