Это просто с tidyverse
...
library(dplyr)
library(stringr)
df <- text %>% #assumes your text is a single character string
str_split("-----") %>% #split at -----
unlist() %>% #unlist
str_trim() %>% #trim spaces
enframe(name = NULL) %>% #convert to dataframe (tibble) - one column called value
mutate(ID = str_extract(value, "^\\d+"), #first digits
Name = str_trim(str_match(value, "-- (.+?) \\(")[,2]), #between -- and (
Age = as.numeric(str_match(value, "\\((\\d+)")[,2]), #digits after (
Gender = str_match(value, "(M|F)\\)")[,2], #MF before )
Location = str_trim(str_match(value, "\\) (.+?)\\n")[,2]), #after ) to end line
Creat = as.numeric(str_match(value, "Ratio =\\s+([\\.0-9]+)")[,2]),
Glucose = as.numeric(str_match(value, "Glucose =\\s+([\\.0-9]+)")[,2]),
Height = as.numeric(str_match(value, "Height =\\s+([\\.0-9]+)")[,2])) %>%
filter(!is.na(ID)) %>% #remove final blank row
select(-value) #remove original text
df
ID Name Age Gender Location Creat Glucose Height
1 4 Elmo857 Jaskolski867 10 M Brockton, Massachusetts 13.1 65.4 145.
2 3 Lan153 Kris249 14 F South Hadley, Massachusetts 0.79 67.1 157.