[R] Please help with ggplot error

Bill Poling B|||@Po||ng @end|ng |rom ze||@@com
Wed Jun 12 20:10:27 CEST 2019


Well spoke too soon, maybe not for me Rui, weird?

g1 <- ednet %>%
+   ggplot(aes(Date2,NetEditRev)) +
+   geom_line(alpha=0.5, color = "#2c3e50") +
+   geom_smooth(method = "loess", span= 0.5) +#Fix Loess to loess
+   theme_tq()
Error in UseMethod("margin") :
  no applicable method for 'margin' applied to an object of class "NULL"

WHP


From: Rui Barradas <ruipbarradas using sapo.pt>
Sent: Wednesday, June 12, 2019 2:03 PM
To: Bill Poling <Bill.Poling using zelis.com>; r-help (r-help using r-project.org) <r-help using r-project.org>
Subject: Re: [R] Please help with ggplot error

Hello,

Works with me, as soon as I corrected "Loess" to "loess".

Hope this helps,

Rui Barradas

Às 18:56 de 12/06/19, Bill Poling escreveu:
>
> #RStudio Version 1.2.1335
> sessionInfo()
> #R version 3.6.0 Patched (2019-05-19 r76539)
> #Platform: x86_64-w64-mingw32/x64 (64-bit)
> #Running under: Windows 10 x64 (build 17134)
>
> Hello
>
> I am getting an error for which I have googled to remedy but have not found a resource for it.
>
> I found this but it seems to pertain to ggmap?
> https://stackoverflow.com/questions/52371655/ggmap-errors-when-using-aesthetics-beyond-x-y
>
> #Error in UseMethod("margin") :
> #no applicable method for 'margin' applied to an object of class "NULL"
>
> I hope someone recognizes this error and can help me solve it .
>
> Thank you.
>
> str(ednet)
>
> # Classes 'data.table' and 'data.frame':892 obs. of 2 variables:
> # $ Date2 : Date, format: "2017-01-01" "2017-01-02" "2017-01-03" "2017-01-04" ...
> # $ NetEditRev: num -923 19222 -8397 37697 46075 ...
> # - attr(*, ".internal.selfref")=<externalptr>
>
> summary(ednet)
> Date2 NetEditRev
> Min. :2017-01-01 Min. :-176182.7500
> 1st Qu.:2017-08-11 1st Qu.: 2553.5700
> Median :2018-03-22 Median : 49212.5800
> Mean :2018-03-22 Mean : 45265.6394
> 3rd Qu.:2018-10-31 3rd Qu.: 75108.0175
> Max. :2019-06-11 Max. : 164891.2500
>
> head(ednet,n=35)
> Date2 NetEditRev
> 1: 2017-01-01 -923.40
> 2: 2017-01-02 19222.09
> 3: 2017-01-03 -8396.82
> 4: 2017-01-04 37696.58
> 5: 2017-01-05 46075.34
> 6: 2017-01-06 38329.35
> 7: 2017-01-07 3110.51
> 8: 2017-01-08 21.39
> 9: 2017-01-09 63569.67
> 10: 2017-01-10 50777.00
> 11: 2017-01-11 55548.60
> 12: 2017-01-12 70217.73
> 13: 2017-01-13 62536.15
> 14: 2017-01-14 2696.83
> 15: 2017-01-15 2230.00
> 16: 2017-01-16 56310.90
> 17: 2017-01-17 58521.93
> 18: 2017-01-18 50057.73
> 19: 2017-01-19 57366.70
> 20: 2017-01-20 61390.94
> 21: 2017-01-21 1839.09
> 22: 2017-01-22 807.57
> 23: 2017-01-23 72209.44
> 24: 2017-01-24 70799.21
> 25: 2017-01-25 70240.88
> 26: 2017-01-26 51462.66
> 27: 2017-01-27 46852.37
> 28: 2017-01-28 2396.67
> 29: 2017-01-29 2051.62
> 30: 2017-01-30 72561.32
> 31: 2017-01-31 69630.69
> 32: 2017-02-01 -17304.22
> 33: 2017-02-02 11773.84
> 34: 2017-02-03 20703.69
> 35: 2017-02-04 2762.87
>
>
> as_tibble(ednet)
>
> # A tibble: 892 x 2
> # Date2 NetEditRev
> # <date> <dbl>
> # 1 2017-01-01 -923.
> # 2 2017-01-02 19222.
> # 3 2017-01-03 -8397.
> # 4 2017-01-04 37697.
> # 5 2017-01-05 46075.
> # 6 2017-01-06 38329.
> # 7 2017-01-07 3111.
> # 8 2017-01-08 21.4
> # 9 2017-01-09 63570.
> # 10 2017-01-10 50777
> # ... with 882 more rows
>
> #First blush look at the raw data
> g1 <- ednet %>%
> ggplot(aes(Date2,NetEditRev)) +
> geom_line(alpha=0.5, color = "#2c3e50") +
> geom_smooth(method = "Loess", span= 0.5) +
> theme_tq()
>
> #Error in UseMethod("margin") :
> #no applicable method for 'margin' applied to an object of class "NULL"
>
> WHP
>
>
>
> Confidentiality Notice This message is sent from Zelis. ...{{dropped:13}}
>
> ______________________________________________
> mailto:R-help using r-project.org mailing list -- To UNSUBSCRIBE and more, see
> 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.
>

Confidentiality Notice This message is sent from Zelis. This transmission may contain information which is privileged and confidential and is intended for the personal and confidential use of the named recipient only. Such information may be protected by applicable State and Federal laws from this disclosure or unauthorized use. If the reader of this message is not the intended recipient, or the employee or agent responsible for delivering the message to the intended recipient, you are hereby notified that any disclosure, review, discussion, copying, or taking any action in reliance on the contents of this transmission is strictly prohibited. If you have received this transmission in error, please contact the sender immediately. Zelis, 2018.


More information about the R-help mailing list