Column 1
1 <=
2 <=
3 =
4 <=
5 =
6 >
7 <=
8 =
9 <=
10 =
Column 2
1 0.5
2 0.5
3 8
4 0.5
5 1
6 32
7 0.5
8 1
9 0.5
10 8
I need column 3.
I know this will not work in R, but this is what I want to get.
mutate(if(col1 = "<="){
start <- 0
} else if(col1 = "="){
start <- col2/2
} else if(col1 = ">"){
start <- paste(col2)
})
Data:
structure(list(`col1` = c("<=", "<=", "=", "<=", "=", ">"
), col2 = c("0.5", "0.5", "8", "0.5", "1", "32")), row.names = c(NA,
-6L), class = c("tbl_df", "tbl", "data.frame"))