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

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.

Related

Getting unexpected input error in R expression

I'm trying to run this code to stretch the axes after creating a matrix based on calculated Euclidean distances:
ds_newA <- sqrt((new[1] -A[1]ˆ2 + (3*(new[2]-A[2]))ˆ2)
However, I'm getting an input error in the R console:
Error: unexpected input in "ds_newA <- sqrt((new[1] -A[1])ˆ"
Error: unexpected input in "ds_newB <- sqrt((new[1] -B[1])ˆ"
How should the code for formatted?
As noticed in the SO thread Error: unexpected symbol/input/string constant/numeric constant/SPECIAL in my code :
These errors mean that the R code you are trying to run or source is not syntactically correct. That is, you have a typo.
To fix the problem, read the error message carefully. The code provided in the error message shows where R thinks that the problem is. Find that line in your original code, and look for the typo.
Most probably, here this is due to the symbol ˆ you are using, which is not the appropriate one for an exponent ^:
# correct symbol ^:
> 2^2
[1] 4
# wrong symbol you seem to use ˆ :
> 2ˆ2
Error: unexpected input in "2ˆ"
Change it to the correct one ^ and you will be fine.

Problem with analysis with special characters in getsymbols (PerformanceAnalytics)

I am trying to create a chart.correlation with the package PerformanceAnalytics. This works great like here:
if(!require("PerformanceAnalytics")) {install.packages("PerformanceAnalytics"); require("PerformanceAnalytics")}
library(PerformanceAnalytics)
#
getSymbols("AMZN",from="2016-01-01",to="2020-05-01")
getSymbols("TSLA",from="2016-01-01",to="2020-05-01")
data1<-cbind(diff(log(Cl(AMZN))),diff(log(Cl(TSLA))))
chart.Correlation(data1)
But as soon as there are special characters I get the following error:
Error: unexpected '^' in "data<-cbind(diff(log(Cl(UTDI.DE))),diff(log(Cl(^"
for the following code:
getSymbols("UTDI.DE",from="2016-01-01",to="2020-05-01")
getSymbols("^MDAXI",from="2016-01-01",to="2020-05-01")
data2<-cbind(diff(log(Cl(UTDI.DE))),diff(log(Cl(^MDAXI))))
chart.Correlation(data2)
Does anyone know how to use the special character here?

Escape markdown link marker to use it as normal text

I have a short R error message that I am documenting in RStudio as markdown document (*.md).
It looks like a markdown link so it is misinterpreted and formatted like a link.
How can I prevent that (keeping it formatted as normal text)?
Example:
Error in value [[3L]](cond) : unused argument (cond)
is rendered as
My current work-around is backticking but this changes the format into code style:
Error in value `[[3L]](cond)` : unused argument (cond)
Try using \ to escape the part in parathenses.
Error in value [[3L]]\(cond) : unused argument (cond)
Gives:

CharToDate(x) Error in 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.

after updating shiny r package an "invalid JSON input" error

I updated my shiny r package and now I got this error:
.clientdatError in fromJSON(content, handler, default.size, depth, allowComments, :
invalid JSON input
Does anyone know what's happening here or where to look for the cause of the problem?
many thanks in advance!
edit. It has something to do with the tags function. When I remove e.g. tags$textarea(id="text", rows=5, cols=8, "this is a text area") the error doesn't appear anymore.

Resources