Re: [R] How to aggregate values in corresponding dataframes

2019-03-25 Thread lily li
Each dataframe is a gridded file, so I want to add the values at corresponding grid cells from all the dataframes. On Mon, Mar 25, 2019 at 6:22 PM Rui Barradas wrote: > Sorry, I forgot to ask something. > > When you say you want to add the df's values, what exactly do you mean? > All of the valu

Re: [R] How to aggregate values in corresponding dataframes

2019-03-25 Thread Rui Barradas
Sorry, I forgot to ask something. When you say you want to add the df's values, what exactly do you mean? All of the values, by row, by column, what? Rui Barradas Às 10:20 de 25/03/2019, Rui Barradas escreveu: Hello, Maybe something like this? Note that you *never* need to set header = FALS

Re: [R] How to aggregate values in corresponding dataframes

2019-03-25 Thread Rui Barradas
Hello, Maybe something like this? Note that you *never* need to set header = FALSE, it already is the default of read.table. You would have to with read.csv. old_dir <- setwd("~/directory") f1990 <- list.files(pattern = "^199.*\\.txt$") r1990 <- lapply(f1990, read.table) setwd(old_dir) Hope

[R] How to aggregate values in corresponding dataframes

2019-03-25 Thread lily li
Hi R users, I have multiple dataframes in a directory, and with the same postfix ".txt". Each dataframe is a gridded file with just values, but each value represents one grid cell. There are many years, and each year has 12 months, so there are many such files. For each year, I want to read the co