Running the display function on linux server throws an error message " xdg-open: no method available for opening"

On running the following code on R server,

dat <- data.frame(
col = "CRAN website", href = "https://cran.r-project.org",
stringsAsFactors = FALSE)
ft <- flextable(dat)
ft <- display(
ft, col_key = "col", pattern = "# {{mylink}}",
formatters = list(mylink ~ hyperlink_text(href, col) )
)
ft

I get the following error message: xdg-open: no method available for opening "https://cran.r-project.org"
So I decide to check the desktop environment set and I run the following command on the terminal:

xdg-settings get default-web-browser

But I get the following exception:
xdg-settings: unknown desktop environment

I would like to insert hyperlink text in word doc and hence I am using the hypertext_link function available in flextable package. But I get the above exception when I run the code.

The version of flextable installed on server is 0.4.6 and version of officer is 0.3.2.
Any help would be really appreciated. Thanks!

The server version is intended to be used from a separate laptop or desktop. What are you doing differently?

I am using it from a laptop.
I am running R scripts from command line on Linux

NAME="Red Hat Enterprise Linux Server"
VERSION="7.5 (Maipo)"

Ok, thanks. So, this has nothing to do with RStudio and the creation of dat and conversion of the flextable works.

library(flextable)
(dat <- data.frame(
  col = "CRAN website", href = "https://cran.r-project.org",
  stringsAsFactors = FALSE))
#>            col                       href
#> 1 CRAN website https://cran.r-project.org

(ft <- flextable(dat))
ft <- display(
  ft, col_key = "col", pattern = "# {{mylink}}",
  formatters = list(mylink ~ hyperlink_text(href, col) )
)
#> Error in display(ft, col_key = "col", pattern = "# {{mylink}}", formatters = list(mylink ~ : could not find function "display"

but I choke here because I don't know where display() comes from.

Display is a function in the package Flextable version 0.4.6

It’s no longer in the current version 0.8.3.

With those specific package versions your code works on Posit Cloud (Ubuntu 20.04 LTS) so I think this is a problem with a system library that is specific to your Linux distribution, sadly I don't have access to an RHEL system to further investigate.

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

If you have a query related to it or one of the replies, start a new topic and refer back with a link.