简体   繁体   中英

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. 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. with the auk_get_ebd_path() command I see the same thing. 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.

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

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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