How to generate a variable that only contain the "name" of legislators who mentioned "health insurance"? #1
-
I want to generate a variable that identifies "legislators' names" who have mentioned "health insurance" from the get_parlquestions(). Does anyone know how to do it? There is a pattern in the "item" from the get_parlquestions(). `question_8 <- get_parlquestions(term = 8) df <- onlydf_not_onlyfan[str_detect(onlydf_not_onlyfan[["item"]], "健康保險", negate = FALSE),] df<- as.data.frame(df) str_extract(regexpr("本院", df$item), df$item) |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
library(legisTaiwan) question_8 <- get_parlquestions(term = 8) x <- df$item |> df["legislators"] <- x
A tibble: 14 × 2legislators item |
Beta Was this translation helpful? Give feedback.
😉