jhudsl / matahari Goto Github PK
View Code? Open in Web Editor NEW๐ I Spy With My Little Eye
License: Other
๐ I Spy With My Little Eye
License: Other
As mentioned in an issue that I raised in the repo for tidycode
, it seems that matahari
has a hard time spying on functional code. Any idea how to better spy when someone e.g. does purrrr::map(df, some_function)
? Currently, only the call to purrr::map
is caught, meaning that the person could hide anything behind some_function
...
I am trying to use dance_report()
in RStudio Cloud, but it doesn't play nicely with the clipboard
copy_base64 <- function(clip = TRUE) {
enc_string <- base64_enc(serialize(dance_tbl(), NULL))
if (clip) {
write_clip(enc_string)
} else {
enc_string
}
}
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
<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
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)
}
@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
data_frame()
and as_data_frame()
are now deprecated, changing to the tibble
friends. (I LOVE THAT TIBBLE AUTOCORRECTS TO NIBBLE, it always makes me laugh
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()
Lines 40 to 42 in 834885d
@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
It looks like this changed it when evaluate = FALSE
:
but it is still result
when evaluate = TRUE
?
Line 174 in 4c73ad4
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.
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.
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()
.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.