I have 7 of two different asc
files loaded into R, asc[i]
and wasc[i]
, [i]
denotes that there are 1:7 ascs
and wascs
loaded into R. I need to combine the wasc[i]
with the asc[i][[1]]
(Just the first column in asc[i]
with the whole wasc[i]
file).
This should be repeated for every pair of asc
and wasc
files.
The code keeps giving me blank data frames, so I don't know why this doesn't work. The naming is correct, yet the code is not recognizing that the asc[i]
and wasc[i]
correlate with previously loaded files.
Any help will be greatly appreciated.
# These data frames will reproduce my issue
asc1 <- data.frame(x= c(rep("A.tif", 20)), y = 1:20)
wasc1 <- data.frame(x= c(rep("B.tif", 20)), y = c(rep("Imager",20)))
asc2 <- data.frame(x= c(rep("A.tif", 20)), y = 1:20)
wasc2 <- data.frame(x= c(rep("B.tif", 20)), y = c(rep("Imager",20)))
asc3 <- data.frame(x= c(rep("A.tif", 20)), y = 1:20)
wasc3 <- data.frame(x= c(rep("B.tif", 20)), y = c(rep("Imager",20)))
for (i in 1:3) {
d <- paste("asc", i, sep ="")
f <- paste("wasc", i, sep ="")
full_wing <- as.character(paste("full_wing", i, sep = ""))
assign(full_wing,cbind(d[[1]], f))
}
# Output of full_wing1 data frame
dput(full_wing1)
structure(c("asc1", "wasc1"), .Dim = 1:2, .Dimnames = list(NULL,
c("", "f")))
Additional Information:
- asc files are 19 columns long
- wasc files are 13 columns long
I only want to combine column 1 from the asc
file with the entire wasc
file, thus cutting out the remaining 18 columns of the asc
file.