Column 7 of "oded" is "Breed". If I enter> summary(Breed)I get the counts of the numbers in each breed. However, if I enter I have tried> hist($Breed)Error: unexpected '$' in "hist($"> hist(Breed)Error in hist(Breed) : object 'Breed' not found> hist("Breed")Error in hist.default("Breed") : 'x' must be numeric FYI> colnames(oded)[1] "Subject.Name" "Date" "Species" "Age" "Sex" [6] "Spayed....Neutered" "Breed" "Breed.Code" How do I get a histogram of the counts in column 7? Thanks Richard [[alternative HTML version deleted]]
Try hist(oded$Breed) (I suspect that summary(Breed) does not work in your current session either - perhaps you had a dataset named just Breed or had attached the data.frame oded in the session where summary(Breed) works.) Bill Dunlap TIBCO Software wdunlap tibco.com On Fri, Sep 26, 2014 at 10:57 AM, Richard Lerner <richardl at uchicago.edu> wrote:> Column 7 of "oded" is "Breed". If I enter >> summary(Breed) > I get the counts of the numbers in each breed. > However, if I enter > > > I have tried > >> hist($Breed) > Error: unexpected '$' in "hist($" > >> hist(Breed) > Error in hist(Breed) : object 'Breed' not found > >> hist("Breed") > Error in hist.default("Breed") : 'x' must be numeric > > FYI > >> colnames(oded) > [1] "Subject.Name" "Date" "Species" > "Age" "Sex" > [6] "Spayed....Neutered" "Breed" "Breed.Code" > > How do I get a histogram of the counts in column 7? > > > Thanks > Richard > > [[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 27/09/14 05:57, Richard Lerner wrote:> Column 7 of "oded" is "Breed". If I enter >> summary(Breed) > I get the counts of the numbers in each breed. > However, if I enter > > > I have tried > >> hist($Breed) > Error: unexpected '$' in "hist($" > >> hist(Breed) > Error in hist(Breed) : object 'Breed' not found > >> hist("Breed") > Error in hist.default("Breed") : 'x' must be numeric > > FYI > >> colnames(oded) > [1] "Subject.Name" "Date" "Species" > "Age" "Sex" > [6] "Spayed....Neutered" "Breed" "Breed.Code" > > How do I get a histogram of the counts in column 7?Are you for real, or is this some kind of joke? Assuming it's not a joke: (1) Look at ?"$". (2) WTF do you expect hist($Breed) to do? Where is "Breed" going to be found, for pity's sake? You appear to have no understanding of how R (or any programming language) works. Read the Introduction to R manual and *get* some understanding if you are going to use R. (3) The correct usage obviously (and I mean ***really***; it *IS* obvious) is hist(oded$Breed) --- which tells hist() where to find "Breed". (4) You could also use with(oded,hist(Breed)) which is a useful syntax in some circumstances. cheers, Rolf Turner -- Rolf Turner Technical Editor ANZJS