I'm looking for a way to loop through a list of variables that are data and bind them into a single data frame, this will allow me to store the data in the script rather than a separate file. Below is my unsuccessful attemp where I'm now sure what function I need to use to get variable prefixed with "p" to be recognised correctly in the loop.
# Data
p1 <- c(518458.9470, 6479704.947, 1890.820847)
p2 <- c(518480.0626, 6479701.156, 1890.193591)
p3 <- c(518499.0065, 6479711.374, 1886.774569)
# Create data frame
for (i in 1:3){
if (i = 1){
d <- paste0("p",i)
}else{
df <- rbind(df, paste("p",i))
}
}