[R] Problems producing a simple plot
Steve Murray
smurray444 at hotmail.com
Sat May 2 17:39:51 CEST 2009
Dear R Users,
I have a data frame of the nature:
> head(aggregate_1986)
Latitude Mean Annual Simulated Runoff per 1° Latitudinal Band
1 -55 574.09287
2 -54 247.23078
3 -53 103.40756
4 -52 86.99991
5 -51 45.21980
6 -50 55.92928
Mean Annual Observed Runoff per 1° Latitudinal Band
1 491.9525
2 319.6592
3 237.8222
4 179.5391
5 105.2968
6 136.6124
I am hoping to plot columns 2 and 3 against Latitude. I understand that you have to do this by plotting one column at a time, so I have been starting by attempting the following, but receiving errors:
> plot(aggregate_1986[1] ~ aggregate_1986[2], type="l")
Error in model.frame.default(formula = aggregate_1986[1] ~ aggregate_1986[2], :
invalid type (list) for variable 'aggregate_1986[1]'
Or...
> plot(aggregate_1986[1],aggregate_1986[2], type="l")
Error in stripchart.default(x1, ...) : invalid plotting method
I'm obviously doing something fundamentally wrong (!). I'd be grateful for any suggestions as to how I should go about this.
Many thanks,
Steve
More information about the R-help
mailing list