# Add column to metadata named "categorical" redefining age groups # copy your metadata file with `scp` from server to local computer # Replace with your names or values library(tidyverse) # define filename metadata_file <- "dog_metadata.txt" # load tsv file dat <- read_tsv(metadata_file) # convert given variable to new variable with 3 groups # : from 0 to smaller than # : from up to but excluding # : from up to `Inf` dat <- mutate(dat, categorical = cut(age_years, breaks = c(0, 3.9, 6.9, Inf), labels = c("Group 1", "Group 2", "Group 3"))) # Save new dataset write_tsv(dat, "age-grouped-metadata.txt") # copy your `.txt` to the server, place it in your data folder # and use it instead of the old metadata file (command outlined in Script#0)