简体   繁体   English

在mac和windows中对r中的awk的ebd文件路径的连接进行故障排除

[英]troubleshooting a connection to the ebd file path for awk in r in mac and windows

I'm opening ebird data with auk, having trouble creating a path for the file. 我用auk打开ebird数据,无法为文件创建路径。 I set the path to a folder. 我将路径设置为文件夹。 When I try to change it to a file it says the path is not true. 当我尝试将其更改为文件时,它表示路径不正确。

with the Sys.getenv() I can see the path is set to a folder. 使用Sys.getenv()我可以看到路径设置为一个文件夹。 with the auk_get_ebd_path() command I see the same thing. 使用auk_get_ebd_path()命令我看到同样的事情。 When I try to change the path to a file inside that folder with the auk_set_ebd_path() command I receive an error message. 当我尝试使用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

other attempts yeilded an Error in file(con, "r") : cannot open the connection message 其他尝试yeilded Error in file(con, "r") : cannot open the connectionError 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

seems like they want the path to go to a file. 好像他们想要路径去一个文件。 I thought the path would be complete with the system.file() command. 我认为使用system.file()命令完成路径。 I've tried a bunch of variations: 我尝试了很多变化:

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

or 要么

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

or 要么

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

I suspect you should be doing this, since there appears to have been some sort of setup operation that preceded this question: 我怀疑你应该这样做,因为在这个问题之前似乎有某种设置操作:

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM