我有一个数据帧,对于该数据帧中的每一行,我必须进行一些复杂的查找并将一些数据附加到文件中.
dataFrame包含用于生物研究的96孔板中选定孔的科学结果,因此我想做类似的事情:
for (well in dataFrame) {
wellName <- well$name # string like "H1"
plateName <- well$plate # string like "plate67"
wellID <- getWellID(wellName, plateName)
cat(paste(wellID, well$value1, well$value2, sep=","), file=outputFile)
}
Run Code Online (Sandbox Code Playgroud)
在我的程序世界中,我会做类似的事情:
for (row in dataFrame) {
#look up stuff using data from the row
#write stuff to the file
}
Run Code Online (Sandbox Code Playgroud)
这样做的"R方式"是什么?