[R] Please help with ggplot error

Bill Poling B|||@Po||ng @end|ng |rom ze||@@com
Wed Jun 12 19:56:18 CEST 2019


#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}}



More information about the R-help mailing list