Skip to content

reference text variables as column name to plot [SOLVED]

1 message · Graves, Gregory

#
The following works nicely.  Thank you.

plot(z, sf[[s]], type="l")  #where the dataframe name in my case is "sf"

Sorry - I meant to say there were 24 rows in each column, so z=1:24

Gregory A. Graves, Lead Scientist
Everglades REstoration COoordination and VERification (RECOVER) 
Restoration Sciences Department
South Florida Water Management District
Phones:? DESK: 561 / 682 - 2429 
??????????      ?? CELL:? 561 / 719 - 8157


-----Original Message-----
From: David Winsemius [mailto:dwinsemius at comcast.net] 
Sent: Tuesday, November 30, 2010 11:50 AM
To: Graves, Gregory
Cc: r-help at r-project.org
Subject: Re: [R] reference text variables as column name to plot
On Nov 30, 2010, at 11:40 AM, Graves, Gregory wrote:

            
Named.... what?
Why did you put twice as many elements in z as there are in a column?
Try this ... assuming that there really are 12 item length columns in  
a dataframe named, dfm.

plot(1:12, dfm[[s]], type="l")

dataframes are lists that can be accessed by the names of columns  
which are interpreted. Don't assume that you can get such  
interpretation with the $ operator.
Huh? "&" is a logical operator.
David Winsemius, MD
West Hartford, CT