'Not getting the correct output with this R script
I have once again thrown myself into learning R. However, I'm not sure if my data is formatted wrong or if I'm missing a key point.
The vision is to compare all samples against each other over time. However, nailing the code has proved difficult. I can't seem to get time on the x-axis and the samples to match and overlap. I have looked at what feels like 100 videos and web pages. Still can't work this in.
Script:
Data2 <- Data3 %>%
gather( key = "test", value = "value", c(-Name))
Data2 %>%
ggplot() +
geom_point(aes(x=value, y=test)) +
ylab("Film type") +
theme(legend.position="none") +
xlab("Time")
Name = c("2% No wash No cure 20gm", "3 % no wash no cure 20 gm", "4 % no wash no cure 20 gm", "2 % no cure just wash 20 gm", "3 % no cure just wash 20gm", "4 % no cure just wash 20 gm", "3 % cure + wash 20 gm", "4%cure+wash 20gm")
Data:
structure(list(Name = c(0, 15, 30, 45, 60, 75, 90, 105, 120,
135, 150, 165, 180), `2% No wash No cure 20gm` = c(0.0499999999999998,
0.0800000000000001, 0.13, 0.23, 0.56, 0.61, 0.54, 0.54, NA, NA,
NA, NA, NA), `3 % no wash no cure 20 gm` = c(0.0200000000000005,
0.04, 0.0700000000000003, 0.350000000000001, 0.42, 0.36, 0.36,
0.350000000000001, NA, NA, NA, NA, NA), `4 % no wash no cure 20 gm` = c(0.0499999999999998,
0.0899999999999999, 0.12, 0.18, 0.655, 0.649999999999999, 0.62,
0.62, NA, NA, NA, NA, NA), `2 % no cure just wash 20 gm` = c(0.04,
0.0699999999999994, 0.0899999999999999, 0.13, 0.44, 0.64, 0.62,
0.739999999999999, NA, NA, NA, NA, NA), `3 % no cure just wash 20gm` = c(0.04,
0.0999999999999996, 0.0800000000000001, 0.0999999999999996, 0.23,
0.6, 0.919999999999999, 1.42, 1.51, 1.64, NA, NA, NA), `4 % no cure just wash 20 gm` = c(0.0499999999999998,
0.0899999999999999, 0.0999999999999996, 0.12, 0.13, 0.13, 0.2,
0.37, 0.62, 0.86, 1.05, 1.23, 0.899999999999999), `3 % cure + wash 20 gm` = c(0.11,
0.16, 0.17, 0.18, 0.19, 0.2, 0.37, 0.819999999999999, 1.34, 1.62,
1.62, 2.02, 1.53), `4%cure+wash 20gm` = c(0.0600000000000005,
0.11, 0.14, 0.16, 0.17, 0.19, 0.26, 0.680000000000001, 0.87,
1.02, 1.12, 1.29, 1.12)), row.names = c(NA, -13L), class = c("tbl_df",
"tbl", "data.frame"))
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
