When knitting to word, document is opened with preview.app

Hi, when I knitting to word in Rstudio (Version 1.2.1335), the output document is opened with preview.app in Mac. Any suggestions?

I'm on mac OS Catalina.

Thanks in advance

> sessionInfo()
R version 3.6.0 (2019-04-26)
Platform: x86_64-apple-darwin15.6.0 (64-bit)
Running under: macOS  10.15.1

Matrix products: default
BLAS:   /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libBLAS.dylib
LAPACK: /Library/Frameworks/R.framework/Versions/3.6/Resources/lib/libRlapack.dylib

locale:
[1] es_ES.UTF-8/es_ES.UTF-8/es_ES.UTF-8/C/es_ES.UTF-8/es_ES.UTF-8

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

other attached packages:
[1] knitr_1.26     rmarkdown_1.17

Hi, and welcome!

A reproducible example, called a reprex will provide more to go on. I can't tell how the rendering is being generated, so why it opens in Preview could be due to a number of reasons.

Check first, however, if Preview is the default app for Word documents in the Finder

Thanks for your reply and for your advice about reproducible example.

I checked that Preview isn't the default app for Word documents in the Finder.

I also ran this simple .Rmd example, and the results is the same.

---
title: "test"
output: word_document
---

```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
```

## R Markdown

This is an R Markdown document. Markdown is a simple formatting syntax for authoring HTML, PDF, and MS Word documents. For more details on using R Markdown see <http://rmarkdown.rstudio.com>.

When you click the **Knit** button a document will be generated that includes both content as well as the output of any embedded R code chunks within the document. You can embed an R code chunk like this:

```{r cars}
summary(cars)
```

## Including Plots

You can also embed plots, for example:

```{r pressure, echo=FALSE}
plot(pressure)
```

Note that the `echo = FALSE` parameter was added to the code chunk to prevent printing of the R code that generated the plot.

Any suggestion?

Thanks in advance

> sessionInfo()
R version 3.6.0 (2019-04-26)
Platform: x86_64-apple-darwin15.6.0 (64-bit)
Running under: macOS  10.15.1

Matrix products: default
BLAS:   /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libBLAS.dylib
LAPACK: /Library/Frameworks/R.framework/Versions/3.6/Resources/lib/libRlapack.dylib

locale:
[1] es_ES.UTF-8/es_ES.UTF-8/es_ES.UTF-8/C/es_ES.UTF-8/es_ES.UTF-8

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

other attached packages:
[1] reprex_0.3.0

loaded via a namespace (and not attached):
 [1] Rcpp_1.0.3      ps_1.3.0        digest_0.6.23   R6_2.4.1        evaluate_0.14  
 [6] rlang_0.4.2     fs_1.3.1        callr_3.3.2     whisker_0.4     rmarkdown_1.17 
[11] tools_3.6.0     xfun_0.11       yaml_2.2.0      compiler_3.6.0  processx_3.4.1 
[16] clipr_0.7.0     htmltools_0.4.0 knitr_1.26

This is the same behavior I get with the following session info

sessionInfo() 
#> R version 3.6.1 (2019-07-05)
#> Platform: x86_64-apple-darwin15.6.0 (64-bit)
#> Running under: macOS Mojave 10.14.6
#> 
#> Matrix products: default
#> BLAS:   /Library/Frameworks/R.framework/Versions/3.6/Resources/lib/libRblas.0.dylib
#> LAPACK: /Library/Frameworks/R.framework/Versions/3.6/Resources/lib/libRlapack.dylib
#> 
#> locale:
#> [1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8
#> 
#> attached base packages:
#> [1] stats     graphics  grDevices utils     datasets  methods   base     
#> 
#> loaded via a namespace (and not attached):
#>  [1] compiler_3.6.1  magrittr_1.5    tools_3.6.1     htmltools_0.4.0
#>  [5] yaml_2.2.0      Rcpp_1.0.3      stringi_1.4.3   rmarkdown_1.17 
#>  [9] highr_0.8       knitr_1.26      stringr_1.4.0   xfun_0.11      
#> [13] digest_0.6.23   rlang_0.4.2     evaluate_0.14

Created on 2019-11-27 by the reprex package (v0.3.0)

So, the behavior isn't specific to Catalina (I'm on Mojave.)

This raises the question, though, why does rendering in Preview rather than the Viewer pane or open in browser present a problem? After all, reading docx in a browser, when it can be done at all, isn't default behavior.

I'm also getting a similar problem - except in my case it's suddenly trying to open in Keka (file decompressor app) instead of Word, which doesn't work at all. It worked fine opening generated .docx files in Word until I upgraded to Catalina. Word is set as my Finder default for .docx files.

It seems like it may be related to this issue? I did switch to Microsoft 365 before upgrading to Catalina.

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.