search for: codetempl

Displaying 1 result from an estimated 1 matches for "codetempl".

Did you mean: coderepl
2011 Sep 13
2
How to use a variable after $ ($x) for subscripting a list, How to source from a character object (source(x))
...is meant to be the input. Unfortunately it turned out, that the "input"-variable after the $ is not substituted as expected. Subscripting the list with a variable after the $ seems not possible. The only workaround I found for that is a function like loopExtract <- function(input) { codetemplate <- as.character("result <- foreach(i=1:length(levels)) %do% {listResult[[i]]$input)}") require(stringr) write(str_replace_all(codetemplate, "input", input), file="tmp.r") source("tmp.r") return(result) } in other words I stored a template of the des...