ices-tools-prod / icesSAG

R interface to Stock Assessment Graphs database web services
http://sg.ices.dk/webservices.aspx
10 stars 7 forks source link

findAssessmentKey - error #204

Closed stjanifani closed 4 years ago

stjanifani commented 4 years ago

When running findAssessmentKey() is called it gives the following error:

icesSAG::findAssessmentKey(2019) Error in grepl(EmDash, stock) : regular expression is invalid in this locale

The error is due to: EmDash <- rawToChar(as.raw(150)) rawToChar(as.raw(150)) needs to be replaced with "\u2013".

So it will be: EmDash <- "\u2013"

colinpmillar commented 4 years ago

thanks! we had quite a bit of trouble with this one, can you try running:

  stock <- "whi\x96there"
  if (any(grepl("\\x96", stock))) {
    warning("Please check stock names for 'long dash' ", "\x96", " and replace with -")
    stock <- gsub("\\x96", "-", stock)
  }

and see if it runs ok? Thanks

stjanifani commented 4 years ago

Hi Colin,

No, this does not work

I got this script running by doing this and delete the old EmDash line for:

EmDash <- "\u2013"

Kristján

Kristján Kristinsson, fiskifræðingur / Fisheries Scientist Botnsjávarsvið / Demersal Division Hafrannsóknastofnun, rannsókna- og ráðgjafastofnun hafs og vatna / Marine and Freshwater Research Institute, Skulagata 4, P.Box 1390, 121 Reykjavik, Iceland Tel.: +354 575 2091 kristjan.kristinsson@hafogvatn.is


Frá: Colin Millar notifications@github.com Sent: fimmtudagur, 3. september 2020 10:38 Til: ices-tools-prod/icesSAG icesSAG@noreply.github.com Afrit: Kristján Kristinsson kristjan.kristinsson@hafogvatn.is; Author author@noreply.github.com Efni: Re: [ices-tools-prod/icesSAG] findAssessmentKey - error (#204)

thanks! we had quite a bit of trouble with this one, can you try running:

stock <- "whi\x96there" if (any(grepl("\x96", stock))) { warning("Please check stock names for 'long dash' ", "\x96", " and replace with -") stock <- gsub("\x96", "-", stock) }

and see if it runs ok? Thanks

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fices-tools-prod%2FicesSAG%2Fissues%2F204%23issuecomment-686403412&data=02%7C01%7C%7Ca3394dc4c4ee42b5d5e708d84ff58e77%7C8e105b94435e4303a61063620dbe162b%7C0%7C1%7C637347263360683648&sdata=W2S%2BfguIfUzFYBPNT%2FUTZjVyXdqcx%2FracAPGPJrW40o%3D&reserved=0, or unsubscribehttps://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FAK7EBVRYUBB742F5CPPJQZTSD5W3PANCNFSM4QTFJ2VA&data=02%7C01%7C%7Ca3394dc4c4ee42b5d5e708d84ff58e77%7C8e105b94435e4303a61063620dbe162b%7C0%7C1%7C637347263360693642&sdata=Tf1wH%2BTtyazVOeQ%2F2SgYwoCnrJNQpfSNY9MIY%2FJYOvU%3D&reserved=0.

colinpmillar commented 4 years ago

Okay doke - I have made a fix and will pull into the master shortly, Thanks!

colinpmillar commented 4 years ago

should be fixed now - let me know if it works ok for you - we will update the CRAN version next week, thanks for posting the issue! Colin