[R] Object xxx not found

Sarah Goslee sarah.goslee at gmail.com
Wed Dec 7 20:37:17 CET 2011


You should probably read some of the intro to R
documents, as this is a critical component of using
R.

On Wed, Dec 7, 2011 at 7:06 AM, John Visagie <John.Visagie at up.ac.za> wrote:
> Dear All,
>
> I am having a very basic error, but somehow do not know how to resolve it.  I've read a dataset in .csv into R with two columns - sector, export.  When trying to plot the data it says "sector not found"  This is the formula.
>
>  SouthAfrica<-read.csv(c,header=T)

Your data frame is named SouthAfrica and it has
two columns, sector and export.

They can be referred to as
SouthAfrica$sector
and
SouthAfrica$export

>> hist(sector$exports,xlab="exports (MtCO2)",main="CO2 Exports")

You've just told R that you want to create a histogram of the column
exports from the data frame named sector, which doesn't exist.

hist(SouthAfrica$exports) seems more likely to succeed.

>
> Error in hist(sector$exports, xlab = "exports (MtCO2)", main = "CO2 Exports") :
>  object 'sector' not found
>
> Could somebody please assist?
>
> Kind regards,
>
> John
>

-- 
Sarah Goslee
http://www.functionaldiversity.org



More information about the R-help mailing list