[R] overlay points on plot

Spencer Graves spencer.graves at pdf.com
Wed Feb 18 20:15:48 CET 2004


      What do you get from the following: 

      class(v)
      class(v[2])

      If class(v) is "list", then class(v[2]) will also be "list".  In 
that case try the following: 

	points(v[[2]],v[[3]])

    
      hope this helps.  spencer graves

femke wrote:

>Dear R-help list,
>
>I'm trying to overlay a number of data objects in a plot.  Following an earlier example on the list I've created an empty plot as follows
>
>  
>
>>xlim <- range(as.numeric(c("0","10000")))
>>ylim <- range(as.numeric(c("0","25")) )
>>plot(NA, xlim=xlim, ylim=ylim, xlab="distance", ylab="semivariance")
>>    
>>
>
>However when I try to plot something on it, I get the following error:
>
>  
>
>>points(v[2],v[3])
>>    
>>
>Error in as.double.default(x) : (list) object cannot be coerced to double
>
>A sample of my data looks like the following V[2]:
>
>       gamma
>1   0.040000
>2   0.582500
>3   1.574545
>4   7.126500
>.....
>
>and V[3]:
>
>        dist
>1   470.0426
>2  1045.6365
>3  1607.1936
>....
>
>
>Does anyone have any idea how to fix this?  
>
>Thanks very much,
>
>femke
>	[[alternative HTML version deleted]]
>
>______________________________________________
>R-help at stat.math.ethz.ch mailing list
>https://www.stat.math.ethz.ch/mailman/listinfo/r-help
>PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
>  
>




More information about the R-help mailing list