I want to add a row to an existing data frame (or tibble) of mixed column types that contains only characters for each 'column'. This is how I got it to work, which should be good enough but it seems that this should be easier.
df is representative of a more complicated data frame that I have previously created.
df <- read_csv("12, 34, 10\n10, 29, 14", col_names = c("part_1", "part_2", "part_3")) c_name <- colnames(df) info <- read_csv("blue, green, small\n0,0,0", col_names = c_name) %>% filter(part_1 > 0) results <- data.table::rbindlist(list(info, df))
Which does generate the correct output:
part_1 part_2 part_3 blue green small 12 34 10 10 29 14
But like I said, it seems to me that there should be an easier way to do this staying within the tidyverse. When I tried this by using bind_rows I got the error :
"Error in bind_rows_(x, .id) : Can not automatically convert from character to integer in column "part_1".