0

我正在使用 auk 打开 ebird 数据,无法为文件创建路径。我将路径设置为文件夹。当我尝试将其更改为文件时,它说路径不正确。

我可以看到Sys.getenv()路径设置为一个文件夹。使用auk_get_ebd_path()命令我看到了同样的事情。当我尝试使用命令更改该文件夹内文件的路径时,auk_set_ebd_path()我收到一条错误消息。

library(auk)
auk_get_ebd_path()
[1] "/Users/lucypullen/Documents/bird/data"
auk_set_ebd_path("/Users/lucypullen/Documents/bird/data/ebd_CA_relApr-2019.txt", overwrite = TRUE)
[1] Error: dir.exists(paths = path) is not TRUE

其他尝试产生了一条Error in file(con, "r") : cannot open the connection消息

Warning messages: 1: In file(con, "r") :
  'raw = FALSE' but '/Users.....data/CA' is not a regular file
2: In file(con, "r") :
  cannot open file '/Users/lucypullen/Documents/bird/data/CA': it is a directory

好像他们想要路径去一个文件。我认为路径将通过system.file()命令完成。我尝试了很多变化:

input_file <- system.file("/Users/lucypullen/Documents/bird/data/CA/ebd_CA_relApr-2019.txt", package = "auk")

或者

input_file <- system.file("ebd_CA_relApr-2019.txt", package = "auk")

或者

input_file <- system.file("~/ebd_CA_relApr-2019.txt", package = "auk")
4

1 回答 1

0

我怀疑你应该这样做,因为在这个问题之前似乎有某种设置操作:

my_ebd_path = auk_get_ebd_path()  # since you appear to already set it.
my_full_file_loc <- paste0(my_ebd_path, ”/“, "ebd_CA_relApr-2019.txt")
my_ebd_data <- read_ebd(my_full_file_loc)

str(my_ebd_data)
# ------what I get with the sample file in the package--------------
Classes ‘tbl_df’, ‘tbl’ and 'data.frame':   494 obs. of  45 variables:
 $ checklist_id                : chr  "S6852862" "S14432467" "S39033556" "S38303088" ...
 $ global_unique_identifier    : chr  "URN:CornellLabOfOrnithology:EBIRD:OBS97935965" "URN:CornellLabOfOrnithology:EBIRD:OBS201605886" "URN:CornellLabOfOrnithology:EBIRD:OBS530638734" "URN:CornellLabOfOrnithology:EBIRD:OBS520887169" ...
 $ last_edited_date            : chr  "2016-02-22 14:59:49" "2013-06-16 17:34:19" "2017-09-06 13:13:34" "2017-07-24 15:17:16" ...
 $ taxonomic_order             : num  20145 20145 20145 20145 20145 ...
 $ category                    : chr  "species" "species" "species" "species" ...
 $ common_name                 : chr  "Green Jay" "Green Jay" "Green Jay" "Green Jay" ...
 $ scientific_name             : chr  "Cyanocorax yncas" "Cyanocorax yncas" "Cyanocorax yncas" "Cyanocorax yncas" ...
 $ observation_count           : chr  "4" "2" "1" "1" ...
 $ breeding_bird_atlas_code    : chr  NA NA NA NA ...
 #----snipped a bunch of output---------
于 2019-06-10T21:19:31.863 回答