Skip to content
Back to formatted view

Raw Message

Message-ID: <20080917200618.GA6907@localhost>
Date: 2008-09-17T20:06:18Z
From: Philipp Pagel
Subject: Graphical Display of Values' Distribution
In-Reply-To: <BAY135-W31CEC8865608B4F5219EC7884C0@phx.gbl>

> 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