I have two lists of data frames, such that data is a list of 47 data frames, where each data frame has columns [coords, x, y, liklihood, x.1, x.2, liklihood.1, etc.] and dataA is a list of 47 data frames each of the same length as those in data, but with fewer columns [coords, x, y] that represent different coordinates.
I want to create a third list, or add a column to each data frame in one of the lists, that will contain the distance calculation from pointDistance(p1, p2) where p1 is the x and y columns of each data frame in list data, and p2 is the x and y columns of each data frame in list dataA.
I am trying to keep the dataframes in lists rather than having 47*2 individual data frames in my global environment.
Minimal Reproducible Example:
coords <- rnorm(10)
x <- rnorm(10)
y <- rnorm(10)
liklihood <- rnorm(10)
x.1 <- rnorm(10)
y.1 <- rnorm(10)
day1 <- data.frame(coords,x,y,liklihood,x.1,y.1)
coords <- rnorm(10)
x <- rnorm(10)
y <- rnorm(10)
liklihood <- rnorm(10)
x.1 <- rnorm(10)
y.1 <- rnorm(10)
day2 <- data.frame(coords,x,y,liklihood,x.1,y.1)
data <- list(day1,day2)
coords <- rnorm(10)
x <- rnorm(10)
y <- rnorm(10)
liklihood <- rnorm(10)
day1 <- data.frame(coords,x,y,liklihood)
coords <- rnorm(10)
x <- rnorm(10)
y <- rnorm(10)
liklihood <- rnorm(10)
day2 <- data.frame(coords,x,y,liklihood)
dataA <- list(day1,day2)