> 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

Again the probelm is the indeing being wrong. What you wand can be
achieved by this:

hist( urban.long[urban.long[,3]>1, 3] )

So your second approach was almost right but again did not return
column 3 as a vector.

You may also want to have a look at the manual page for the subset()
function which sometimes (or to some people) feels easier than logical
subsetting.

cu
        Philipp

-- 
Dr. Philipp Pagel
Lehrstuhl für Genomorientierte Bioinformatik
Technische Universität München
Wissenschaftszentrum Weihenstephan
85350 Freising, Germany
http://mips.gsf.de/staff/pagel

______________________________________________
R-help@r-project.org 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.

Reply via email to