On Feb 8, 2011, at 2:35 PM, Mauro Ferreira wrote:

Dear members,

I would like a help for extracting the values from a step function
(stepfun).

From help(stepfun) we have the following example:

Y0<-c(1.,2.,4.,3.)
y0<-c(1.,2.,3.,4.)
sfun<-stepfun(1:3,y0,f=0)
plot(sfun)

Now, suppose instead I was given the object (*sfun*, say) from which I
wanted to extract the values generated by the function *stepfun*. More
precisely, I want to know how to get the X and Y (generated by the function
*sfun*) that are used in the graph (plot(sfun)).

It appears that you have not yet consulted the help page for stepfun where this is documented:

> ls(envir = environment(sfun))
[1] "f"      "method" "n"      "x"      "y"      "yleft"  "yright"
>
>  environment(sfun)$x
[1] 1 2 3
>  environment(sfun)$y
[1] 2 3 4
>  environment(sfun)$yleft
[1] 1



Thanks in advance for helping me.

Ferreti

        [[alternative HTML version deleted]]

______________________________________________
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.

David Winsemius, MD
West Hartford, CT

______________________________________________
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.

Reply via email to