From e0083408f094a8a327966412f319754f1cf3bfb5 Mon Sep 17 00:00:00 2001 From: Thomas Silvers Date: Tue, 27 Feb 2024 13:57:13 +0100 Subject: [PATCH] Update README.rst --- README.rst | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/README.rst b/README.rst index 0f44681..004dc1e 100644 --- a/README.rst +++ b/README.rst @@ -283,7 +283,8 @@ environment, :code:`sandbox`. from pyrty.utils import run_capture # Create a temporary R script or use an existing one - rscript_code = """# Keep stdout clean + rscript_code = \ + """# Keep stdout clean options(warn=-1) suppressPackageStartupMessages(library(optparse)) suppressPackageStartupMessages(library(tidyverse)) @@ -293,7 +294,8 @@ environment, :code:`sandbox`. # Create a dataframe and write to stdout a <- 1:5 df <- tibble::tibble(a, b = a * 2, c = opt$c) - try(writeLines(readr::format_csv(df), stdout()), silent=TRUE)""" + try(writeLines(readr::format_csv(df), stdout()), silent=TRUE) + """ with NamedTemporaryFile('w+') as rscript: rscript_path = Path(rscript.name)