Skip to content
This repository was archived by the owner on Sep 2, 2025. It is now read-only.
This repository was archived by the owner on Sep 2, 2025. It is now read-only.

gist_create(file, knit = TRUE, source = TRUE) should work for an R script #29

@jennybc

Description

@jennybc

Riffing on this example from gist_create():

file <- system.file("examples", "stuff.Rmd", package = "gistr")
gist_create(file, knit=TRUE, include_source=TRUE)

I define an R script like so:

my_code <-"
#' ---
#' output: md_document
#' ---

#' I shall generate random numbers.
x <- rnorm(1000)

#' And I shall summarize them.
summary(x)"
#EDITED LATER! commenting out my initial garbled code and inserting what I meant :(
#my_code_file <- writeLines(my_code, file.path("~", "tmp", "foo.R"))
my_code_file <- file.path("~", "tmp", "foo.R")
writeLines(my_code, my_code_file)

and I would expect something like this to work:

gist_create(my_code_file, description = "My first R code gist via gistr",
            knit = TRUE, include_source = TRUE)

But instead I get this:

> gist_create(my_code_file, description = "My first R code gist via gistr",
+             knit = TRUE, include_source = TRUE)
Error in readLines(if (is.character(input2)) { : 
  object 'input2' not found

Same result if I remove the YAML front matter, so that's not the problem.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions