[R] variable of mathematics string not interpreted

delpacho francois.laurent at mail.mcgill.ca
Fri May 9 01:09:34 CEST 2008


Hi everybody,

my goal is to display symbols on the x-axis of a barplot.
I read some mathematics strings in a file and convert them to an expression
as follows:

tt<- scan(file = fstr ,'what' ='character', sep = "");

for (iaa in 1:length(tt)) { 
tt[iaa]<-do.call(expression, lapply(tt[iaa], as.name));
}

I obtained the following result:

tt =

expression(`alpha[tr]`, beta, widthD, `S[ts]^-5("[165,275]Hz")`, 
    `S[ts]^2("[165,275]Hz")`, `S[ts]^-5("[275,460]Hz")`,
`S[r]^2("[165,275]Hz")`, 
    `S[r]^-5("[275,460]Hz")`, `S[r]^3("[100,165]Hz")`,
`T[ts]^4("[165,275]Hz")`, 
    `T[ts]^7("[21,30]Hz")`, `T[ts]^8("[13,21]Hz")`, `T[r]^7("[21,30]Hz")`, 
    `T[r]^8("[13,21]Hz")`, `T[r]^9("[8,13]Hz")`, `E("[100,165]Hz")`, 
    `E("[165,275]Hz")`, `E("[60,100]Hz")`, `E("[8,13]Hz")`,
`E("[30,60]Hz")`, 
    `E("[21,30]Hz")`)

only the strings without "`" are interpreted properly when I put the
property names.arg =tt in barplot (ex:beta displays the greek letter,
whereas `alpha[tr]` displays alpha[tr]), could you explain me why these
symbol "`" intervenes when I convert the strings to an expression and/or how 
can I have the symbols associated with the strings displayed properly?

Thanks you very much.
-- 
View this message in context: http://www.nabble.com/variable-of-mathematics-string-not-interpreted-tp17138472p17138472.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list