1 #include "vctrs.h"
2 #include "cast.h"
3 #include "ptype2.h"
4 #include "type-data-frame.h"
5 #include "utils.h"
6
7 // [[ include("vctrs.h") ]]
tib_ptype2(const struct ptype2_opts * opts)8 SEXP tib_ptype2(const struct ptype2_opts* opts) {
9 SEXP out = PROTECT(df_ptype2(opts));
10
11 Rf_setAttrib(out, R_ClassSymbol, classes_tibble);
12
13 UNPROTECT(1);
14 return out;
15 }
16
17 // [[ register() ]]
vctrs_tib_ptype2(SEXP x,SEXP y,SEXP x_arg_,SEXP y_arg_)18 SEXP vctrs_tib_ptype2(SEXP x, SEXP y, SEXP x_arg_, SEXP y_arg_) {
19 struct vctrs_arg x_arg = vec_as_arg(x_arg_);
20 struct vctrs_arg y_arg = vec_as_arg(y_arg_);
21
22 const struct ptype2_opts opts = {
23 .x = x,
24 .y = y,
25 .x_arg = &x_arg,
26 .y_arg = &y_arg
27 };
28
29 return tib_ptype2(&opts);
30 }
31
32 // [[ include("type-tibble.h") ]]
tib_cast(const struct cast_opts * opts)33 SEXP tib_cast(const struct cast_opts* opts) {
34 SEXP out = PROTECT(df_cast_opts(opts));
35
36 Rf_setAttrib(out, R_ClassSymbol, classes_tibble);
37
38 UNPROTECT(1);
39 return out;
40 }
41
42 // [[ register() ]]
vctrs_tib_cast(SEXP x,SEXP to,SEXP x_arg,SEXP to_arg)43 SEXP vctrs_tib_cast(SEXP x, SEXP to, SEXP x_arg, SEXP to_arg) {
44 struct vctrs_arg c_x_arg = vec_as_arg(x_arg);
45 struct vctrs_arg c_to_arg = vec_as_arg(to_arg);
46
47 const struct cast_opts opts = {
48 .x = x,
49 .to = to,
50 .x_arg = &c_x_arg,
51 .to_arg = &c_to_arg
52 };
53
54 return tib_cast(&opts);
55 }
56