Description Usage Arguments Examples
These functions verify and attempt to coerce values into the specified types and shapes. If they are unsuccessful in the coercion, an error is thrown.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 | cast_integer(x, n = NULL, allow_na = FALSE, allow_null = FALSE,
  id = NULL, return_id = FALSE)
cast_scalar_integer(x, allow_na = FALSE, allow_null = FALSE,
  id = NULL, return_id = FALSE)
cast_nullable_integer(x, n = NULL, allow_na = FALSE, id = NULL,
  return_id = FALSE)
cast_nullable_scalar_integer(x, allow_na = FALSE, id = NULL,
  return_id = FALSE)
cast_integer_list(x, n = NULL, allow_na = FALSE, allow_null = FALSE,
  id = NULL, return_id = FALSE)
cast_nullable_integer_list(x, n = NULL, allow_na = FALSE, id = NULL,
  return_id = FALSE)
cast_double(x, n = NULL, allow_na = FALSE, allow_null = FALSE,
  id = NULL, return_id = FALSE)
cast_scalar_double(x, allow_na = FALSE, allow_null = FALSE,
  id = NULL, return_id = FALSE)
cast_nullable_double(x, n = NULL, allow_na = FALSE, id = NULL,
  return_id = FALSE)
cast_nullable_scalar_double(x, allow_na = FALSE, id = NULL,
  return_id = FALSE)
cast_double_list(x, n = NULL, allow_na = FALSE, allow_null = FALSE,
  id = NULL, return_id = FALSE)
cast_nullable_double_list(x, n = NULL, allow_na = FALSE, id = NULL,
  return_id = FALSE)
cast_character(x, n = NULL, allow_na = FALSE, allow_null = FALSE,
  id = NULL, return_id = FALSE)
cast_scalar_character(x, allow_na = FALSE, allow_null = FALSE,
  id = NULL, return_id = FALSE)
cast_nullable_character(x, n = NULL, allow_na = FALSE, id = NULL,
  return_id = FALSE)
cast_nullable_scalar_character(x, allow_na = FALSE, id = NULL,
  return_id = FALSE)
cast_character_list(x, n = NULL, allow_na = FALSE,
  allow_null = FALSE, id = NULL, return_id = FALSE)
cast_nullable_character_list(x, n = NULL, allow_na = FALSE,
  id = NULL, return_id = FALSE)
cast_string(x, allow_na = FALSE, allow_null = FALSE, id = NULL,
  return_id = FALSE)
cast_nullable_string(x, allow_na = FALSE, id = NULL,
  return_id = FALSE)
cast_string_list(x, n = NULL, allow_na = FALSE, allow_null = FALSE,
  id = NULL, return_id = FALSE)
cast_nullable_string_list(x, n = NULL, allow_na = FALSE, id = NULL,
  return_id = FALSE)
cast_logical(x, n = NULL, allow_na = FALSE, allow_null = FALSE,
  id = NULL, return_id = FALSE)
cast_scalar_logical(x, allow_na = FALSE, allow_null = FALSE,
  id = NULL, return_id = FALSE)
cast_nullable_logical(x, n = NULL, allow_na = FALSE, id = NULL,
  return_id = FALSE)
cast_nullable_scalar_logical(x, allow_na = FALSE, id = NULL,
  return_id = FALSE)
cast_logical_list(x, n = NULL, allow_na = FALSE, allow_null = FALSE,
  id = NULL, return_id = FALSE)
cast_nullable_logical_list(x, n = NULL, allow_na = FALSE, id = NULL,
  return_id = FALSE)
cast_choice(x, choices, allow_na = FALSE, allow_null = FALSE,
  id = NULL, return_id = FALSE)
 | 
| x | A vector. | 
| n | The required length of the vector. If  | 
| allow_na | Whether to allow  | 
| allow_null | Whether to allow  | 
| id | Name given to the input to aid the user in identifying the bad value. | 
| return_id | Whether to return the ID as an attribute. This should only be set to  | 
| choices | A character, numeric, or integer vector of allowed values. | 
| 1 2 3 4 5 6 7 8 | # Cast a double vector to integer
cast_integer(c(1, 2))
# Cast a numeric to a string
cast_string(4.5)
# Cast an integer vector to a list of doubles
cast_double_list(1:4)
 | 
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.