我使用以下代码将一些文件放在一起:
data_path <- "daymet"
files <- dir(data_path, pattern = "*.csv")
daymet <- data_frame(filename = files) %>%
mutate(file_contents = map(filename, ~ read_csv(file.path(data_path, .),
skip=7)))%>%
unnest()%>%
mutate(site = str_sub(filename, 1, 3))
首先,我在错误"'gajpcsr1_2003_2011.csvmapenv'不是从'namespace:maps:maps'"中导出的对象时遇到了一些问题。我重新安装了purrr
。错误消失了,一切都奏效了!
我去了其余的分析,清除了我的环境,然后当R到达此块时,同样的错误消息又回来了。
我还有所有其他这些软件包,因此似乎其中一个与purrr
无法正常合作。或者可能不是。即使我不加载所有软件包,我仍然会收到相同的错误消息。
会话信息:
R version 3.3.2 (2016-10-31)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows >= 8 x64 (build 9200)
locale:
[1] LC_COLLATE=English_United States.1252 LC_CTYPE=English_United States.1252
[3] LC_MONETARY=English_United States.1252 LC_NUMERIC=C
[5] LC_TIME=English_United States.1252
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] reprex_0.1.1 mapdata_2.2-6 maps_3.2.0 ggmap_2.6.1 soilDB_1.8.5 aqp_1.10
[7] stringr_1.1.0 modelr_0.1.0 lubridate_1.6.0 dplyr_0.5.0 purrr_0.2.3 readr_1.0.0
[13] tidyr_0.6.1 tibble_1.2 ggplot2_2.2.1 tidyverse_1.1.1
loaded via a namespace (and not attached):
[1] httr_1.2.1 jsonlite_1.5 splines_3.3.2 Formula_1.2-1
[5] assertthat_0.2.0 sp_1.2-5 latticeExtra_0.6-28 backports_1.0.5
[9] lattice_0.20-34 digest_0.6.12 RColorBrewer_1.1-2 checkmate_1.8.2
[13] rvest_0.3.2 colorspace_1.3-2 htmltools_0.3.5 Matrix_1.2-7.1
[17] plyr_1.8.4 psych_1.6.12 devtools_1.12.0 clipr_0.3.3
[21] XML_3.98-1.8 broom_0.4.2 raster_2.5-8 haven_1.0.0
[25] scales_0.4.1 whisker_0.3-2 jpeg_0.1-8 htmlTable_1.9
[29] withr_1.0.2 nnet_7.3-12 lazyeval_0.2.0 mnormt_1.5-5
[33] proto_1.0.0 survival_2.41-3 magrittr_1.5 readxl_0.1.1
[37] evaluate_0.10 memoise_1.0.0 nlme_3.1-131 MASS_7.3-45
[41] forcats_0.2.0 xml2_1.1.1 foreign_0.8-67 tools_3.3.2
[45] data.table_1.10.4 hms_0.3 geosphere_1.5-5 RgoogleMaps_1.4.1
[49] munsell_0.4.3 cluster_2.0.5 plotrix_3.6-4 callr_1.0.0
[53] rlang_0.1.2 grid_3.3.2 rjson_0.2.15 htmlwidgets_0.8
[57] rmarkdown_1.5 labeling_0.3 base64enc_0.1-3 gtable_0.2.0
[61] DBI_0.5-1 reshape_0.8.6 reshape2_1.4.2 R6_2.2.0
[65] gridExtra_2.2.1 knitr_1.17 rprojroot_1.2 Hmisc_4.0-3
[69] stringi_1.1.2 parallel_3.3.2 Rcpp_0.12.10 mapproj_1.2-4
[73] rpart_4.1-10 acepack_1.4.1 png_0.1-7
您可以看到掩盖或被
掩盖的所有内容 conflicts(detail = TRUE)
例如,在我当前的r会话中,您可以在下面看到我一直在回答问题,因为全球环境中的所有通用数据名称, df
, dt
和 t
掩盖了同一名称的基本功能。您可以看到数据表的first
和last
掩盖dplyr
版本,因为我在dplyr
后加载了data.table
:
> conflicts(detail = T)
$.GlobalEnv
[1] "n" "df" "dt" "gamma" "t"
$`package:stringr`
[1] "%>%"
$`package:data.table`
[1] "between" "first" "last"
$`package:dplyr`
[1] "%>%" "between" "first" "last" "n" "filter" "lag"
[8] "intersect" "setdiff" "setequal" "union"
$`package:ggplot2`
[1] "Position"
$`package:stats`
[1] "df" "dt" "filter" "lag"
$`package:methods`
[1] "body<-" "kronecker"
$`package:base`
[1] "body<-" "gamma" "intersect" "kronecker" "Position" "setdiff" "setequal"
[8] "t" "union"