I have 30 csv-files, named 101.csv, 102.csv etc. with four columns each, but with a varying number of rows. My intention is to calculate the mean and the median value of the fourth column in each csv file.
I started by making a ListofDataFrames with:
listOfDataframes <- lapply(paste0(101:130, ".csv"), read.csv)
It looks like this:
[[1]]
1 contig02534_1_120507-bin0\t477\t585\t50
2 contig02534_1_120507-bin0\t585\t2695\t0
3 contig06975_1_120507-bin0\t0\t732\t100
...
[[2]]
...
I would like to end up with one new data table summarizing 1) the mean value of column four and 2) the median value of column four. And this would need to be for each data frame separately, like this for instance:
mean median
[[1]] 75 50
[[2]] 65 100
I have tried different approaches posted here but can't get them to work as I want. Any help would be highly appreciated!