更新时间:2022-12-08 14:21:32
在这种情况下,我会做类似的事情:
In this case I will do something like:
# Import raw data:
data_raw <- readLines("test.txt")
# find separation line:
id_sep <- which(data_raw=="")
# create ranges of both data sets:
data_1_range <- 4:(id_sep-1)
data_2_range <- (id_sep+4):length(data_raw)
# using ranges and row data import it:
data_1 <- read.csv(textConnection(data_raw[data_1_range]))
data_2 <- read.csv(textConnection(data_raw[data_2_range]))
实际上你的第一个示例集具有不一致的结构,所以 data_1
看起来很奇怪。
Actually your first example set has inconsistent structure so data_1
looks strange.