Skip to content
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

[188559300]: add fork examples #657

Merged
merged 1 commit into from
Jan 14, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions R/fork-and-merge.R
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,18 @@
#' folder as the existing dataset.
#' @return The new fork, a `CrunchDataset`.
#' @seealso [mergeFork()]
#' @examples
#' \dontrun{
#' # Defaults to being placed in the same project folder as the original dataset
#' ds_fork <- forkDataset(ds)
#'
#' # But you can specify a project by path, `ProjectFolder` object or URL
#' ds_fork2 <- forkDataset(ds, project = "/Client1/forks/")
#' ds_fork3 <- forkDataset(ds, project = projects()[["My forks"]])
#' ds_fork4 <- forkDataset(ds, project = "https://app.crunch.io/api/projects/abc")
#' }
#' @export
forkDataset <- function(dataset, name = defaultForkName(dataset), draft = FALSE, ..., project = folder(dataset)) {

Check warning on line 43 in R/fork-and-merge.R

View workflow job for this annotation

GitHub Actions / test-coverage

file=R/fork-and-merge.R,line=43,col=101,[line_length_linter] Lines should not be more than 100 characters. This line is 114 characters.
## TODO: add owner field, default to self(me())
fork_url <- crPOST(shojiURL(dataset, "catalogs", "forks"),
body = toJSON(wrapEntity(name = name, is_published = !draft, ..., project = resolveProjectURL(project)))
Expand Down
11 changes: 11 additions & 0 deletions man/forkDataset.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading