"David A. van Leeuwen" <myfirstname at elseware.nl> writes:
Hi,
i am working with large data frames with many dependend variables. I
want to write some functions that will allow me to quickly select
variables from the frame and plot them in various colors depending on
factor columns, possibly selecting rows according to factor
conditions. In order to do this in a nice function, i need to
understand how to work with a column name in the body of a
function. To simplify my problem, how do i write a function with a
body like
scatter.plot <- function (data, x, y) {
plot(data$x, data$y)
}
Use
plot(data[[x]], data[[y]])
instead