Type: Package
Title: Create View Tabs of Pipe Chains
Version: 0.1.0
Maintainer: David Ranzolin <daranzolin@gmail.com>
Description: Debugging pipe chains often consists of viewing the output after each step. This package adds RStudio addins and two functions that allow outputing each or select steps in a convenient way.
License: MIT + file LICENSE
Encoding: UTF-8
Imports: dplyr, rstudioapi, tibble
RoxygenNote: 7.1.0
NeedsCompilation: no
Packaged: 2021-12-14 16:26:00 UTC; davidranzolin
Author: David Ranzolin [aut, cre, ctb], Joachim Gassen [aut]
Repository: CRAN
Date/Publication: 2021-12-15 19:30:02 UTC

%P>% Prints and pipes

Description

This pipe variant prints the object received from the left hand side prior to piping it to the right hand side.

Usage

lhs %P>% rhs

Arguments

lhs

The left hand side of the pipe.

rhs

The right hand side of the pipe.

Value

called for side effects

Note

This code is experimental. Use at your own risk.

Examples

  if (!require(dplyr)) stop("Examples need dplyr to run")
  mtcars %>%
    filter(am == 1) %P>%
    select(qsec)


Prints each pipe step in current text selection

Description

Reads the currently selected text from the RStudio API and prints for each pipe step the resulting object if unique. Data frames are converted by as_tibble(). Meant to be called as an RStudio addin.

Reads the currently selected text from the RStudio API and prints for each pipe step the resulting object if unique. Data frames are converted by as.tibble(). Meant to be called as an RStudio addin.

Usage

printPipeChain()

printPipeChain()

Value

No return value, called for side effects


Description

Added as last command to a pipe, prints for each pipe step the resulting object to the console if unique. Data frames are converted by as_tibble().

Usage

print_pipe_steps(.data, cmd = print_command, all = FALSE)

Arguments

.data

The data, normally handed over from the prior pipe step.

cmd

The command to be evaluated for each object. Takes ps object of step example.

all

Whether you want to print objects even if they are identical. Helpful when you want to display changes in grouping.

Value

The unchanged data

Examples


if (!require(dplyr)) stop("Examples need dplyr to run")
mtcars %>%
  filter(am == 1) %>%
  select(qsec) %>%
  print_pipe_steps() -> result

my_print_cmd <- c(
  "message(title);",
  "skimr::skim_tee(data = ps%d)"
)

mtcars %>%
  select(am, hp, mpg) %>%
  group_by(am) %>%
  print_pipe_steps(my_print_cmd, all = TRUE) %>%
  summarize(
    nobs = n(),
    mean_hp = mean(hp),
    mean_mpg = mean(mpg)
  )


Creates a View() output for each pipe step in current text selection

Description

Reads the currently selected text from the RStudio API and displays a data view in the source pane for each pipe step creating a unique object. Meant to be called as an RStudio addin.

Reads the currently selected text from the RStudio API and displays a data view in the source pane for each pipe step creating a unique object. Meant to be called as an RStudio addin.

Usage

viewPipeChain()

viewPipeChain()

Value

No return value, called for side effects

mirror server hosted at Truenetwork, Russian Federation.