[R] Problems with boxplot in ggplot2:qplot

baptiste auguie baptiste.auguie at googlemail.com
Sun Feb 14 20:08:45 CET 2010


Hi,

it's hard to tell what's wrong without a reproducible example, but I
noted two things:

- AFAIK there is no plot method for ggplot2. You probably meant print(p) instead

- if you map x to factor(month), I think it will be incompatible with
your xlim values range(month).

HTH,

baptiste

On 14 February 2010 19:55, Dimitri Shvorob <dimitri.shvorob at gmail.com> wrote:
>
> Dataframe closed contains balances of closed accounts: each row has month of
> closure (Date-type column month) and latest balance. I would like to plot
> by-month distributions of balances. A qplot call below produces several
> warnings and no output.
>
> Can anyone help?
>
> Thank you.
>
> PS. A really basic task, very similar to the examples on p. 71 of the
> ggplot2 book, apart from a Date grouping column; I am quite surprised to
> have problems with it. lattice package to the rescue?
>
>
>> qplot(factor(month), balance, data = closed, geom = "boxplot", xlim =
>> range(closed$month))
> There were 13 warnings (use warnings() to see them)
>
>> warnings()
> Warning messages:
> 1: Removed 1 rows containing missing values (stat_boxplot).
> 2: Removed 7 rows containing missing values (geom_point).
> 3: Removed 5 rows containing missing values (geom_point).
> 4: Removed 8 rows containing missing values (geom_point).
> 5: Removed 3 rows containing missing values (geom_point).
> 6: Removed 5 rows containing missing values (geom_point).
> 7: Removed 2 rows containing missing values (geom_point).
> 8: Removed 12 rows containing missing values (geom_point).
> 9: Removed 2 rows containing missing values (geom_point).
> 10: Removed 1 rows containing missing values (geom_point).
> 11: Removed 2 rows containing missing values (geom_point).
> 12: Removed 3 rows containing missing values (geom_point).
> 13: Removed 4 rows containing missing values (geom_point).
>
>> p = qplot(factor(month), balance, data = closed, geom = "boxplot", xlim =
>> range(closed$month))
>> plot(p)
> Error in plot.window(...) : need finite 'xlim' values
> --
> View this message in context: http://n4.nabble.com/Problems-with-boxplot-in-ggplot2-qplot-tp1555338p1555338.html
> Sent from the R help mailing list archive at Nabble.com.
>
> ______________________________________________
> 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.
>



More information about the R-help mailing list