lp-boun...@r-
>> project.org] On Behalf Of moleps
>> Sent: Sunday, June 06, 2010 1:51 PM
>> To: r-help@r-project.org
>> Subject: [R] paste together a string object later to be utilized in a
>> function
>>
>> Dear r-listers,
>>
>> I need to pass a string
ct.org [mailto:r-help-boun...@r-
> project.org] On Behalf Of moleps
> Sent: Sunday, June 06, 2010 1:51 PM
> To: r-help@r-project.org
> Subject: [R] paste together a string object later to be utilized in a
> function
>
> Dear r-listers,
>
> I need to pass a string to a function.
It helps if you provide sample data, so we can try some things out
ourselves. Right now, I can't run your function without guessing how
your data might look like.
Yet, try something like this :
> ts <- list(a=1:5)
> names(ts$a) <- letters[1:5]
> n <- length(names(ts$a))
> tmp <- sapply(1:n,func
I'm sorry for not clearer describing my motive with this--
So this is what I'm trying to do- Take a survival object and utilize
it in ggplot.
ggkm<-function(time,event,stratum) {
m2s<-Surv(time,as.numeric(event))
fit <- survfit(m2s ~ stratum)
f$time<-fit$time
f$surv<-fit$surv
Wild guess, but it looks like you are looking at :
> ts <- list(a=1:5)
> names(ts$a) <- letters[1:5]
> v<-paste("rep(names(ts$a[",1:b,"]),ts$a[",1:b,"])",sep="")
>
> sapply(v,function(x){eval(parse(,text=x))})
$`rep(names(ts$a[1]),ts$a[1])`
[1] "a"
$`rep(names(ts$a[2]),ts$a[2])`
[1] "b" "b"
$`re
Dear r-listers,
I need to pass a string to a function. However the length of the string is
dependent on the length of a vector.
b<-length(h)
v<-paste("rep(names(ts$a[",1:b,"]),ts$a[",1:b,"])",sep="")
Is it possible somehow to pass this as an argument to a function later on ?
Regards,
//
6 matches
Mail list logo