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)> hist(sector$exports,xlab="exports (MtCO2)",main="CO2 Exports")Error in hist(sector$exports, xlab = "exports (MtCO2)", main = "CO2 Exports") : object 'sector' not found Could somebody please assist? Kind regards, John [[alternative HTML version deleted]]
R. Michael Weylandt <michael.weylandt@gmail.com>
2011-Dec-07 19:17 UTC
[R] Object xxx not found
You never create a "sector" object inR so it can't be found. Perhaps you meant hist(SouthAfrica$exports) Michael On 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) >> hist(sector$exports,xlab="exports (MtCO2)",main="CO2 Exports") > > Error in hist(sector$exports, xlab = "exports (MtCO2)", main = "CO2 Exports") : > object 'sector' not found > > Could somebody please assist? > > Kind regards, > > John > > [[alternative HTML version deleted]] > > ______________________________________________ > R-help at 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.
On 07.12.2011 13:06, John Visagie 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) >> hist(sector$exports,xlab="exports (MtCO2)",main="CO2 Exports")Err, you either want SouthAfrica$sector or SouthAfrica$exports. Uwe Ligges> Error in hist(sector$exports, xlab = "exports (MtCO2)", main = "CO2 Exports") : > object 'sector' not found > > Could somebody please assist? > > Kind regards, > > John > > [[alternative HTML version deleted]] > > ______________________________________________ > R-help at 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.
" I'm not creating a sector' Exactly, but your code (sector$exports) tells R to "find a variable called sector and then look inside of it for something called exports". It never bothers with the second part because it can't execute the first because it can't find anything called sector (as the error message says) Also, please cc the list on all replies for archival purposes. Michael On Wed, Dec 7, 2011 at 2:19 PM, John Visagie <John.Visagie at up.ac.za> wrote:> I'm not creating a sector - it is one of my variable headings. > > ---------------- > This message and attachments are subject to a disclaimer. > Please refer to www.it.up.ac.za/documentation/governance/disclaimer/ for full details. > > >>>> "R. Michael Weylandt <michael.weylandt at gmail.com>" <michael.weylandt at gmail.com> 2011/12/07 09:17:29 PM >>> > > You never create a "sector" object inR so it can't be found. Perhaps you meant > > hist(SouthAfrica$exports) > > Michael > > On 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) >>> hist(sector$exports,xlab="exports (MtCO2)",main="CO2 Exports") >> >> Error in hist(sector$exports, xlab = "exports (MtCO2)", main = "CO2 Exports") : >> ?object 'sector' not found >> >> Could somebody please assist? >> >> Kind regards, >> >> John >> >> ? ?[[alternative HTML version deleted]] >> >> ______________________________________________ >> R-help at 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. >
Thank you, Michael. ---------------- This message and attachments are subject to a disclaimer. Please refer to www.it.up.ac.za/documentation/governance/disclaimer/ for full details.>>> "R. Michael Weylandt" <michael.weylandt at gmail.com> 2011/12/07 09:27:38 PM >>>" I'm not creating a sector' Exactly, but your code (sector$exports) tells R to "find a variable called sector and then look inside of it for something called exports". It never bothers with the second part because it can't execute the first because it can't find anything called sector (as the error message says) Also, please cc the list on all replies for archival purposes. Michael On Wed, Dec 7, 2011 at 2:19 PM, John Visagie <John.Visagie at up.ac.za> wrote:> I'm not creating a sector - it is one of my variable headings. > > ---------------- > This message and attachments are subject to a disclaimer. > Please refer to www.it.up.ac.za/documentation/governance/disclaimer/ for full details. > > >>>> "R. Michael Weylandt <michael.weylandt at gmail.com>" <michael.weylandt at gmail.com> 2011/12/07 09:17:29 PM >>> > > You never create a "sector" object inR so it can't be found. Perhaps you meant > > hist(SouthAfrica$exports) > > Michael > > On 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) >>> hist(sector$exports,xlab="exports (MtCO2)",main="CO2 Exports") >> >> Error in hist(sector$exports, xlab = "exports (MtCO2)", main = "CO2 Exports") : >> object 'sector' not found >> >> Could somebody please assist? >> >> Kind regards, >> >> John >> >> [[alternative HTML version deleted]] >> >> ______________________________________________ >> R-help at 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. >
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