Hi
I am trying to output a plot. I keep on obtaining the above error. I cannot seem to shut down the null device. dev.list() shows NULL. I have reproduced the relevant code below along with the session info.
This is an error I have had time and time again in Rstudio.
Thanks
df <- read.csv("df_Juan.csv")
df %>%
arrange(age_days) %>%
mutate(cum_verb_types = cummax(as.numeric(factor(spa_eng, levels = unique(spa_eng))))) %>%
group_by(age_days) %>%
summarise(cum_verb_types = max(cum_verb_types)) -> juan.cvt
g <- ggplot(data = juan.cvt, aes(x = age_days, y = cum_verb_types))
g <- g + geom_smooth(se = FALSE)
g
png("Juan cum verb types 750")
g <- ggplot(data = juan.cvt %>% filter(age_days <= 750), aes(x = age_days, y = cum_verb_types))
g <- g + geom_point(colour = "dark grey")
g <- g + stat_smooth(method="lm", se=TRUE, fill=NA, formula=y ~ poly(x, 3, raw=TRUE),colour="red")
g <- g + theme_bw()
g
dev.off()
R version 3.5.0 (2018-04-23)
Platform: x86_64-apple-darwin15.6.0 (64-bit)
Running under: macOS 10.14.2
Matrix products: default
BLAS: /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libBLAS.dylib
LAPACK: /Library/Frameworks/R.framework/Versions/3.5/Resources/lib/libRlapack.dylib
locale:
[1] en_GB.UTF-8/en_GB.UTF-8/en_GB.UTF-8/C/en_GB.UTF-8/en_GB.UTF-8
attached base packages:
[1] stats graphics grDevices utils datasets methods
[7] base
other attached packages:
[1] bindrcpp_0.2.2 forcats_0.3.0 stringr_1.3.1
[4] dplyr_0.7.5 purrr_0.2.4 readr_1.1.1
[7] tidyr_0.8.1 tibble_1.4.2 ggplot2_3.0.0
[10] tidyverse_1.2.1
loaded via a namespace (and not attached):
[1] Rcpp_0.12.17 cellranger_1.1.0 pillar_1.2.2
[4] compiler_3.5.0 plyr_1.8.4 bindr_0.1.1
[7] tools_3.5.0 jsonlite_1.5 lubridate_1.7.4
[10] nlme_3.1-137 gtable_0.2.0 lattice_0.20-35
[13] pkgconfig_2.0.1 rlang_0.2.0 psych_1.8.4
[16] cli_1.0.0 rstudioapi_0.7 yaml_2.1.19
[19] parallel_3.5.0 haven_1.1.1 knitr_1.20
[22] withr_2.1.2 xml2_1.2.0 httr_1.3.1
[25] hms_0.4.2 grid_3.5.0 tidyselect_0.2.4
[28] glue_1.2.0 R6_2.2.2 readxl_1.1.0
[31] pacman_0.4.6 foreign_0.8-70 reshape2_1.4.3
[34] modelr_0.1.2 magrittr_1.5 scales_0.5.0
[37] rvest_0.3.2 assertthat_0.2.0 mnormt_1.5-5
[40] colorspace_1.3-2 labeling_0.3 stringi_1.2.2
[43] lazyeval_0.2.1 munsell_0.4.3 broom_0.4.4
[46] crayon_1.3.4