I'm trying to extract the first word of that name, but I'm not able to because R is not recognizing whitespace.
library(stringr)
name <- x[76,3]
name
[1] "Byrsonima crispa A.Juss."
word(name,1)
[1] "Byrsonima crispa A.Juss."
str_count(name," ")
[1] 0
CodePudding user response:
You need to specify white space as Regex pattern:
str_count("Byrsonima crispa A.Juss.", "\\s")
#[1] 2