Entering edit mode
5.1 years ago
j.lunger18
▴
30
Trying to make a new dataframe with a subset of columns in an existing dataframe. This worked for me before, not sure what's going wrong now...
**head(mt_coding_variants[1:3])
# A tibble: 6 x 3
POS ID REF
<int> <chr> <chr>
1 119606751 rs751351167 A
2 119606751 rs751351167 A
3 119606751 rs751351167 A
4 119606751 rs751351167 A
5 119609095 rs747135103 C
6 119609095 rs747135103 C
> x <- select(mt_coding_variants, mt_coding_variants$REF)
Error: Unknown columns `A`, `A`, `A`, `A`, `C` and ...
Call `rlang::last_error()` to see a backtrace.
> rlang::last_error()
<error/rlang_error>
Unknown columns `A`, `A`, `A`, `A`, `C` and ...
Backtrace:
1. dplyr::select(mt_coding_variants, mt_coding_variants$REF)
2. dplyr:::select.data.frame(mt_coding_variants, mt_coding_variants$REF)
3. tidyselect::vars_select(tbl_vars(.data), !!!enquos(...))
4. tidyselect:::vars_select_eval(.vars, quos)
5. purrr::map_if(ind_list, is_character, match_strings, names = TRUE)
6. purrr::map(.x[sel], .f, ...)
7. tidyselect:::.f(.x[[i]], ...)
8. tidyselect:::bad_unknown_vars(vars, unknown)**
Or use base subset: