Hello R-helpers,
I have run the following line of code:
x<-dat$col
and now I would like to assign names(x) to be "dat$col" (e.g., a character
string equal to the column name that I assigned to x).
What I am trying to do is to assign columns in my dataframe to new objects
called x and y. Then I will use x and y within a new function to make plots
with informative axis labels (e.g., "dat$col" instead of "x". So, for
example, I would like to plot (y~x,xlab=names(x)) and have "dat$col"
printed in the x-axis label. I can do this all manually, by typing
names(x)<- "dat$col)
but I'd like to do it with non-specific code within my function so I don't
have to type the variable names manually each time.
Many thanks,
Mark Na
[[alternative HTML version deleted]]
______________________________________________
[email protected] 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.