https://github.com/jhudsl/matahari
🔎 I Spy With My Little Eye
https://github.com/jhudsl/matahari
Last synced: about 2 months ago
JSON representation
🔎 I Spy With My Little Eye
- Host: GitHub
- URL: https://github.com/jhudsl/matahari
- Owner: jhudsl
- License: other
- Created: 2017-08-22T18:12:24.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2020-02-08T00:33:26.000Z (about 5 years ago)
- Last Synced: 2024-07-31T19:26:32.618Z (9 months ago)
- Language: R
- Homepage:
- Size: 138 KB
- Stars: 50
- Watchers: 7
- Forks: 5
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- jimsghstars - jhudsl/matahari - 🔎 I Spy With My Little Eye (R)
README
# matahari
[](https://cran.r-project.org/package=matahari)
[](https://travis-ci.org/jhudsl/matahari)### 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:
```R
install.packages("matahari")
```Or from GitHub with:
```R
# install.packages("devtools")
devtools::install_github("jhudsl/matahari")
```## Getting Started
```R
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
##
## 1 2018-06-23 15:26:06
## 2 2018-06-23 15:26:06
## 3 2018-06-23 15:26:07
## 4 2018-06-23 15:26:08
## 5 2018-06-23 15:26:08
## 6 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
```R
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 | | | |
```