[R] Graphical Display of Values' Distribution
Steve Murray
smurray444 at hotmail.com
Wed Sep 17 20:52:30 CEST 2008
Dear Phil and Jorge,
Many thanks for your quick replies. I found that:> hist(urban.long[,3]) worked and displayed the data as I hoped. This reveals that the data are strongly distributed towards the value '1', and the other bars on the histogram are difficult to distinguish from each other as they are very small.
I therefore wish to examine all values of urban.long[,3] which are greater than 1. I have tried the following, but receive error messages each time:
> hist(urban.long[,3]>1)
Error in hist.default(urban.long[, 3]> 1) : 'x' must be numeric
> hist(urban.long[urban.long[,3]>1])
Error in `[.data.frame`(urban.long, urban.long[, 3]> 1) :
undefined columns selected
> hist(urban.long[urban.long[,3]>1])
Error in `[.data.frame`(urban.long, urban.long[, 3]> 1) :
undefined columns selected
> hist(as.numeric(urban.long[urban.long[,3]>1]))
Error in `[.data.frame`(urban.long, urban.long[, 3]> 1) :
undefined columns selected
> hist(as.numeric(as.character(urban.long[urban.long[,3]>1])))
Error in `[.data.frame`(urban.long, urban.long[, 3]> 1) :
undefined columns selected
Here is some information about the data:
> class(urban.long[,3])
[1] "numeric"
> str(urban.long[,3])
num [1:67609] 1 1 1 1 1 1 1 1 1 1 ...
I'm probably doing something fairly obvious wrong - if anyone could point this out to me then I'd be very thankful!
Many thanks again,
Steve
More information about the R-help
mailing list