I have many text files of tables, 300 rows long and 5 columns across. I can import all the files together as they're all named similarly. I would like to average column 2 of every file together, element by element. Meaning, I want one list of 300 numbers. I keep averaging the whole individual column together, and not the elements from each different column. I might have up to several hundred files, so I'm trying to automate this as much as possible.
- The Overflow Blog
-
-
- Featured on Meta
-
-
Related
Hot Network Questions
- Effective resistance of a finite grid of resistor
- What is the convention for slurs and word extensions when chorus is singing on sustained vowel or consonant sound?
- SF book series about a wandering space monk called Brother Paul
- Origin of the Popular Distinction Between Morals and Ethics
- How to change the color of the individual squares on a chessboard?
- Was 2023 the first time a person in California was killed in a black bear attack?
- How much storage space do I really have?
- In Isaiah 42:19, is the “servant” described as spiritually blind referring to Jesus, or to Israel? How should Christians understand this passage?
- Shimano xtr wh-m959 wheel
- When was the last time U.S. Congress overrode a president's veto?
- Polkit actions spawn authorization dialogs without prior user action
- Are there any general expectations for the outputs of a deterministic process?
- How to test i.i.d. assumption?
- Most efficient discrete log algorithm for RFC3526 primes?
- Induced Topological Vector Space Structure?
- Can military personnel disobey illegal orders under U.S. law?
- Producing the sums outside of the 3x3 Magic Square
- Trying to install floating sink but plumbing between studs prevents usual wood backing. What are my options?
- How to resize ext4 without adding more inodes?
- Three-cushion billiards challenge.
- Why didn't Yitzchak ask Rivka to say that she is his sister in the same fashion that Avraham did?
- How to automatically refresh or reload Import CSV node data?
- Were Biblical “Servants” Essentially Slaves?
- What is this infrared receiver part on Philips 55PUK6400 TV module "715G7074-R01-000-004Y"
lang-mma
(Mean[Import[#,"Data"]][[All,2]])& /@ FileNames[...]$\endgroup$(t1 = Table[ConstantArray[i, 10], {i, 15}]) // TableForm. Each column comes from one file. ThenMean /@ t1would give you the mean across each row at a time that (I think) you want. $\endgroup$Mean /@ Rest@t1will drop the first row. $\endgroup$Mean[Rest@Import[#, {"Data", All, 2}] & /@ files](wherefilesis your list of file names) $\endgroup$