search for: str2lang

Displaying 11 results from an estimated 11 matches for "str2lang".

2020 Jan 21
2
class(<matrix>) |--> c("matrix", "arrary") -- and S3 dispatch
...343") > msg <- tryCatch(foo.7.3.343(x), error=function(e) e$message) > clm <- sub('"$', '', sub(".* of class \"", '', msg)) > if(is.language(x) || is.function(x)) > clm > else { > cl <- str2lang(clm) > if(is.symbol(cl)) as.character(cl) else eval(cl) > } > } > > ## str2lang() needs R >= 3.6.0: > if(getRversion() < "3.6.0") ## substitute for str2lang(), good enough here: > str2lang <- function(s) parse(text = s, keep.source=FALSE)[...
2019 Nov 21
0
class(<matrix>) |--> c("matrix", "arrary") -- and S3 dispatch
...function(x) UseMethod("foo.7.3.343") msg <- tryCatch(foo.7.3.343(x), error=function(e) e$message) clm <- sub('"$', '', sub(".* of class \"", '', msg)) if(is.language(x) || is.function(x)) clm else { cl <- str2lang(clm) if(is.symbol(cl)) as.character(cl) else eval(cl) } } ## str2lang() needs R >= 3.6.0: if(getRversion() < "3.6.0") ## substitute for str2lang(), good enough here: str2lang <- function(s) parse(text = s, keep.source=FALSE)[[1]] Now you can look at such thin...
2020 Jan 28
0
class(<matrix>) |--> c("matrix", "arrary") -- and S3 dispatch
...>> msg <- tryCatch(foo.7.3.343(x), error=function(e) e$message) >> clm <- sub('"$', '', sub(".* of class \"", '', msg)) >> if(is.language(x) || is.function(x)) >> clm >> else { >> cl <- str2lang(clm) >> if(is.symbol(cl)) as.character(cl) else eval(cl) >> } >> } >> >> ## str2lang() needs R >= 3.6.0: >> if(getRversion() < "3.6.0") ## substitute for str2lang(), good enough here: >> str2lang <- function(s...
2023 Nov 09
1
c(NA, 0+1i) not the same as c(as.complex(NA), 0+1i)?
...=NA_real_, i=0) > instead of NA_complex_? > My opinions: > (1) No. The imaginary part of the result of parsing the strings "<b>i", > "<a>+<b>i", and "<a>-<b>i" can be nonzero. > Consider, e.g., Im(eval(str2lang("0+1i"))) and Im(as.complex("0+1i")). > If NA_character_ means "a string with unknown content", then we should > not assume that the string is parsed as a real number. > (2) Yes. I'd very much like to preserve the identity of c(Im(NA), Im(x))...
2019 Nov 15
5
class(<matrix>) |--> c("matrix", "arrary") [was "head.matrix ..."]
>>>>> Pages, Herve >>>>> on Thu, 14 Nov 2019 19:13:47 +0000 writes: > On 11/14/19 05:47, Hadley Wickham wrote: >> On Sun, Nov 10, 2019 at 2:37 AM Martin Maechler >> <maechler at stat.math.ethz.ch> wrote: >>> >>>>>>>> Gabriel Becker >>>>>>>> on Sat, 2 Nov 2019
2023 Nov 08
1
c(NA, 0+1i) not the same as c(as.complex(NA), 0+1i)?
...to complex(r=NA_real_, i=0) instead of NA_complex_? My opinions: (1) No. The imaginary part of the result of parsing the strings "<b>i", "<a>+<b>i", and "<a>-<b>i" can be nonzero. Consider, e.g., Im(eval(str2lang("0+1i"))) and Im(as.complex("0+1i")). If NA_character_ means "a string with unknown content", then we should not assume that the string is parsed as a real number. (2) Yes. I'd very much like to preserve the identity of c(Im(NA), Im(x))...
2020 Sep 24
1
How to use `[` without evaluating the arguments.
...rowQuery), error=function(e) FALSE)) { select <- grep('^cellLine[:digit:]*', colnames(rowData(longTable)), value=TRUE) rowQueryString <- paste0(paste0(select, ' %in% ', .variableToCodeString(rowQuery)), collapse=' | ') rowQuery <- str2lang(rowQueryString) } else { rowQuery <- substitute(rowQuery) } rowDataSubset <- rowData(longTable)[eval(rowQuery), ] } else { rowDataSubset <- rowData(longTable) } if (!missing(columnQuery)) { if (tryCatch(is.character(columnQue...
2019 Jun 14
1
Bug report: 'formula("x")' loops infinitely ('formula("y")' does not)
Dear,?? The script'formula("x")' loops infinitely. More specifically, it throws thefollowing error:? ? Error: evaluationnested too deeply: infinite recursion / options(expressions=)?? ? As a side effect,this makes an IDE like RStudio to crash. On the other hand,the script 'formula("y")'?works as expected : if ?y? does notexist in the global environment,
2019 Apr 26
0
R 3.6.0 is released
...(). Contributed by Achim Zeileis. * The default colours for image() and filled.contour() are now based on hcl.colors(). * The palette-generating functions rainbow(), gray.colors(), etc. get a new rev argument to facilitate reversing the order of colors. * New str2lang() and str2expression() as streamlined versions of parse(text=., keep.source=FALSE) allow to abstract typical call constructions, e.g., in formula manipulations. (Somewhat experimental) * Add update_PACKAGES() for incrementally updating a package repository index, inste...
2019 Apr 26
0
R 3.6.0 is released
...(). Contributed by Achim Zeileis. * The default colours for image() and filled.contour() are now based on hcl.colors(). * The palette-generating functions rainbow(), gray.colors(), etc. get a new rev argument to facilitate reversing the order of colors. * New str2lang() and str2expression() as streamlined versions of parse(text=., keep.source=FALSE) allow to abstract typical call constructions, e.g., in formula manipulations. (Somewhat experimental) * Add update_PACKAGES() for incrementally updating a package repository index, inste...
2019 Apr 26
0
R 3.6.0 is released
...(). Contributed by Achim Zeileis. * The default colours for image() and filled.contour() are now based on hcl.colors(). * The palette-generating functions rainbow(), gray.colors(), etc. get a new rev argument to facilitate reversing the order of colors. * New str2lang() and str2expression() as streamlined versions of parse(text=., keep.source=FALSE) allow to abstract typical call constructions, e.g., in formula manipulations. (Somewhat experimental) * Add update_PACKAGES() for incrementally updating a package repository index, inste...