【发布时间】:2021-05-12 06:23:47
【问题描述】:
我需要一些对我来说有点困难但对于 R 专家程序员来说很容易的东西。我需要使用数据框中包含的信息来迭代我的脚本。 数据框类似于
pdb range
1 1a7s_A 78:81
2 1b9o_A 50:53
3 1b9o_A 99:102
4 1bkr_A 27:30
5 1c0p_A 1179:1182
6 1c75_A 42:45
我需要为每一行迭代我的脚本
pdb <- read.pdb("1a7s_A.pdb") ## here I need to read my pdb file
pdb <- atom.select(pdb, resno = 78:81, verbose = T, value = T) ## here I have to put the value in range col
... #my script instruction
table <- data.frame("pdb" = "1a7s_A", ## here I have to insert the name file again
"res" = "78:81", ## here the range
"omega2" = omega2, "phi2" = phi2, "psi2" = psi2,
"omega3" = omega3, "phi3" = phi3, "psi3" = psi3)
最后,我需要一个包含每个文件迭代的所有信息的 df。
我确定我会将包含所有要读取的文件的目录设置为工作目录。谢谢!
【问题讨论】:
标签: r dataframe loops iteration