Skip to content

Commit

Permalink
cast from data frame to cubble
Browse files Browse the repository at this point in the history
  • Loading branch information
huizezhang-sherry committed Oct 2, 2023
1 parent ef4fd27 commit fb0719f
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 0 deletions.
1 change: 1 addition & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ S3method("names<-",spatial_cubble_df)
S3method("names<-",temporal_cubble_df)
S3method(arrange,spatial_cubble_df)
S3method(arrange,temporal_cubble_df)
S3method(as_cubble,data.frame)
S3method(as_cubble,ncdf4)
S3method(as_cubble,sf)
S3method(as_cubble,sftime)
Expand Down
10 changes: 10 additions & 0 deletions R/as_cubble.R
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,16 @@ as_cubble <- function(data, key, index, coords, ...) {
UseMethod("as_cubble")
}

#' @rdname as_cubble
#' @export
as_cubble.data.frame <- function(data, key, index, coords, ...){
key <- enquo(key)
index <- enquo(index)
coords <- enquo(coords)
as_cubble(as_tibble(data), key = !!key, index = !!index, coords = !!coords)
}


#' @rdname as_cubble
#' @export
as_cubble.tbl_df <- function(data, key, index, coords, ...) {
Expand Down
3 changes: 3 additions & 0 deletions man/as_cubble.Rd

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

0 comments on commit fb0719f

Please sign in to comment.