I have a large dataset (14295,58). Each column is a different element from the periodic table (e.g. Fe, Ca, Zr) and the rows are arranged according to depth (in mm); the last column is the depth value. I am trying to make a code that can be customized to a given group of elements over a given depth interval but I don't want to have to go through and change a bunch of lines of code everytime I look at a different subset. So far I have created a dataframe called Section:
Section <- df[50:100,]
and a vector called Elements:
Elements <- c("Fe", "Ca", "Zr")
I can subsample the Section data frame by:
Section %>%
select(., Elements, depth)
but now I want to plot this with ggplot and I can't figure out how to call the Elements vector to the x-variable. I tried:
Section %>%
select(., Elements, depth) %>%
ggplot() +
geom_path (aes(Elements, depth))
but the arguments don't have the same length. How can I plot the selected elements from the Elements vector?