在这个测验应用中,我想避免重复问题。共有十个类别,每个类别有17个问题。我试图使用一个存储所选问题编号的数组。
如何让library(gsubfn)
examples <- c(
"* Bullet 1\n* Bullet 2\n* Bullet 3",
"1. Bullet 1\n2. Bullet 2\n3. Bullet 3",
"* This is a test 1\n* This is a test with some *formatting*\n* This is a test with different _formatting_"
)
strapply(examples, '(?:\\*|\\d+\\.) *([^\n]+)', c, simplify = c)
# [1] "Bullet 1"
# [2] "Bullet 2"
# [3] "Bullet 3"
# [4] "Bullet 1"
# [5] "Bullet 2"
# [6] "Bullet 3"
# [7] "This is a test 1"
# [8] "This is a test with some *formatting*"
# [9] "This is a test with different _formatting_"
成为先前未存储在数组中的数字?现在它不起作用..
QuestionSelected