MyNixOS website logo
Description

Spy on Your R Session.

Conveniently log everything you type into the R console. Logs are are stored as tidy data frames which can then be analyzed using 'tidyverse' style tools.

matahari

CRAN status Travis-CI Build Status

Spy on Your R Session

A simple package for tidy logging of everything you type into the R console.

Installation

You can install matahari from CRAN with:

install.packages("matahari")

Or from GitHub with:

# install.packages("devtools")
devtools::install_github("jhudsl/matahari")

Getting Started

library(matahari)
library(tidyverse)
library(knitr)

# Start logging your commands
dance_start(value = TRUE)

4 + 4
"wow!"
mean(1:10)

# Pause logging
dance_stop()

# Look at your log as a tibble
dance_tbl()

## # A tibble: 6 x 6
##   expr       value             path      contents  selection dt                 
##   <list>     <list>            <list>    <list>    <list>    <dttm>             
## 1 <language> <S3: sessionInfo> <lgl [1]> <lgl [1]> <lgl [1]> 2018-06-23 15:26:06
## 2 <language> <int [1]>         <lgl [1]> <lgl [1]> <lgl [1]> 2018-06-23 15:26:06
## 3 <language> <dbl [1]>         <lgl [1]> <lgl [1]> <lgl [1]> 2018-06-23 15:26:07
## 4 <chr [1]>  <chr [1]>         <lgl [1]> <lgl [1]> <lgl [1]> 2018-06-23 15:26:08
## 5 <language> <dbl [1]>         <lgl [1]> <lgl [1]> <lgl [1]> 2018-06-23 15:26:08
## 6 <language> <S3: sessionInfo> <lgl [1]> <lgl [1]> <lgl [1]> 2018-06-23 15:26:09

# Do data science
dance_tbl() %>%
  slice(2:(n() - 1)) %>%
  select(expr, value) %>%
  mutate(class = map_chr(expr, class)) %>%
  kable()

## |expr                      |value |class     |
## |:-------------------------|:-----|:---------|
## |dance_start(value = TRUE) |1     |call      |
## |4 + 4                     |8     |call      |
## |wow!                      |wow!  |character |
## |mean(1:10)                |5.5   |call      |

Evaluating files

library(matahari)
library(tidyverse)
library(knitr)

code_file <- system.file("test", "sample_code.R", package = "matahari")

code_file %>%
  dance_recital() %>% 
  kable()
  
## |expr                |result   |error           |output   |warnings |messages |
## |:-------------------|:--------|:---------------|:--------|:--------|:--------|
## |4 + 4               |8        |NULL            |         |         |         |
## |wow!                |wow!     |NULL            |         |         |         |
## |mean(1:10)          |5.5      |NULL            |         |         |         |
## |stop("Error!")      |NULL     |Error!, .f(...) |NULL     |NULL     |NULL     |
## |warning("Warning!") |Warning! |NULL            |         |Warning! |         |
## |message("Hello?")   |NULL     |NULL            |         |         |Hello?   |
## |cat("Welcome!")     |NULL     |NULL            |Welcome! |         |         |

code_string <- "set.seed(42)\nx <- sample(1:10, 5)\nmedian(x)"

code_string %>%
  dance_recital() %>% 
  kable()

## |expr                 |result         |error |output |warnings |messages |
## |:--------------------|:--------------|:-----|:------|:--------|:--------|
## |set.seed(42)         |NULL           |NULL  |       |         |         |
## |x <- sample(1:10, 5) |10, 9, 3, 6, 4 |NULL  |       |         |         |
## |median(x)            |6              |NULL  |       |         |         |
Metadata

Version

0.1.3

License

Unknown

Platforms (75)

    Darwin
    FreeBSD
    Genode
    GHCJS
    Linux
    MMIXware
    NetBSD
    none
    OpenBSD
    Redox
    Solaris
    WASI
    Windows
Show all
  • aarch64-darwin
  • aarch64-genode
  • aarch64-linux
  • aarch64-netbsd
  • aarch64-none
  • aarch64_be-none
  • arm-none
  • armv5tel-linux
  • armv6l-linux
  • armv6l-netbsd
  • armv6l-none
  • armv7a-darwin
  • armv7a-linux
  • armv7a-netbsd
  • armv7l-linux
  • armv7l-netbsd
  • avr-none
  • i686-cygwin
  • i686-darwin
  • i686-freebsd
  • i686-genode
  • i686-linux
  • i686-netbsd
  • i686-none
  • i686-openbsd
  • i686-windows
  • javascript-ghcjs
  • loongarch64-linux
  • m68k-linux
  • m68k-netbsd
  • m68k-none
  • microblaze-linux
  • microblaze-none
  • microblazeel-linux
  • microblazeel-none
  • mips-linux
  • mips-none
  • mips64-linux
  • mips64-none
  • mips64el-linux
  • mipsel-linux
  • mipsel-netbsd
  • mmix-mmixware
  • msp430-none
  • or1k-none
  • powerpc-netbsd
  • powerpc-none
  • powerpc64-linux
  • powerpc64le-linux
  • powerpcle-none
  • riscv32-linux
  • riscv32-netbsd
  • riscv32-none
  • riscv64-linux
  • riscv64-netbsd
  • riscv64-none
  • rx-none
  • s390-linux
  • s390-none
  • s390x-linux
  • s390x-none
  • vc4-none
  • wasm32-wasi
  • wasm64-wasi
  • x86_64-cygwin
  • x86_64-darwin
  • x86_64-freebsd
  • x86_64-genode
  • x86_64-linux
  • x86_64-netbsd
  • x86_64-none
  • x86_64-openbsd
  • x86_64-redox
  • x86_64-solaris
  • x86_64-windows