Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ï..species when reading the csv file encoding #10

Closed
Rafnuss opened this issue Apr 7, 2022 · 1 comment
Closed

ï..species when reading the csv file encoding #10

Rafnuss opened this issue Apr 7, 2022 · 1 comment
Labels
bug Something isn't working

Comments

@Rafnuss
Copy link
Owner

Rafnuss commented Apr 7, 2022

Error when using flight_bird() on windows only

No match for 'Acrocephalus arundinaceus'. Please use the exact name. 
Closest matches are: 
[1] ï..species  wing_length secondary   mass       
<0 rows> (or 0-length row.names)
--- failed re-building 'wind-graph.Rmd'

Which comes from reading the csv file "avonet_clements.csv":

GeoPressureR/R/flight.R

Lines 38 to 40 in d7c6e91

avonet <- utils::read.csv(system.file("extdata", "avonet_clements.csv",
package = "GeoPressureR"
))

This is apparently a common issue with UTF-8-BOM encoding.

Rafnuss added a commit that referenced this issue Apr 7, 2022
@Rafnuss Rafnuss changed the title ï..species... when reading the csv file encoding ï..species when reading the csv file encoding Apr 7, 2022
@Rafnuss Rafnuss added the bug Something isn't working label Apr 7, 2022
Rafnuss added a commit that referenced this issue Apr 7, 2022
@Rafnuss
Copy link
Owner Author

Rafnuss commented Apr 7, 2022

First tried to solved this with

GeoPressureR/R/flight.R

Lines 38 to 40 in 8b369bb

avonet <- utils::read.csv(system.file("extdata", "avonet_clements.csv",
package = "GeoPressureR", fileEncoding="UTF-8-BOM"
))

But it didn't worked

Error in read.table(file = file, header = header, sep = sep, quote = quote,  : 
  no lines available in input
In addition: Warning message:
In file(file, "rt") :
  file("") only supports open = "w+" and open = "w+b": using the former

The second solution was to manually correct if afterward:

colnames(avonet)[1] <- gsub('ï..','',colnames(avonet)[1])

But it wouldn't pass the check with the symbol, so resolved it by simply removing the character in GitHub editor directly: b9b6f2d

Rafnuss added a commit that referenced this issue Apr 7, 2022
Rafnuss added a commit that referenced this issue Apr 7, 2022
@Rafnuss Rafnuss closed this as completed Apr 7, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant