Giter Club home page Giter Club logo

matahari's People

Contributors

lucymcgowan avatar seankross avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

matahari's Issues

Make clipboard optional for dance_report()

I am trying to use dance_report() in RStudio Cloud, but it doesn't play nicely with the clipboard ๐Ÿ˜ข. Would you be okay with this change? If so, I can submit a PR.

copy_base64 <- function(clip = TRUE) {
  enc_string <- base64_enc(serialize(dance_tbl(), NULL))
  if (clip) {
   write_clip(enc_string)
  } else {
   enc_string
 }
} 

Can't reproduce README example ๐Ÿ˜ž

I am sure this is something weird on my end, but when I run the code in the README, my output is different (in fact I can't seem to populate the value column with anything except sessionInfo for the first and last column, and the rest of the columns with the exception of expr are all NA). I am using RStudio, running this inside a project.

dance_start()

4 + 4
#> [1] 8
"wow!"
#> [1] "wow!"
mean(1:10)
#> [1] 5.5

# Pause logging
dance_stop()
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-15 13:55:55
#> 2 <language> <lgl [1]>         <lgl [1]> <lgl [1]> <lgl [1]> 2018-06-15 13:55:55
#> 3 <language> <lgl [1]>         <lgl [1]> <lgl [1]> <lgl [1]> 2018-06-15 13:55:55
#> 4 <chr [1]>  <lgl [1]>         <lgl [1]> <lgl [1]> <lgl [1]> 2018-06-15 13:55:55
#> 5 <language> <lgl [1]>         <lgl [1]> <lgl [1]> <lgl [1]> 2018-06-15 13:55:55
#> 6 <language> <S3: sessionInfo> <lgl [1]> <lgl [1]> <lgl [1]> 2018-06-15 13:55:55

๐Ÿ‘† Notice here all of my value column are <lgl[1]> (which are actually NA) compared to the readme where they differ based on what the value output would have been.

Context: I am trying to use this for a project with Jeff so trying to figure out the ๐Ÿ“ฆ ๐ŸŽ‰

Don't save .dance in the global environment

Instead create a new environment inside your package:

env <- new.env(parent = emptyenv())

And then use that env instead of globalenv():

dance_remove <- function() {
  if (!exists("dance", envir = env)
    return(invisible(FALSE)
      
  rm("dance", envir = env)
  invisible(TRUE)
}

add vignette

@seankross, I'm adding a few issues to beef this up before submitting the paper we've been working on ๐ŸŽ‰

Some of these are based on this: https://github.com/jtleek/rpackages

If it is ๐Ÿ‘Œ with you I can go ahead and make these changes and submit as PRs for you to ๐Ÿ‘€ at

Not able to initiate dance without removing first

This code is creating an issue where you need to run dance_remove() in order to run dance_start() again (which I don't think we intended?) before you could just run

dance_start()
dance_stop()

matahari/R/dance.R

Lines 40 to 42 in 834885d

if (there_is_a_dance()) {
abort("Unable to start new dance while a dance is in progress.")
}

dplyr dependency?

@seankross, would it make you sad if I refactor this a bit to remove the dplyr dependency? I know dplyr isn't as heavy as it once was, but I've found that people get persnickety about picking up new packages that depend on it ๐Ÿคทโ€โ™€ BUT if you would rather it stays, I am fine with that too.

Consider alternate function names

Thanks for a great package, I wanted to pass on that I don't find the function names super intuitive ("dance" is not the first thing that comes to mind when I think of automated code analysis). I get that this is related to the package name, but it might be worth changing the names or aliasing them to something more memorable.

Use in R Studio Cloud?

Thanks for creating a great package.

I am currently using R Studio Cloud with middle grades-aged students. I am curious about whether I could use matahari to understand what code students write in a document. Apart from asking them to load matahari and to run the dance_start() and dance_stop() commands manually (assuming they have shared their project with me), is there any way to do this in an (even) more seemless way?

I am wondering about something like sourcing an R file that loads matahari and then runs dance_start(), but am not sure how to get the tracking to end without students manually running dance_end(). I know this question is a bit open-ended; thanks for considering this.

Errors not captured for logging flow

Thanks for creating a very useful package for logging executed expressions in RStudio!

I did come across a limitation I wanted to point out. If one only relied on dance_tbl(), the resulting table does not include code that produces an error, along with the error message. An example of executing on the console with error-producing code:

> dance_start()
> 2 + "foo"
Error in 2 + "foo" : non-numeric argument to binary operator
> dance_tbl()[['expr']]
[[1]]
sessionInfo()

[[2]]
dance_start()

The 2 + "foo" is not included.

However, this same ability is present if using dance_recital():

> dance_recital("2 + 'foo'")[['expr']]
[[1]]
2 + "foo"
> dance_recital("2 + 'foo'")[['error']]
[[1]]
<simpleError in 2 + "foo": non-numeric argument to binary operator>

I like the passive logging flow and was expecting it to also capture errors but it doesn't seem to be the case. Please let me know if there's a way to achieve it with dance_tbl() that I may have missed. Otherwise, it would be useful to include problematic code + error for dance_tbl().

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.