'R software, making boxplot, need finite 'ylim' value
> B<-subset(olympic,sport=="basketball")
> BM<-subset(B,sex=="M"
+ )
> boxplot(BM$height)
Error in plot.window(xlim = xlim, ylim = ylim, log = log, yaxs = pars$yaxs):
need finite 'ylim' values
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
This is what happened when I try to plot the graph. I'm new to R.
Solution 1:[1]
Just add ylim=c(0,300)) to your code
Solution 2:[2]
I see nothing wrong in the command though it can be shortened to:
> BM <- subset(olympic,sport=="basketball" & sex == 'M')
> boxplot(BM$height)
The error that you are getting might be because of the fact that data.frame BM has zero rows.
I would recommend you to please check the case of values for sport (i.e. whether in the dataset, 'Basketball' is present and you are searching for 'basketball')
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Tko |
| Solution 2 | Kunal Puri |
