我如何在R读取多个二进制文件? [英] How do I read multiple binary files in R?
问题描述
假设我们有一个文件夹file1.bin文件,file2.bin,......,而在目录çfile1460.bin:\\ r \\数据,我们要阅读并做出了一个循环来从1到4并取平均值,然后从4至8的平均等直到1460.in末尾将获得360文件
我试图让他们在一个列表中,但不知道如何让循环。
我如何读取多个文件和manupulat呢?中的R语言的结果
我一直在浪费了无数的心爱的马以figuer它out.any帮助
结果片剂; - 阵列(变暗= 360)
为(ⅰ在1:360){
结果片剂特征 - 平均值(yourlist [[(我* 4):(我* 4 + 3)]])
}
因人而异的平均值(yourList)调用,但结构会怎样,你可以通过数据一次循环它的加载。
Suppose we have files in one folder file1.bin, file2.bin, ... , and file1460.bin in directory C:\R\Data and we want to read them and make a loop to go from 1 to 4 and take the average then from 4 to 8 average and so on till 1460.in the end will get 360 files I tried to have them in a list,but did not know how to make the loop.
How do I read multiple files and manupulat them? in R language
I have been wasting countless hourse to figuer it out.any help
results <- array(dim=360)
for (i in 1:360){
results <- mean(yourlist[[(i*4):(i*4+3)]])
}
YMMV with the mean(yourList) call, but that structure would be how you could loop through the data once it's loaded.
这篇关于我如何在R读取多个二进制文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!