'Apply smoothing (get.smooth, smooth.spline)

Data set looks like this head(tcata.df) X NJ stimulus factor_attribute time_0s time_1s time_2s time_3s time_4s time_5s time_6s time_7s time_8s time_9s time_10s time_11s 1 1 1 1 Beadiness 0 0 0 0 0 0 0 0 0 0 0 0 2 2 2 1 Beadiness 0 0 0 0 0 0 0 0 0 0 0 0 3 3 3 1 Beadiness 0 0 0 0 0 0 0 0 0 0 0 0 4 4 4 1 Beadiness 0 0 0 0 0 0 0 0 0 0 0 0 5 5 5 1 Beadiness 0 0 0 0 0 0 0 1 1 1 1 0 6 6 6 1 Beadiness 0 0 0 0 0 0 0 0 0 0 0 0 time_12s time_13s time_14s time_15s time_16s time_17s time_18s time_19s time_20s time_21s time_22s time_23s time_24s time_25s 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 3 0 0 0 0 0 0 0 0 0 0 0 0 0 0 4 0 0 0 0 0 0 0 0 0 0 0 0 0 0 5 0 0 0 0 0 0 0 0 0 0 0 0 0 0 6 0 0 0 0 0 0 0 0 0 0 0 0 0 0 time_26s time_27s time_28s time_29s time_30s 1 0 0 0 0 0 2 0 0 0 0 0 3 0 0 0 0 0 4 0 0 0 0 0 5 0 0 0 0 0 6 0 0 0 0 0 The code I am using to generate curve is tcata3_count <- citation.counts(tcata.df, product.name = "1", product.col = 3, attribute.col = 4,results.col = 5:35, comparison = "other") the rest of the plot code plot1 <- tcata.line.plot(tcata3_count$P1, n = tcata3_count$Pn, attributes = attributes, times = times, line.col = palettes$pal, reference = tcata3_count$ref, ref.lty = 3, declutter = tcata3_count$declutter, highlight = TRUE, highlight.lwd = 4, highlight.col = palettes$pal.light, height = 7, width = 11, legend.cex = 0.7, main = NULL) When I try to apply smoothing, nothing will work for me. There is no example in tempR and I have read get.smooth and smooth.spline, the latter is hard to follow. the rest of the plot code plot1 <- tcata.line.plot(tcata3_count$P1, n = tcata3_count$Pn, attributes = attributes, times = times, line.col = palettes$pal, reference = tcata3_count$ref, ref.lty = 3, declutter = tcata3_count$declutter, highlight = TRUE, highlight.lwd = 4, highlight.col = palettes$pal.light, height = 7, width = 11, legend.cex = 0.7, main = NULL)



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source