Dealing with the object_usage_linter #199
Closed
lokesh-krishna
started this conversation in
General
Replies: 3 comments 3 replies
-
This does not seem to be related to this plugin. library(lintr)
lint(
text = '# Libraries
library(tidyverse)
library(here)
library(janitor)
name <- function(variables) {
# import data
df <- read_rds(here("data", "clean_data", "df.rds"))
df
# distribution by weeks of gestation
df |>
group_by(gestation) |>
summarise(
num = n()
) |>
ggplot(aes(x = gestation, y = num)) +
geom_point(
color = "#b4befe",
size = 5
) +
geom_segment(aes(
x = gestation,
xend = gestation,
y = 0,
yend = num
)) +
theme_ipsum_ps() +
labs(
title = "Distribution of observations by weeks of gestation",
x = "Weeks of gestation",
y = "Number of observations",
)
ggsave(
here("output", "plots", "gestational.jpg"),
width = 10,
height = 7
)
}
',
linters = object_usage_linter()
) [ins] r$> Rnvim.source()
<text>:14:14: warning: [object_usage_linter] no visible binding for global variable 'gestation'
group_by(gestation) |>
^~~~~~~~~
<text>:14:14: warning: [object_usage_linter] no visible binding for global variable 'gestation'
group_by(gestation) |>
^~~~~~~~~
<text>:14:14: warning: [object_usage_linter] no visible binding for global variable 'gestation'
group_by(gestation) |>
^~~~~~~~~
<text>:14:14: warning: [object_usage_linter] no visible binding for global variable 'gestation'
group_by(gestation) |>
^~~~~~~~~
<text>:29:5: warning: [object_usage_linter] no visible global function definition for 'theme_ipsum_ps'
theme_ipsum_ps() +
^~~~~~~~~~~~~~ |
Beta Was this translation helpful? Give feedback.
0 replies
-
Can you use a |
Beta Was this translation helpful? Give feedback.
1 reply
-
I get it now. It is because you load |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
While working on a script for plots, I created a function. When I came back to the file later though, the entire function is riddled with
object_usage_linter
warnings.This persists even after I've loaded the libraries. Am I missing something or is this supposed to be dealt with by disabling the
object_usage_linter
?Link to the file: plots.R
Beta Was this translation helpful? Give feedback.
All reactions