I have a dataset that I'm using in RStudio, and I have the code ggplot(desktop_2015) + geom_point(aes(Month, CV, color = Day), size = 2.5) in order to get a graph that I need.
I am plotting the variable CV by Month, and for each month there are 7 points along the vertical, each a different color representing a level of the variable Day.
What I am trying to do is connect the points for each day across the months, ie a line connecting each Friday point across the 12 months, and so on for each day of the week. I have attached images of what my dataset looks like in addition to the graph I currently have. TIA!
Here's the dput output of my dataset:
structure(list(Year = structure(c(1L, 1L, 1L, 1L, 1L, 1L, 1L,
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L), .Label = c("2015",
"2016", "2017", "2018", "2019"), class = "factor"), Quarter = structure(c(1L,
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
1L, 1L, 1L, 1L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L,
2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 3L, 3L, 3L, 3L, 3L, 3L, 3L,
3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 4L, 4L,
4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L,
4L, 4L, 4L), .Label = c("1", "2", "3", "4"), class = "factor"),
Month = structure(c(1L, 1L, 1L, 1L, 1L, 1L, 1L, 2L, 2L, 2L,
2L, 2L, 2L, 2L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 4L, 4L, 4L, 4L,
4L, 4L, 4L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 6L, 6L, 6L, 6L, 6L,
6L, 6L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 8L, 8L, 8L, 8L, 8L, 8L,
8L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 10L, 10L, 10L, 10L, 10L,
10L, 10L, 11L, 11L, 11L, 11L, 11L, 11L, 11L, 12L, 12L, 12L,
12L, 12L, 12L, 12L), .Label = c("Jan", "Feb", "Mar", "Apr",
"May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"), class = "factor"),
Device = structure(c(1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L
), .Label = c("D", "M", "T"), class = "factor"), Day = structure(c(4L,
2L, 6L, 7L, 5L, 1L, 3L, 4L, 2L, 6L, 7L, 5L, 1L, 3L, 4L, 2L,
6L, 7L, 5L, 1L, 3L, 4L, 2L, 6L, 7L, 5L, 1L, 3L, 4L, 2L, 6L,
7L, 5L, 1L, 3L, 4L, 2L, 6L, 7L, 5L, 1L, 3L, 4L, 2L, 6L, 7L,
5L, 1L, 3L, 4L, 2L, 6L, 7L, 5L, 1L, 3L, 4L, 2L, 6L, 7L, 5L,
1L, 3L, 4L, 2L, 6L, 7L, 5L, 1L, 3L, 4L, 2L, 6L, 7L, 5L, 1L,
3L, 4L, 2L, 6L, 7L, 5L, 1L, 3L), .Label = c("Friday", "Monday",
"Saturday", "Sunday", "Thursday", "Tuesday", "Wednesday"), class = "factor"),
Clicks = c(1479, 1631, 1471, 1382, 1926, 1724, 1928, 1233,
1380, 1164, 1145, 1187, 1082, 1201, 1927, 1825, 1592, 1232,
1225, 1181, 1320, 1437, 1357, 1487, 1769, 1655, 1256, 1318,
1512, 1508, 1358, 1176, 1111, 1364, 1316, 1441, 2131, 1956,
1455, 1431, 1280, 1288, 2106, 2326, 2109, 2474, 2397, 2200,
1721, 2598, 2767, 2112, 2045, 1997, 1771, 2352, 2075, 2441,
2670, 2543, 1973, 1876, 1920, 2206, 2529, 2134, 2000, 2514,
2551, 2758, 3087, 3219, 2314, 2150, 1906, 1997, 2335, 1957,
2272, 2617, 2489, 2199, 1657, 1945), Conversions = c(67,
95, 110, 101, 88, 105, 114, 89, 92, 79, 67, 72, 96, 76, 139,
125, 89, 47, 63, 73, 78, 97, 127, 69, 96, 61, 50, 90, 83,
91, 85, 56, 117, 66, 94, 48, 86, 71, 63, 53, 46, 56, 67,
75, 64, 64, 63, 55, 59, 74, 71, 62, 59, 57, 40, 71, 69, 84,
80, 101, 61, 76, 56, 93, 69, 50, 47, 73, 67, 98, 108, 127,
59, 67, 68, 88, 77, 60, 69, 82, 72, 55, 44, 54), CV = c(9089.21,
7811.24, 13201.19, 11394.8, 12631.15, 12389.61, 11742.6,
10265.62, 12449.76, 9329.68, 8255.08, 9002.71, 13173.41,
6235.05, 15480.72, 17940.65, 13667.19, 5766.98, 7583.03,
6817.59, 6412.43, 10441.66, 23018.46, 9243.69, 10521.5, 15117.06,
5791.93, 7783.52, 8156.31, 9996.18, 12973.64, 6329.24, 20080.53,
6289.64, 10891.91, 7176.93, 10281.64, 10292.1, 10077.85,
9299.89, 5979.86, 6888.64, 6799.56, 13162.34, 10267.85, 10599.65,
8868.4, 7285.48, 8393, 9930.09, 10857.6, 12568.96, 9998.93,
8465.09, 6733.55, 11107.85, 10919.87, 12933.21, 14653.55,
22648.43, 13272.86, 15214.25, 9733.4, 18128.61, 12915.65,
10267.21, 9804.48, 11928.58, 14135.84, 19990.35, 15482.84,
20116.57, 12705.79, 12891.93, 11266.43, 16632.9, 11890.34,
9290.67, 11417.62, 18980.21, 11025.63, 7806.93, 7246.12,
7737.87), `Conv. rate` = c(0.0453, 0.0582, 0.0748, 0.0731,
0.0457, 0.0609, 0.0591, 0.0722, 0.0667, 0.0679, 0.0585, 0.0607,
0.0887, 0.0633, 0.0721, 0.0685, 0.0559, 0.0381, 0.0514, 0.0618,
0.0591, 0.0675, 0.0936, 0.0464, 0.0543, 0.0369, 0.0398, 0.0683,
0.0549, 0.0603, 0.0626, 0.0476, 0.1053, 0.0484, 0.0714, 0.0333,
0.0404, 0.0363, 0.0433, 0.037, 0.0359, 0.0435, 0.0318, 0.0322,
0.0303, 0.0259, 0.0263, 0.025, 0.0343, 0.0285, 0.0257, 0.0294,
0.0289, 0.0285, 0.0226, 0.0302, 0.0333, 0.0344, 0.03, 0.0397,
0.0309, 0.0405, 0.0292, 0.0422, 0.0273, 0.0234, 0.0235, 0.029,
0.0263, 0.0355, 0.035, 0.0395, 0.0255, 0.0312, 0.0357, 0.0441,
0.033, 0.0307, 0.0304, 0.0313, 0.0289, 0.025, 0.0266, 0.0278
), `CV/Click` = c(6.15, 4.79, 8.97, 8.25, 6.56, 7.19, 6.09,
8.33, 9.02, 8.02, 7.21, 7.58, 12.18, 5.19, 8.03, 9.83, 8.58,
4.68, 6.19, 5.77, 4.86, 7.27, 16.96, 6.22, 5.95, 9.13, 4.61,
5.91, 5.39, 6.63, 9.55, 5.38, 18.07, 4.61, 8.28, 4.98, 4.82,
5.26, 6.93, 6.5, 4.67, 5.35, 3.23, 5.66, 4.87, 4.28, 3.7,
3.31, 4.88, 3.82, 3.92, 5.95, 4.89, 4.24, 3.8, 4.72, 5.26,
5.3, 5.49, 8.91, 6.73, 8.11, 5.07, 8.22, 5.11, 4.81, 4.9,
4.74, 5.54, 7.25, 5.02, 6.25, 5.49, 6, 5.91, 8.33, 5.09,
4.75, 5.03, 7.25, 4.43, 3.55, 4.37, 3.98), Impressions = c(86045,
89512, 81503, 81356, 101254, 95972, 100790, 73492, 81709,
71678, 67884, 68429, 61978, 69537, 99440, 99735, 95689, 71773,
71414, 65363, 69422, 77640, 76419, 81980, 97540, 90953, 67780,
68886, 81265, 79079, 70807, 65774, 59298, 72504, 71965, 92817,
132684, 120931, 93380, 89791, 82604, 79651, 121598, 141042,
132627, 167622, 146056, 133295, 103366, 151998, 170043, 142676,
126557, 121835, 121060, 139303, 113975, 127019, 151171, 140981,
110230, 108527, 106218, 123960, 136940, 123136, 120845, 145673,
136340, 144527, 185146, 210133, 157902, 135150, 124981, 132650,
136682, 127909, 156160, 219576, 187283, 143617, 107303, 128768
), Cost = c(1376.23, 1799.57, 1646.93, 1631.22, 2088.67,
1869.83, 1779.56, 1152.91, 1643.25, 1281.38, 1368.1, 1299.16,
1184.99, 1183.82, 1690.38, 2065.43, 1737.26, 1351.85, 1432.21,
1395.46, 1192.53, 1385.88, 1548.41, 1754.96, 2148.9, 2061.52,
1481.82, 1400.12, 1595.65, 1808.54, 1643.06, 1417.31, 1343.52,
1794.69, 1317.59, 1436.56, 2344.1, 2124.41, 1602.12, 1449.17,
1417.73, 1337.39, 1773.49, 2018.75, 1813.7, 2181.56, 2069.48,
1938.4, 1528.46, 1907.15, 2163.95, 1645.47, 1620.2, 1552.78,
1326.68, 1749.51, 1466.75, 1851.91, 1997.14, 1909.85, 1506.9,
1391.86, 1420.54, 1671.03, 1948.89, 1657.35, 1577.12, 1888.6,
1934.2, 2055.61, 2357.6, 2426.16, 1730.51, 1652.82, 1464.03,
1550.73, 1736.98, 1364.01, 1625.97, 1835.38, 1714.8, 1584.55,
1109.67, 1340.77)), row.names = c(2L, 4L, 7L, 12L, 15L, 18L,
19L, 23L, 26L, 28L, 31L, 36L, 38L, 40L, 44L, 47L, 51L, 52L, 57L,
58L, 63L, 64L, 69L, 72L, 74L, 78L, 81L, 82L, 85L, 89L, 92L, 95L,
97L, 100L, 105L, 107L, 111L, 113L, 116L, 119L, 121L, 124L, 127L,
130L, 135L, 136L, 141L, 142L, 147L, 149L, 152L, 154L, 158L, 161L,
163L, 167L, 171L, 174L, 177L, 178L, 181L, 185L, 188L, 191L, 194L,
198L, 201L, 202L, 207L, 208L, 211L, 215L, 218L, 221L, 225L, 228L,
230L, 232L, 236L, 238L, 242L, 246L, 247L, 250L), class = "data.frame")
I think you need to provide both group and color in your aes:
library(ggplot2)
ggplot(df, aes(x = Month, y = CV, color = Day, group = Day))+
geom_point()+
geom_line()
Plotting a dendogram from a agglomerative hierachial clustering does not yield the expected results. I have attached the example of the expected output in the image here . The y axis shows the treatment groups.
My MWE is
library(cluster)
dist<-daisy(cluster, metric = "gower")
kaari <-hclust(dist, method = "ward.D2")
plot(kaari,cex = 0.6, hang = -1)
Here is the data frame:
structure(list(Variety = structure(c(1L, 1L, 1L, 1L, 1L, 1L,
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
1L, 1L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L,
2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L,
2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L,
2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 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 4L, 4L, 4L, 4L, 4L, 1L, 1L, 1L, 1L, 1L, 1L, 3L,
3L, 3L, 3L, 3L, 3L, 2L, 2L, 2L, 2L, 2L, 2L, 4L, 4L, 4L, 4L, 4L,
4L, 1L, 1L, 1L, 1L, 1L, 1L, 3L, 3L, 3L, 3L, 3L, 3L, 2L, 2L, 2L,
2L, 2L, 2L, 4L, 4L, 4L, 4L, 4L, 4L, 1L, 1L, 1L, 1L, 1L, 1L, 3L,
3L, 3L, 3L, 3L, 3L, 2L, 2L, 2L, 2L, 2L, 2L, 4L, 4L, 4L, 4L, 4L,
4L, 1L, 1L, 1L, 1L, 1L, 1L, 3L, 3L, 3L, 3L, 3L, 3L, 2L, 2L, 2L,
2L, 2L, 2L, 4L, 4L, 4L, 4L, 4L, 4L, 1L, 1L, 1L, 1L, 1L, 1L, 3L,
3L, 3L, 3L, 3L, 3L, 2L, 2L, 2L, 2L, 2L, 2L, 4L, 4L, 4L, 4L, 4L,
4L, 1L, 1L, 1L, 1L, 1L, 1L, 3L, 3L, 3L, 3L, 3L, 3L, 2L, 2L, 2L,
2L, 2L, 2L, 4L, 4L, 4L, 4L, 4L, 4L, 1L, 1L, 1L, 1L, 1L, 1L, 3L,
3L, 3L, 3L, 3L, 3L, 2L, 2L, 2L, 2L, 2L, 2L, 4L, 4L, 4L, 4L, 4L,
4L, 1L, 1L, 1L, 1L, 1L, 1L, 3L, 3L, 3L, 3L, 3L, 3L, 2L, 2L, 2L,
2L, 2L, 2L, 4L, 4L, 4L, 4L, 4L, 4L, 1L, 1L, 1L, 1L, 1L, 1L), .Label = c("% fruit damage",
"Intermediate", "Lower", "Upper"), class = "factor"), overall = c(8.33,
15.83, 18.33, 18.33, 16.67, 15.83, 17.5, 15, 14.17, 16.67, 15,
18.33, 6.67, 14.17, 6.67, 15.83, 10, 12.5, 10, 15, 35, 55, 50,
25, 12.5, 11.67, 12.5, 13.33, 15.83, 13.33, 14.17, 10, 11.67,
15.83, 8.33, 10.83, 7.5, 7.5, 10.83, 9.17, 5.83, 5.83, 10, 17.5,
20, 12.5, 20, 5, 18.33, 15, 15, 12.5, 10, 15.83, 20.83, 15.83,
18.33, 10, 11.67, 18.33, 10.83, 6.67, 7.5, 14.17, 6.67, 10.83,
37.5, 17.5, 25, 15, 30, 20, 24.17, 22.5, 16.67, 19.17, 14.17,
24.17, 26.67, 20.83, 16.67, 17.5, 14.17, 20, 12.5, 20.83, 11.67,
6.67, 12.5, 11.67, 55, 55, 55, 60, 55, 57.5, 24.17, 28.33, 19.17,
21.67, 20, 18.33, 24.17, 20.83, 17.5, 15, 16.67, 15, 15, 10.83,
11.67, 16.67, 14.17, 10, 30, 45, 55, 42.5, 55, 37.5, 33.33, 20.83,
20, 17.5, 18.33, 20, 28.33, 13.33, 17.5, 13.33, 20.83, 11.67,
11.67, 10.83, 13.33, 8.33, 8.33, 13.33, 55, 40, 55, 52.5, 45,
45, 12.5, 17.5, 15, 21.67, 17.5, 17.5, 14.17, 14.17, 16.67, 14.17,
19.17, 15, 10.83, 13.33, 6.67, 9.17, 8.33, 13.33, 45, 50, 40,
35, 55, 45, 10.83, 9.17, 23.33, 22.5, 15.83, 11.67, 26.67, 8.33,
20, 12.5, 10.83, 18.33, 9.17, 7.5, 9.17, 7.5, 5.83, 13.33, 37.5,
35, 45, 22.5, 30, 25, 15, 13.33, 20, 13.33, 20, 20, 9.17, 21.67,
12.5, 10, 14.17, 24.17, 10.83, 10, 13.33, 9.17, 11.67, 10.83,
45, 45, 42.5, 30, 55, 40, 11.67, 21.67, 18.33, 16.67, 16.67,
16.67, 14.17, 15, 15.83, 20.83, 12.5, 16.67, 10, 12.5, 9.17,
10, 7.5, 6.67, 27.5, 30, 32.5, 45, 17.5, 25, 15.83, 15.83, 17.5,
13.33, 12.5, 13.33, 13.33, 10.83, 19.17, 12.5, 13.33, 12.5, 7.5,
8.33, 9.17, 5.83, 10.83, 10.83, 47.5, 15, 20, 20, 30, 30, 10,
18.33, 12.5, 11.67, 10.83, 13.33, 13.33, 12.5, 10, 10, 13.33,
15, 6.67, 14.17, 7.5, 7.5, 10.83, 7.5, 22.5, 15, 22.5, 20, 25,
15)), .Names = c("Variety", "Sample.Part", "overall"), class = "data.frame", row.names = c(NA,
-288L))
My first and second columns in my data set are categorical while the third is numeric, I have attached the the data here.
Variety Sample.Part overall
Cal J Lower 8.33
Cal J Lower 15.83
Cal J Lower 18.33
Cal J Lower 18.33
Cal J Lower 16.67
Cal J Lower 15.83
Cal J Intermediate 17.50
Cal J Intermediate 15.00
Cal J Intermediate 14.17
Cal J Intermediate 16.67
Cal J Intermediate 15.00
Cal J Intermediate 18.33
Cal J Upper 6.67
Cal J Upper 14.17
Cal J Upper 6.67
Cal J Upper 15.83
Cal J Upper 10.00
Cal J Upper 12.50
Cal J % fruit damage 10.00
Cal J % fruit damage 15.00
Cal J % fruit damage 35.00
Cal J % fruit damage 55.00
Cal J % fruit damage 50.00
I would like to have the factor levels in the first column appear as leaf nodes in the y axis. Any help?
I am trying to summarize a large set of data with an external function (sii package).
What I need to do is calculate SII for each subject, with each system, at each presentation level.
Example data:
data <- structure(list(Subject = structure(c(1L, 1L, 1L, 1L, 1L, 1L,
1L, 1L, 1L, 1L, 1L, 1L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L,
2L, 2L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 2L, 2L,
2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 1L, 1L, 1L, 1L, 1L, 1L,
1L, 1L, 1L, 1L, 1L, 1L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L,
2L, 2L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 2L, 2L,
2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 1L, 1L, 1L, 1L, 1L, 1L,
1L, 1L, 1L, 1L, 1L, 1L, 2L, 2L, 2L, 2L, 2L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3L, 1L, 1L, 2L, 2L,
3L, 3L, 1L, 1L, 2L, 2L, 3L, 3L, 1L, 1L, 2L, 2L, 3L, 3L, 1L,
1L, 2L, 2L, 3L, 3L, 1L, 1L, 2L, 2L, 3L, 3L, 1L, 1L, 2L, 2L,
3L, 3L, 1L, 1L, 2L, 2L, 3L, 3L, 1L, 1L, 2L, 2L, 3L, 3L, 1L,
1L, 2L, 2L, 3L, 3L, 1L, 1L, 2L, 2L, 3L, 3L, 1L, 1L, 2L, 2L,
3L, 3L, 1L, 1L, 2L, 2L, 3L, 3L, 1L, 1L, 2L, 2L, 3L, 3L, 1L,
1L, 2L, 2L, 3L, 3L, 1L, 1L, 2L, 2L, 3L, 3L, 1L, 1L, 2L, 2L,
3L, 3L, 1L, 1L, 2L, 2L, 3L, 3L, 1L, 1L, 2L, 2L, 3L, 3L, 1L,
1L, 2L, 2L, 3L, 3L, 1L, 1L, 2L, 2L, 3L, 3L, 1L, 1L, 2L, 2L,
3L, 3L, 1L, 1L, 2L, 2L, 3L, 3L), .Label = c("55", "65", "75"
), class = "factor"), Frequency = c(125, 125, 125, 125, 125,
125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125,
125, 125, 125, 125, 125, 125, 125, 160, 160, 160, 160, 160,
160, 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, 160,
160, 160, 160, 160, 160, 160, 160, 200, 200, 200, 200, 200,
200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200,
200, 200, 200, 200, 200, 200, 200, 250, 250, 250, 250, 250,
250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250,
250, 250, 250, 250, 250, 250, 250, 315, 315, 315, 315, 315,
315, 315, 315, 315, 315, 315, 315, 315, 315, 315, 315, 315,
315, 315, 315, 315, 315, 315, 315, 400, 400, 400, 400, 400,
400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400,
400, 400, 400, 400, 400, 400, 400, 500, 500, 500, 500, 500,
500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500,
500, 500, 500, 500, 500, 500, 500, 630, 630, 630, 630, 630,
630, 630, 630, 630, 630, 630, 630, 630, 630, 630, 630, 630,
630, 630, 630, 630, 630, 630, 630, 800, 800, 800, 800, 800,
800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800,
800, 800, 800, 800, 800, 800, 800, 1000, 1000, 1000, 1000,
1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000,
1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000,
1250, 1250, 1250, 1250, 1250, 1250, 1250, 1250, 1250, 1250,
1250, 1250, 1250, 1250, 1250, 1250, 1250, 1250, 1250, 1250,
1250, 1250, 1250, 1250, 1600, 1600, 1600, 1600, 1600, 1600,
1600, 1600, 1600, 1600, 1600, 1600, 1600, 1600, 1600, 1600,
1600, 1600, 1600, 1600, 1600, 1600, 1600, 1600, 2000, 2000,
2000, 2000, 2000, 2000, 2000, 2000, 2000, 2000, 2000, 2000,
2000, 2000, 2000, 2000, 2000, 2000, 2000, 2000, 2000, 2000,
2000, 2000, 2500, 2500, 2500, 2500, 2500, 2500, 2500, 2500,
2500, 2500, 2500, 2500, 2500, 2500, 2500, 2500, 2500, 2500,
2500, 2500, 2500, 2500, 2500, 2500, 3000, 3000, 3000, 3000,
3000, 3000, 3000, 3000, 3000, 3000, 3000, 3000, 3000, 3000,
3000, 3000, 3000, 3000, 3000, 3000, 3000, 3000, 3000, 3000,
3150, 3150, 3150, 3150, 3150, 3150, 3150, 3150, 3150, 3150,
3150, 3150, 3150, 3150, 3150, 3150, 3150, 3150, 3150, 3150,
3150, 3150, 3150, 3150, 4000, 4000, 4000, 4000, 4000, 4000,
4000, 4000, 4000, 4000, 4000, 4000, 4000, 4000, 4000, 4000,
4000, 4000, 4000, 4000, 4000, 4000, 4000, 4000, 5000, 5000,
5000, 5000, 5000, 5000, 5000, 5000, 5000, 5000, 5000, 5000,
5000, 5000, 5000, 5000, 5000, 5000, 5000, 5000, 5000, 5000,
5000, 5000, 6000, 6000, 6000, 6000, 6000, 6000, 6000, 6000,
6000, 6000, 6000, 6000, 6000, 6000, 6000, 6000, 6000, 6000,
6000, 6000, 6000, 6000, 6000, 6000, 6300, 6300, 6300, 6300,
6300, 6300, 6300, 6300, 6300, 6300, 6300, 6300, 6300, 6300,
6300, 6300, 6300, 6300, 6300, 6300, 6300, 6300, 6300, 6300,
8000, 8000, 8000, 8000, 8000, 8000, 8000, 8000, 8000, 8000,
8000, 8000, 8000, 8000, 8000, 8000, 8000, 8000, 8000, 8000,
8000, 8000, 8000, 8000), REM_SPL = c(43.68, 38.85, 51.43,
48.71, 59.22, 58.62, 38.51, 38.45, 48.33, 48.44, 58.18, 58.34,
52.51, 39.6, 58.89, 49.06, 64.63, 58.7, 40.42, 38.81, 49.03,
48.52, 58.3, 58.31, 54.92, 49.44, 62.59, 59.24, 70.32, 68.97,
48.43, 48.19, 58.21, 58.16, 68.17, 67.99, 63.83, 51.47, 68.49,
59.93, 73.25, 69.09, 48.69, 48.3, 58.35, 58.1, 68.19, 68.01,
60.9, 50.42, 68.57, 61.23, 76.59, 71.69, 53.6, 52.7, 63.7,
62.63, 73.63, 72.59, 69.31, 50.73, 73.51, 60.53, 78.59, 71.52,
52.12, 51.55, 62.76, 61.94, 73.15, 72.33, 60.74, 57.26, 68.37,
66.47, 76.5, 75.78, 52.44, 49.21, 62.49, 58.96, 72.44, 69.11,
68.65, 60.55, 72.73, 67.42, 78.12, 75.97, 50.62, 58.85, 58.9,
61.92, 70.33, 68.8, 55.39, 50.46, 62.96, 59.28, 71.08, 68.47,
48.88, 61.78, 58.9, 71.68, 68.8, 80.89, 64.34, 56.79, 68.32,
61.46, 73.3, 68.84, 62.02, 68.72, 68.09, 74.56, 73.49, 80.8,
56.69, 59.3, 64.04, 67.76, 72.05, 76.68, 51.93, 69.98, 61.96,
79.52, 71.84, 88.99, 67, 65.08, 70.76, 70.07, 75.18, 77.28,
71.03, 77.65, 75.63, 82.24, 79.81, 88.9, 51.92, 57.93, 59.21,
66.1, 67.46, 75.01, 56.59, 68.41, 65.69, 77.82, 75.5, 87.89,
63.7, 64.53, 67.67, 69.39, 71.81, 76.13, 69.27, 76.85, 73.64,
81.51, 78.2, 87.85, 48.87, 53.9, 55.78, 61.65, 63.82, 70.4,
58.82, 65.38, 67.34, 74.02, 76.93, 83.84, 61.42, 61.24, 65.35,
65.97, 69.53, 72.23, 68.71, 74.23, 73.86, 79.7, 79.37, 85.62,
48.01, 50.44, 54.41, 57.41, 61.56, 65.25, 55.58, 60.89, 63.1,
68.84, 71.74, 77.46, 60.05, 58.6, 63.73, 62.9, 67.59, 68.1,
66.15, 68.8, 70.82, 74.09, 76.38, 79.82, 47.18, 48.5, 53.45,
55.01, 60.08, 61.96, 50.95, 55.74, 57.98, 63.25, 65.43, 71.02,
59.17, 56.77, 63.17, 61.08, 67.06, 65.64, 62.25, 64.22, 66.68,
69.38, 71.26, 74.48, 45.35, 46.41, 51.51, 52.74, 57.89, 59.15,
49.19, 51.76, 55.54, 58.63, 61.76, 65.99, 57.58, 54.92, 61.84,
59.05, 65.64, 63.46, 61.35, 60.78, 64.83, 65.47, 68.72, 69.57,
46.65, 47.33, 51.94, 53.13, 57.31, 59, 49.36, 51.67, 55.5,
57.69, 60.82, 63.09, 60.43, 56.86, 64.43, 60.78, 68.14, 64.65,
64.16, 60.72, 66.77, 64.85, 70.22, 68.47, 52.05, 52.4, 57.11,
57.74, 62.04, 63.19, 54.05, 54.49, 58.79, 59.71, 62.52, 63.23,
66.43, 61.57, 70.32, 65.49, 73.94, 69.19, 68.14, 62.49, 70.3,
66.13, 72.44, 68.77, 58.81, 58.52, 63.77, 63.85, 68.05, 68.88,
60.06, 60.46, 64.5, 64.38, 67.55, 67.18, 70.69, 66.81, 74.87,
70.92, 78.38, 74.41, 72.09, 66.25, 74.33, 69.39, 76.22, 71.49,
NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,
NA, NA, NA, NA, NA, NA, NA, NA, NA, 60.18, 59.65, 64.79,
64.88, 68.88, 70.03, 67.33, 66.6, 71.46, 71.19, 73.76, 73.17,
69.65, 67.08, 73.98, 71.05, 77.77, 74.67, 75.44, 69.74, 78.49,
73.39, 79.65, 75.22, 58.4, 59.01, 63.43, 64.86, 67.39, 69.91,
68.71, 66.86, 73.05, 75.1, 74.7, 76.83, 65.9, 65.64, 71.34,
70.31, 75.86, 73.99, 71.73, 67.53, 77.7, 75.64, 78.59, 77.33,
58.44, 58.86, 63.4, 64.32, 67.55, 69.36, 66.91, 66.78, 71.71,
75.09, 73.4, 76.7, 66.48, 64.59, 71.47, 68.87, 75.38, 72.33,
68.31, 66.76, 75.47, 75.42, 76.96, 76.82, NA, NA, NA, NA,
NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,
NA, NA, NA, NA, NA, 55.72, 55.8, 60.74, 61.53, 65.31, 66.82,
67.76, 66.76, 71.6, 72.51, 73.49, 74.22, 63.62, 62.1, 68.72,
66.45, 72.44, 69.93, 68.97, 67.19, 75.25, 73, 76.63, 74.49,
52.18, 51.25, 57.97, 57.54, 62.94, 63.07, 67.82, 67.65, 71.4,
72, 73.4, 73.92, 60.18, 58.02, 66.23, 63.48, 70.87, 67.6,
68.92, 68.42, 75.79, 72.7, 77.23, 74.33), Thresh_SPL = c(40,
40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 65, 60, 65, 60,
65, 60, 65, 60, 65, 60, 65, 60, NA, NA, NA, NA, NA, NA, NA,
NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,
NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,
NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, 33, 33, 33, 33,
33, 33, 33, 33, 33, 33, 33, 33, 58, 53, 58, 53, 58, 53, 58,
53, 58, 53, 58, 53, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,
NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,
NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,
NA, NA, NA, NA, NA, NA, NA, NA, 34.6, 34.6, 34.6, 34.6, 34.6,
34.6, 34.6, 34.6, 34.6, 34.6, 34.6, 34.6, 59.6, 54.6, 59.6,
54.6, 59.6, 54.6, 59.6, 54.6, 59.6, 54.6, 59.6, 54.6, NA,
NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,
NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,
NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,
NA, NA, 35, 30, 35, 30, 35, 30, 35, 30, 35, 30, 35, 30, 50,
50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, NA, NA, NA, NA,
NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,
NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,
NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, 44.6,
44.6, 44.6, 44.6, 44.6, 44.6, 44.6, 44.6, 44.6, 44.6, 44.6,
44.6, 69.6, 59.6, 69.6, 59.6, 69.6, 59.6, 69.6, 59.6, 69.6,
59.6, 69.6, 59.6, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,
NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, 72.5,
77.5, 72.5, 77.5, 72.5, 77.5, 72.5, 77.5, 72.5, 77.5, 72.5,
77.5, 87.5, 77.5, 87.5, 77.5, 87.5, 77.5, 87.5, 77.5, 87.5,
77.5, 87.5, 77.5, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,
NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, 76.5,
81.5, 76.5, 81.5, 76.5, 81.5, 76.5, 81.5, 76.5, 81.5, 76.5,
81.5, 96.5, 81.5, 96.5, 81.5, 96.5, 81.5, 96.5, 81.5, 96.5,
81.5, 96.5, 81.5, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,
NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, 77.5,
82.5, 77.5, 82.5, 77.5, 82.5, 77.5, 82.5, 77.5, 82.5, 77.5,
82.5, 82.5, 77.5, 82.5, 77.5, 82.5, 77.5, 82.5, 77.5, 82.5,
77.5, 82.5, 77.5, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,
NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, 94,
104, 94, 104, 94, 104, 94, 104, 94, 104, 94, 104, 104, 89,
104, 89, 104, 89, 104, 89, 104, 89, 104, 89)), row.names = c(NA,
-504L), class = "data.frame")
The sii function takes several arguments:
sii(speech = speech, threshold = threshold, freq = frequency, method = "one-third octave", interpolate = T)
I want to fix the freq argument as:
freq = c(125, 250, 500, 1000, 2000, 3150, 4000, 6300, 8000)
One particularly difficult part is that I need to subset the speech and threshold arguments on slightly different values of Frequency:
For speech: c(125, 250, 500, 1000, 2000, 3150, 4000, 6300, 8000)
For threshold: c(125, 250, 500, 1000, 2000, 3000, 4000, 6000, 8000)
The other arguments need to be calculated based on the grouping. What I have tried so far doesn't work:
library(tidyverse)
library(sii)
data %>%
group_by(Subject, Ear, System, Pres_Level) %>%
summarize(SII = sii(speech = . %>%
filter(Frequency %in% c(125, 250, 500, 1000, 2000, 3150, 4000, 6300, 8000)) %>%
pull(REM_SPL),
threshold = . %>%
filter(Frequency %in% c(125, 250, 500, 1000, 2000, 3000, 4000, 6000, 8000)) %>%
pull(Thresh_SPL),
freq = frequency, method = "one-third octave", interpolate = T))
Error in sii(speech = . %>% filter(Frequency %in% c(125, 250, 500, 1000, :
`speech' must have the same length as `freq'.
Trying to maintain grouping for the arguments:
data %>%
select(-REM_Level) %>%
filter(Frequency >= 125, Frequency <= 8000) %>%
group_by(Subject, Ear, System, Pres_Level) %>%
mutate(Speech = tibble(REM_SPL) %>%
filter(Frequency %in% c(125, 250, 500, 1000, 2000, 3150, 4000, 6300, 8000))) %>%
pull(REM_SPL)),
threshold = tibble(Thresh_SPL) %>%
filter(Frequency %in% c(125, 250, 500, 1000, 2000, 3000, 4000, 6000, 8000) %>%
pull(Thresh_SPL))) %>%
mutate(SII = sii(speech = speech, threshold = threshold, freq = c(125, 250, 500, 1000, 2000, 3000, 4000, 6000, 8000),
method = "one-third octave", interpolate = T))
Error in mutate_impl(.data, dots) :
Column `Speech` is of unsupported class data.frame
I have attempted using some nested loops, but that hasn't worked at all.
My desired output is something like this (these are fake SII values):
Subject System Pres_Level SII
1 1 A 55 0.65
2 1 B 55 0.60
3 1 C 55 0.60
4 1 A 65 0.70
5 1 B 65 0.75
6 1 C 65 0.80
7 1 A 75 0.76
8 1 B 75 0.78
9 1 C 75 0.74
10 2 A 55 0.55
11 2 B 55 0.58
12 2 C 55 0.57
13 2 A 65 0.74
14 2 B 65 0.72
15 2 C 65 0.82
16 2 A 75 0.80
17 2 B 75 0.82
18 2 C 75 0.76
19 3 A 55 0.58
20 3 B 55 0.62
21 3 C 55 0.64
22 3 A 65 0.74
23 3 B 65 0.76
24 3 C 65 0.78
25 3 A 75 0.80
26 3 B 75 0.76
27 3 C 75 0.74
Can anyone suggest how I might achieve what I'm looking for?
I believe this is what you're looking for... One thing you need to look out for is what sii returns (an object of length 10 and not a vector length 1). You need to further extract the SII value from the result, hence sii(...)$sii in the summarize call.
After edit with the new data:
data %>%
group_by(Subject, Ear, System, Pres_Level) %>%
summarize(SII = sii(speech = REM_SPL[Frequency %in% c(125, 250, 500, 1000, 2000, 3150, 4000, 6300, 8000)],
threshold = Thresh_SPL[Frequency %in% c(125, 250, 500, 1000, 2000, 3000, 4000, 6000, 8000)],
freq = Frequency[Frequency %in% c(125, 250, 500, 1000, 2000, 3150, 4000, 6300, 8000)],
method = "one-third octave",
interpolate = T)$sii)
# A tibble: 24 x 5
# Groups: Subject, Ear, System [?]
Subject Ear System Pres_Level SII
<fct> <fct> <fct> <fct> <dbl>
1 1 Left A 55 0.788
2 1 Left A 65 0.782
3 1 Left A 75 0.759
4 1 Left B 55 0.806
5 1 Left B 65 0.774
6 1 Left B 75 0.742
7 1 Right A 55 0.749
8 1 Right A 65 0.749
9 1 Right A 75 0.737
10 1 Right B 55 0.765
# ... with 14 more rows