I have a dataframe, and for each row in that dataframe I have to do some complicated lookups and append some data to a file.
The dataFrame contains scientific results for selected wells from 96 well plates used in biological research so I want to do something like:
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)
}
In my procedural world, I'd do something like:
for (row in dataFrame) {
#look up stuff using data from the row
#write stuff to the file
}
What is the "R way" to do this?
Question&Answers:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…