I have a for loop that looks like this
for (j in c("Month_1", "Month_2", "Month_3", "Month_4")) {
r <- ggplot(df_tableAcc[df_tableAcc$j > 100,]) +
aes_string(x = "ShipSog") +
geom_bar()
print(r)
}
Where the column names in df_tableAcc is "Month_1", "Month_2", "Month_3", "Month_4".
How can I use the "[df_tableAcc$j > 100," ?
I keep getting this error:
Warning: Unknown or uninitialised column:
j
. Error: Must subset rows with a valid subscript vector. i Logical subscripts must match the size of the indexed input. x Input has size 1852 but subscriptdf_tableAcc$j > 100
has size 0.