-
Notifications
You must be signed in to change notification settings - Fork 25
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature: knitr cache dependency on box file versions #142
Comments
Never mind, I figured out how to do it:
# Get current file version number from Box
box_current_version <- Vectorize(
function(file_id) {
if(is.null(boxr::box_previous_versions(file_id))) {
return("V1")
}
# Get latest previous version
prev_version <- boxr::box_previous_versions(file_id) %>%
dplyr::pull(version) %>%
dplyr::last() %>%
as.character()
# Get current version
stringr::str_replace(
prev_version,
"[:digit:]",
as.character(
as.integer(stringr::str_extract(prev_version, "[:digit:]")) + 1
)
)
}
)
df <- boxr::box_read(file_id) Also possible to pass multiple file ids, i.e., df1 <- boxr::box_read(file_id1)
df2 <- boxr::box_read(file_id2)
boxr::box_fetch(dir_id = folder_id, local_dir = tempdir(), recursive = FALSE)
# do further processing |
Awesome, glad you figured it out! Question for you, do you think the behavior of I think you've highlighted a very common and useful use-case for the package, I wonder if |
Hey, @nathancday! I think |
Hey @nathancday, I found another use case for |
Box doesn't support getting that directly in their API, which is why
I'll look into adding |
Hello,
I was wondering if it's possible to make a knitr cache depend on Box file versions? So, anytime a newer version of a file is available, I want to invalidate the cache and rerun the code block when knitting. Also, for files in a folder that I am merging into a single data frame, I want to check if any of the files in the folder has a newer version available and run the code again.
Thanks!
The text was updated successfully, but these errors were encountered: