Creating a col that adds a numeric value based on the order of a character string in R

I have responses where I solicited rankings of issues and the response I have for each individual look like this: structure(list(Rank = "Shifting angler preferences and behaviors;Increasing effort and fishing power;R3 (Recruitment, Retention, and Reactivation);Economic impacts;Climate change;"), row.names = c(NA, -1L), class = "data.frame") I am trying to create a column that gives the numeric… Read More Creating a col that adds a numeric value based on the order of a character string in R

How to insert rows in specific indices of dataframe containing sum of few rows above only in R pipe dplyr

for dataframe below, df <- data.frame(id = c(rep(101, 4), rep(202, 3)), status = c("a","b","c","d", "a", "b", "c"), wt = c(100,200,100,105, 20,22,25), ht = c(5.3,5.2,5,5.1, 4.3,4.2,4.1)) df id status wt ht 1 101 a 100 5.3 2 101 b 200 5.2 3 101 c 100 5.0 4 101 d 105 5.1 5 202 a 20 4.3… Read More How to insert rows in specific indices of dataframe containing sum of few rows above only in R pipe dplyr