Skip to content

RMarkdown function definitions execute line-by-line #4503

Closed

Description

@colearendt

Latest preview (1.2.1330-2):

  • Define the following function in an Rmd chunk:
function(){
  "blahblahblah1"
  "blahblahblah2"
  "blahblahblah3"
  "blahblahblah4"
  "blahblahblah5"
  "blahblahblah6"
  "blahblahblah"
  "blahblahblah"
  "blahblahblah"
  "blahblahblah"
  "blahblahblah"
  "blahblahblah"
  "blahblahblah"
  "blahblahblah"
  "blahblahblah"
  "blahblahblah"
  "blahblahblah"
  "blahblahblah"
  "blahblahblah"
  "blahblahblah"
  "blahblahblah"
  "blahblahblah"
  "blahblahblah"
  "blahblahblah"
  "blahblahblah"
  "blahblahblah"
  "blahblahblah"
  "blahblahblah"
  "blahblahblah"
  "blahblahblah"
  "blahblahblah"
  "blahblahblah"
  "blahblahblah"
  "blahblahblah"
  "blahblahblah"
  "blahblahblah"
  "blahblahblah"
  "blahblahblah"
  "blahblahblah"
  "blahblahblah"
  "blahblahblah"
  "blahblahblah"
  "blahblahblah"
  "blahblahblah"
  "blahblahblah"
  "blahblahblah"
  "blahblahblah"
  "blahblahblah"
  "blahblahblah"
  "blahblahblah"
  "blahblahblah"
  "blahblahblah"
  "blahblahblah"
  "blahblahblah"
  "blahblahblah"
  "blahblahblah"
  "blahblahblah"
  "blahblahblah"
  "blahblahblah"
  "blahblahblah"
  "blahblahblah"
  "blahblahblah2"
  "blahblahblah4"
  "blahblahblah6"
}
  • CTRL + Enter to execute it
  • scroll through the history buffer to recognize it was executed line-by-line
  • if you copy and paste into the R console, R treats it as a "chunk"

I think the "chunk" behavior is preferable. The line-by-line approach is slow and destroys your history buffer for long objects.

Activity

  1. ronblum commented on Mar 27, 2019

    @ronblum
    Contributor

    @colearendt I think this was discussed a while back, but I can't find an issue or other conversation about it, so I'll mark it as an enhancement for now.

  2. jmcphers commented on Mar 30, 2020

    @jmcphers
    Member

    We are tracking this in #3520.

  3. pqmatagi commented on Apr 28, 2021

    @pqmatagi

    Any update on this "enhancement" (it's just a bug to me)? As the OP notes, this is a PITA when working in the console with code fragments from a .Rmd doc. I can't imagine any user actually preferring this behavior in the history, and to me it's a huge usability problem, much as I like the literate programming benefits of R Markdown.

  4. kevinushey commented on Apr 28, 2021

    @kevinushey
    Collaborator

    @pqmatagi I've re-opened the associated issue at #3520.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions