R: How can I extract an element from a column of data in spark connection (sparklyr) in pipe
- 阅读更多 关于 R: How can I extract an element from a column of data in spark connection (sparklyr) in pipe
问题 I have a dataset as below. Because of its large amount of data, I uploaded it through the sparklyr package, so I can use only pipe statements. pos <- str_sub(csj$helpful,2) neg1 <- str_sub(csj$helpful,4) csj <- csj %>% mutate(neg=replace(helpful,stringr::str_sub(csj$helpful,4)==1,0)) csj <- csj %>% mutate(help=pos/neg) csj is.null(csj$helpful) I want to make a column named 'help' which is 'the first number of helpful column/2nd number of helpful column'. If the 2nd number is 0, I need to