Closed IndrajeetPatil closed 5 years ago
Hi. This is occuring for precisely the same reason that you got the bug in lintr
: here https://github.com/jimhester/lintr/issues/355 .
My package uses the code-parsing functions from `lintr which fails on files that have either i) no R code blocks (eg, an empty file, an all-comments file, or an all-text Rmarkdown file); or ii) code blocks from a non-R language (eg, python blocks in Rmarkdown)
So if your environment has the CRAN version of lintr, you will get this bug. The options are to either install the github version of lintr
(since I fixed the lintr bug in a couple of pull requests) or to restrict analysis to files that are non-empty and have no non-R code blocks.
Related to #4
Thanks, I downloaded the most recent version of lintr
from GitHub just now. And now it works!
By the way, in a fresh R session, if dplyr
is not explicitly loaded, this function gives a different error because it fails to find dplyr::n()
-
> dupree::dupree_package(".")
Error in n() : could not find function "n"
Here is the traceback-
> traceback()
35: summarise_impl(.data, dots, environment())
34: summarise_.tbl_df(., enumerated_code = ~list(c(symbol_enum)),
block_size = "n()")
33: dplyr::summarise_(., enumerated_code = ~list(c(symbol_enum)),
block_size = "n()")
32: function_list[[k]](value)
31: withVisible(function_list[[k]](value))
30: freduce(value, `_function_list`)
29: `_fseq`(`_lhs`)
28: eval(quote(`_fseq`(`_lhs`)), env, env)
27: eval(quote(`_fseq`(`_lhs`)), env, env)
26: withVisible(eval(quote(`_fseq`(`_lhs`)), env, env))
25: df %>% dplyr::group_by_(~file, ~block, ~start_line) %>% dplyr::summarise_(enumerated_code = ~list(c(symbol_enum)),
block_size = "n()")
24: summarise_enumerated_blocks(.)
23: function_list[[k]](value)
22: withVisible(function_list[[k]](value))
21: freduce(value, `_function_list`)
20: `_fseq`(`_lhs`)
19: eval(quote(`_fseq`(`_lhs`)), env, env)
18: eval(quote(`_fseq`(`_lhs`)), env, env)
17: withVisible(eval(quote(`_fseq`(`_lhs`)), env, env))
16: block_df %>% remove_trivial_code_symbols() %>% enumerate_code_symbols() %>%
summarise_enumerated_blocks()
15: tokenize_code_blocks(.)
14: function_list[[i]](value)
13: freduce(value, `_function_list`)
12: `_fseq`(`_lhs`)
11: eval(quote(`_fseq`(`_lhs`)), env, env)
10: eval(quote(`_fseq`(`_lhs`)), env, env)
9: withVisible(eval(quote(`_fseq`(`_lhs`)), env, env))
8: files %>% import_parsed_code_blocks() %>% tokenize_code_blocks() %>%
filter_(~block_size >= min_block_size)
7: preprocess_code_blocks(files, min_block_size)
6: eval(lhs, parent, parent)
5: eval(lhs, parent, parent)
4: preprocess_code_blocks(files, min_block_size) %>% find_best_matches()
3: dupree(keep_files, min_block_size)
2: dupree_dir(package, min_block_size, filter = paste0(package,
"/R/"))
1: dupree::dupree_package(".")
>
I think this is undesirable behavior.
I think the latter issue should disappear once you import n
from dplyr
. It's currently used but not imported-
https://github.com/russHyde/dupree/blob/b29ed71f69de48937cb4d88fd19921821e782c94/NAMESPACE#L6-L14
Thanks, will get this fixed
Just fixed the dplyr::n
non-import. Thanks for reporting.
fixed in #24
I am trying to use this package to see if it works for this package (https://github.com/IndrajeetPatil/ggstatsplot), but I keep getting the following error-
Here is the tracenack-
And session information-
Created on 2019-01-26 by the reprex package (v0.2.1)