【发布时间】:2021-01-17 12:25:49
【问题描述】:
【问题讨论】:
【问题讨论】:
这是基于您的示例的尝试:
# read in the original file
x = readLines("example_mixed_dataset.txt")
# break it into two pieces based on the first occurrence of the word "Index"
# and write to two separate files
index = grep("Index", x)
writeLines(x[1:(index - 1)], "file1.txt")
writeLines(x[index:length(x)], "file2.txt")
此代码显然未经测试,因为我无法在您发布的文件图片上进行测试。如果有问题,请将示例数据以文本形式发布,不要以图片形式发布,否则无法调试。
【讨论】: