Hi,
I'm trying to evaluate a character vector within pnorm. I have a vector
with values and names
x = c(2,3)
names(x) = c("mean", "sd")
so that i tried the following
temp = paste(names(x), x, sep = "=")
#gives
#> temp
#[1] "mean=2" "sd=3"
#Problem is that both values 2 and 3 are taken as values for the mean
argument in pnorm
pnorm(0, eval(parse(text = temp)) )
#but not as
pnorm(0, mean = 2, sd = 3 )
#How can i get
pnorm(0, eval(parse(text = temp)) )
#to do
pnorm(0, mean = 2, sd = 3 )
Thank you for your time
Thomas Roth
______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.