Ich habe einige Textzeichenfolgen, aus denen ich bestimmte Informationen extrahieren möchte. Insbesondere möchte ich die Bewertung von 10 aus extrahieren.R regex extract rating von 10 aus string
Ich würde Hilfe gerne in eine Funktion func_to_extract_rating
Konstruktion, die die folgenden ...
text_string_vec <- c('blah$2.94 blah blah 3/10 blah blah.',
'foo foo 8/10.',
'10/10 bar bar21/09/2010 bar bar',
'jdsfs1/10djflks5/10.')
func_to_extract_rating <- function(){}
output <- lapply(text_string_vec,func_to_extract_rating)
output
[[1]]
[1] 3 10
[[2]]
[1] 8 10
[[3]]
[1] 10 10
[[4]]
[[4]][[1]]
[1] 1 10
[[4]][[2]]
[1] 5 10
'y <- regmatches (text_string_vec, gregexpr ('\\ d +/10', text_string_vec)); Rapply (y, strsplit, split = '/', wie = 'Liste') ' – rawr