typo

run_plots <- functon()


On Thu, Aug 15, 2013 at 1:10 PM, Gerard Smits <g_smits@verizon.net> wrote:

> Hi All,
>
> I have a number of plots to run and was hoping to use a function instead
> of bock copying my code and retyping my parameters.
>
> I am using R 3.0.0 on a mac.
>
> My code is as follows:
>
> library (car)
> cres<-read.csv("//users//smits//r_work//cres.csv", header = TRUE)
> attach(cres);
>
> run_plots <- functon()
> {
>   scatterplot(y~x|z,
>     jitter=list(x=1, y=1),
>     grid=F,
>     smooth=F,
>     las=1,
>     pch=c(1,2),
>     col=c('red','blue'),
>     main="Baseline Clinical CRP by RAMRIS Synovitis at Day 113",
>     xlab="Baseline CRP",
>     ylab="Day 113 Synovitis",
>     legend.plot=F)
>   legend("bottomright",
>      box.lty=0, # line type to surround the legend box (0 for none)
>      legend=c("Active+MTX","Placebo+MTX"),
>      col=c('red','blue'),
>      pch=c(1,2),
>      pt.cex=c(1,1,1,1))
> }
>
>
> then I was hoping to execute the function by passing 3 parameters:
>  run_plots(b_crp, t_synos113, treatment)
>
> This approach follows the way I usually do it with a SAS macro, were I can
> repeat the innovation over and over using different variables, etc.
>
> Right off the  bat, you can see that I have a problem finding the function
> "function."  Then it does not recognize the first parameter it comes across.
>
> Any help appreciated.
>
> Thanks,
>
> Gerard
>
>
> >
> > cres<-read.csv("//users//smits//r_work//cres.csv", header = TRUE)
> > attach(cres);
> >
> > run_plots <- functon()
> Error: could not find function "functon"
> > {
> +   scatterplot(y~x|z,
> +     jitter=list(x=1, y=1),
> +     grid=F,
> +     smooth=F,
> +     las=1,
> +     pch=c(1,2),
> +     col=c('red','blue'),
> +     main="Baseline Clinical CRP by RAMRIS Synovitis at Day 113",
> +     xlab="Baseline CRP",
> +     ylab="Day 113 Synovitis",
> +     legend.plot=F)
> +   legend("bottomright",
> +      box.lty=0, # line type to surround the legend box (0 for none)
> +      legend=c("Active+MTX","Placebo+MTX"),
> +      col=c('red','blue'),
> +      pch=c(1,2),
> +      pt.cex=c(1,1,1,1))
> + }
> Error in eval(expr, envir, enclos) : object 'y' not found
> >
>
> ______________________________________________
> 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.
>

	[[alternative HTML version deleted]]

