I tried to use your solution, (I don't need multiple graphs on one screen, thanks) but got this error:
Error: data must be a data frame, or other object coercible by fortify(), not a list
I tried:
big.dataframe <- as.data.frame(splitByHUCs)
but that didn't work. I used str and got this:
List of 20
$ bcc1_45Fall_1020004 :Classes ‘data.table’ and 'data.frame': 55 obs. of 3 variables:
..$ HUC8 : chr [1:55] "bcc1_45Fall_1020004" "bcc1_45Fall_1020004" "bcc1_45Fall_1020004" "bcc1_45Fall_1020004" ...
..$ YEAR : int [1:55] 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 ...
..$ RO_MM: num [1:55] 112 244 233 190 200 ...
..- attr(*, ".internal.selfref" )=<externalptr>
$ bcc1_M_45Fall_1020004 :Classes ‘data.table’ and 'data.frame': 55 obs. of 3 variables:
..$ HUC8 : chr [1:55] "bcc1_M_45Fall_1020004" "bcc1_M_45Fall_1020004" "bcc1_M_45Fall_1020004" "bcc1_M_45Fall_1020004" ...
..$ YEAR : int [1:55] 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 ...
..$ RO_MM: num [1:55] 101 132 255 282 172 ...
..- attr(*, ".internal.selfref") =<externalptr>
$ bnuesm_45Fall_1020004 :Classes ‘data.table’ and 'data.frame': 55 obs. of 3 variables:
..$ HUC8 : chr [1:55] "bnuesm_45Fall_1020004" "bnuesm_45Fall_1020004" "bnuesm_45Fall_1020004" "bnuesm_45Fall_1020004" ...
..$ YEAR : int [1:55] 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 ...
..$ RO_MM: num [1:55] 89 89.5 126.8 194.3 198.7 ...
..- attr(*, ".internal.selfref")=<externalptr>
etc.
I don't know what it's telling me, in terms of what I need to do. It seems to be telling me it IS a dataframe, no?
I also tried :
bigdata <- bind_rows(datalist)
> splitByHUCs <- split(bigdata, f = bigdata$HUC8 , sep = "\n", lex.order = TRUE)
> colnames(splitByHUCs) <- c("HUCs", "YEAR", "RO_MM")
And got:
Error in colnames<-(*tmp*, value = c("HUCs", "YEAR", "RO_MM")) :
attempt to set 'colnames' on an object with less than two dimensions
So apparently my initial code (above) is bringing in the csvs and making them into a list and I need it to make them into a dataframe. Is there a way to do this?