Re: [R] function with xyplot

From: John Kane <jrkrideau_at_yahoo.ca>
Date: Thu, 14 Jun 2007 07:16:25 -0400 (EDT)


You need to reference the data.frame or append it.

myplot(DF$X) should work
or
append(DF)
myplot(X)
--- Diego Gruber <diego.gruber_at_gmail.com> wrote:

> Hi,
>
> I'm a new user trying to switch from SAS, so sorry
> for the beginner's
> question: Suppose I have a dataframe DF that
> contains variables X,Y,Z. I am
> trying to write a function like this:
>
> myplot <- function(varname){xyplot(varname ~ Y,
> group = Z, data = DF)}.
>
> The problem is then how to enter X into my function.
> If I write myplot("X")
> I get an error because the argument is a string and
> xyplot can make nothing
> out of it. If I write myplot(X) I also get an error
> that tells me the object
> X does not exist.
>
> Thanks for your help,
>
> Diego
>
> [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help_at_stat.math.ethz.ch 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.
>



R-help_at_stat.math.ethz.ch 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. Received on Thu 14 Jun 2007 - 11:21:50 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Thu 14 Jun 2007 - 11:31:54 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.