order trajectory .dcd files
Issue #320
resolved
I have use list.files to read in multiple .dcd files as suggested. Thanks!
However, the files are in alphabetical order, instead of the time order as they were generated. Examples below:
a100ns.dcd, a150ns.dcd, a50ns,dcd etc...
How to reorder the read in files, in this case it should be: a50ns.dcd, a100ns.dcd, a150ns.dcd, so that the afterwards analysis will not messup the time and the frame.
Any input is appreciate. thanks!!
Nancy
Comments (3)
-
-
reporter Thanks a lot!!
Will try,
A beginner to R as well ☺
Nancy
-
- changed status to resolved
- Log in to comment
Hi,
Instead of listing files under a directory, you can also manually make a vector of file names, which may be easier to generate in the order you want. For example,
files <- paste('a', seq(50, 150, 50), 'ns.dcd', sep='')
. This will generate a vector of 'a50ns.dcd', 'a100ns.dcd' and 'a150ns.dcd'. You can generate a longer vector using similar method. Check out paste() and seq() in R, which can help you a lot in daily scripting. Hope it helps.