| download_file_linter {lintr} | R Documentation |
Recommend usage of a portable mode value for downloading files
Description
mode = "w" (the default) or mode = "a" in download.file() can generate broken files
on Windows. Instead, utils::download.file() recommends the usage of mode = "wb"
and mode = "ab".
If method = "curl" or method = "wget", no mode should be provided as it will be ignored.
Usage
download_file_linter()
Tags
best_practices, common_mistakes, robustness
See Also
linters for a complete list of linters available in lintr.
Examples
# will produce lints
lint(
text = "download.file(x = my_url)",
linters = download_file_linter()
)
lint(
text = "download.file(x = my_url, mode = 'w')",
linters = download_file_linter()
)
lint(
text = "download.file(x = my_url, method = 'curl', mode = 'wb')",
linters = download_file_linter()
)
# okay
lint(
text = "download.file(x = my_url, mode = 'wb')",
linters = download_file_linter()
)
lint(
text = "download.file(x = my_url, method = 'curl')",
linters = download_file_linter()
)
[Package lintr version 3.3.0-1 Index]