Use æøå characters in R-presentation as variable names

Viewed 946

Is it possible to get the letters "æ", "ø" and "å" to work as variable names in an R-presentation, using knitr and R-studio? I find that I can't use these letters as variable names.

The following code shows 1 chunk which works, and 3 chunks that don't. The 3 chunks that don't work are using "æ", "ø" or "å":

minimal slide that works:
================================

```{r}

# iris$nal <- "works"

```



minimal slide which dont work 1
==================================


```{r}

#  iris$næl <- "dontwork"

```




minimal slide which dont work 2 
==================================


```{r}

#  iris$nøl <- "dontwork"

```



minimal slide which dont work 3
===================================

```{r}

 iris$nål <- "dontwork"

```

(I have commented out some of the lines, delete the # to see the error for that chunk)

Strangely I am getting different error messages for each letter. For "æ" and "ø" I get an obvious error message:

Error in parse(text = x, srcfile = src) : <text>:2:9: unexpected input
1: 
2:  iris$næ

But for "å" I get a more obscure error message (obscure to me atleast)

processing file: minimal4.Rpres
Warning in block_exec(params) :
  the package option stop_on_error was deprecated; use the chunk option error = FALSE instead
Warning in block_exec(params) :
  the package option stop_on_error was deprecated; use the chunk option error = FALSE instead
Warning in block_exec(params) :
  the package option stop_on_error was deprecated; use the chunk option error = FALSE instead
Warning in block_exec(params) :
  the package option stop_on_error was deprecated; use the chunk option error = FALSE instead

I use UTF-8 encoding. SessionInfo()

> sessionInfo()
R version 3.0.2 (2013-09-25)
Platform: x86_64-w64-mingw32/x64 (64-bit)

locale:
[1] LC_COLLATE=English_United Kingdom.1252  LC_CTYPE=English_United Kingdom.1252    LC_MONETARY=English_United Kingdom.1252
[4] LC_NUMERIC=C                            LC_TIME=English_United Kingdom.1252    

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] xtable_1.7-1    plyr_1.8        scales_0.2.3    ggplot2_0.9.3.1 knitr_1.5       XML_3.98-1.1    markdown_0.6.3 

loaded via a namespace (and not attached):
 [1] colorspace_1.2-4   dichromat_2.0-0    digest_0.6.3       evaluate_0.5       formatR_0.9        grid_3.0.2        
 [7] gtable_0.1.2       labeling_0.2       MASS_7.3-29        munsell_0.4.2      proto_0.3-10       RColorBrewer_1.0-5
[13] reshape2_1.2.2     stringr_0.6.2      tools_3.0.2 
1 Answers
Related