2
votes

Added screenshot of errorI have a dataset which has a huge number of rows. I want to plot the boxplot of a single feature, but the simple boxplot() command in R gives me an error.

I am working on a dataset with more than 200,000 rows. The head looks like this:

year month day n_impacted 2013 Jan Tue 4 2013 Jan Mon 4 2013 Jan Sat 5 2013 Jan Wed 4 2013 Jan Fri 4 2013 Jan Sat 5

boxplot(na_omit_noguns$n_impacted)

Error in plot.window(xlim = xlim, ylim = ylim, log = log, yaxs = pars$yaxs) : need finite 'ylim' values

I should be able to plot the box plot with the outliers showing up.

1
Your example is not giving any error. Please post an example that shows the errorakrun
Hi @akrun thanks for having a look. I have added a screenshot of the error that I see.Kaustubh Mulay
If you have Inf or -Inf, tryi1 <- is.finite(na_omit_noguns$n_impacted); boxplot(na_omit_noguns$n_impacted[i1])akrun

1 Answers

1
votes

The issue occurred due to Inf or -Inf values. It can be corrected by removing those elements by subsetting only the finite values (with is.finite)

i1 <- is.finite(na_omit_noguns$n_impacted)
boxplot(na_omit_noguns$n_impacted[i1])