The goal of tracerr is to โฆ
You can install the development version from GitHub with:
# install.packages("devtools")
devtools::install_github("jspaezp/tracerr")
This is a basic example which shows you how to solve a common problem:
library(tracerr)
## basic example code
##
r_str <- "
b <- 1:2
a <- sum(b)
a <- sum(a)
c <- sum(a)
print(c)
"
parsed_expr <- parse(text = r_str)
get_dependencies(parsed_expr, unique_names = FALSE)
#> # A tibble: 3 x 2
#> From To
#> <chr> <chr>
#> 1 b a
#> 2 a a
#> 3 a c
get_dependencies(parsed_expr, unique_names = TRUE)
#> # A tibble: 3 x 2
#> From To
#> <chr> <chr>
#> 1 b a
#> 2 a a.1
#> 3 a.1 c
library(igraph)
#>
#> Attaching package: 'igraph'
#> The following objects are masked from 'package:stats':
#>
#> decompose, spectrum
#> The following object is masked from 'package:base':
#>
#> union
g <- igraph::graph_from_data_frame(
get_dependencies(parsed_expr, unique_names = TRUE))
plot(g)