Skip to content

Histogram of a dataframe subset failing

3 messages · DimmestLemming, Dieter Menne

#
Like most help forum users, I'm very new to R. I've been having this problem:

I started with a dataframe called fullData. With the subset command, I split
it into two separate dataframes, soloData and teamData.

The hist() function works when I use...

hist( subset(fullData, fullData$playlist_id==4 )$deaths)

...the exact call to subset() that I used to create each dataframe. However,
when I input, 

hist(soloData$deaths)

I get the error, " invalid number of 'breaks' ". I tried manually setting
the breaks to 20:

hist(soloData$deaths, breaks=20)

The error I got was complete gibberish to me. Here it is in full:

Error in hist.default(soloData$deaths, breaks = 40) : 
  hist.default: pretty() error, breaks=
In addition: Warning messages:
1: In min(x) : no non-missing arguments to min; returning Inf
2: In max(x) : no non-missing arguments to max; returning -Inf

Can anyone explain what's going on? Or more directly, how can I take the
histogram of a dataframe subset?

--
View this message in context: http://r.789695.n4.nabble.com/Histogram-of-a-dataframe-subset-failing-tp3689884p3689884.html
Sent from the R help mailing list archive at Nabble.com.
#
DimmestLemming wrote:
Try

str(soloData$deaths)

or 

head(soloData$deaths)

or 

summary(soloData$Death)

There may be something wrong with you data.

Dieter

--
View this message in context: http://r.789695.n4.nabble.com/Histogram-of-a-dataframe-subset-failing-tp3689884p3689993.html
Sent from the R help mailing list archive at Nabble.com.
#
Thanks! It was late, so this didn't occur to me, but I tried summary() and
all values were NA. The subset had resulted in a dataframe with 0 rows
somehow, but now that's fixed.

--
View this message in context: http://r.789695.n4.nabble.com/Histogram-of-a-dataframe-subset-failing-tp3689884p3690504.html
Sent from the R help mailing list archive at Nabble.com.