CharToDate(x) Error in R - r

I have a function named currency. It takes a parameter A which is a currency like "EUR/USD" . Then I do this: n<-getSymbols(A,src = "oanda",from = "2016-01-01",to = Sys.Date(),auto.assign = FALSE)
The paradox is that the program was running fine 2 days ago.
The error message is: Error in charToDate(x) : character string is not in a standard unambiguous format.
This is the traceback()
Thanks in advance!

I think that this a duplicate
quantmod::getFX function returns "character in a standard unambiguous format"
In any case, I followed the code of the getSymbols.oanda and it seems that oanda changed their API so instead of downloading a .csv you get a .xml file.
Speaking for me, I will go for a different source for the data until this is resolved by the quantmod guys.

Related

R Shiny: withMathJax does not recognize \begin and \end

I need to render a matrix using withMathJax. While withMathJax works for formulas such as $$e^{i \pi} + 1 = 0$$, it does not recognize matrices.
When I tried withMathJax(helpText('$$\begin{bmatrix}a\\b\end{bmatrix}$$')), I receive an error message that "Error : '\e' is an unrecognized escape in character string starting "'$$\begin{bmatrix}a\b\e".
Does anyone know how to fix it? Thank you in advance.

R I would like to record an empty data entry using as.Date

R - I would like to input an empty data entry using as.Date. If I enter in the R console as.Date(""), I get NA as a return without any error message.
When I used as.Date() inside a loop, I got an error message to ask me to supply the 'origin'. But when I included the 'origin' argument in the as.Date function, as you can see below, I still get an error message.
I don't understand what I am doing wrong. I would appreciate any help on this. Many thanks!
for (r in 1:nrow(R3)){
R3$DATE1[r]<-ifelse(
R3$dateDiff2[r]==R3$MIN[r],
RR3$DATE1[r],
as.Date("", origin="1970-01-01")
)
}
<Error in as.POSIXct.numeric(value) : 'origin' must be supplied

Errors while converting from numbers to character R

In R, I tried to see the summary of my data after converting them from numbers to characters and this message revealed continuously:
Error in nchar(x, type = "w"): invalid multibyte string, element 18
Sounds like a system locale issue. See this blog post for an example that may be similar to your case use.
In a nutshell, try running this before the rest of your code:
Sys.setlocale("LC_ALL", "English")

R - Error in charToDate(x)

I'm sure this is super simple to understand, but I'm new to R, and try as I might, I can't get the other suggestions on these forums to work for me. I'm just trying to download the PAYEMS time series through the Quantmod package.
The code:
library(quantmod)
library(lubridate)
getSymbols("PAYEMS", src=("FRED"), return.class = "xts")
The output:
getSymbols("PAYEMS", src=("FRED"), return.class = "xts")
Error in charToDate(x) :
character string is not in a standard unambiguous format
I'm guessing it's the date format, but it's not clear to me how I fix that. I only know how to change it once I get the vector I want to make into dates.
Thanks!
I get this error occasionally too. I don't recall getting this the year before. Restarting R doesn't help, but restarting the computer does solve the problem. I don't know what it is that fixed this.

Troubles in R with Dates

I'm just starting with R. I have the following problem:
I am using the "sesonal" package (http://cran.at.r-project.org/web/packages/season/season.pdf). I wanted to usethe cosinor function but I have a problem I can't solve.
If I use this call:
test = cosinor(data=train_data2, date=as.Date("2013-01-01"))
I get:
Fehler in charToDate(x) :
character string is not in a standard unambiguous format
but the date seams to be in the right format since
as.Date("2013-01-01")
works fine.
can anyone help me ?
Thanks in advance!

Resources