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

timeseries_client.R parseIso8601 function #59

Open
dftjsn opened this issue Jun 4, 2018 · 1 comment
Open

timeseries_client.R parseIso8601 function #59

dftjsn opened this issue Jun 4, 2018 · 1 comment

Comments

@dftjsn
Copy link

dftjsn commented Jun 4, 2018

While passing an R vector of timestamps to the timeseries_client.R parseIso8601 function, I got this message:

Warning message:
In if (substr(isoText, len - 2, len - 2) == ":") { :
the condition has length > 1 and only the first element will be used

I modified the relevant portion of the function code to use an ifelse statement and no longer get the warning message:

ifelse(substr(isoText, len - 2, len - 2) == ":",
isoText <- paste0(substr(isoText, 1, len - 3), substr(isoText, len - 1, len)),
ifelse(substr(isoText, len, len) == "Z",
isoText <- paste0(substr(isoText, 1, len - 1), "+0000")
)
)

Alex's email included an easy way to demonstrate that the parseIso8601 function only works on strings rather than vectors:

For example, this line of code will produce the warning:
ii=c("00:00","00:01"); if(substr(ii, 5- 2, 5 - 2) == ":") { print("hey") }else{print("no")}

but if use just a string for ii, no error.
ii="00:00"; if(substr(ii, 5- 2, 5 - 2) == ":") { print("hey") }else{print("no")}

The ifelse construct in R works with vectors.

@DougSchmidt-AI
Copy link
Contributor

Whoops. I missed the notification on this issue while I was on vacation. It's been raised by a few other customers too. I'll take a look and see how this can be improved.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants