Code

mail@pastecode.io avatar
unknown
r
7 months ago
1.3 kB
0
Indexable
Never
varlist2 <- c("temp", "tempny", "människan", "människanny", "stop", "stopny", "gåföre", "gåföreny")
meanlist <- c(mean(DAT2009$temperaturej), mean(DAT2019$tempny), mean(DAT2009$människan), mean(DAT2019$människany), mean(DAT2009$stop), mean(DAT2019$stopny), mean(DAT2009$gåföre), mean(DAT2019$gåföreny))
difframe <- data.frame(a=c(mean(DAT2009$temperaturej),mean(DAT2009$människan),mean(DAT2009$stop),mean(DAT2009$gåföre)),b=c(mean(DAT2019$tempny),mean(DAT2019$människany),mean(DAT2019$stopny),mean(DAT2019$gåföreny)))
diff1 <- data.frame(abs(c(0,0.0482128013300083-0.0668002672010688,
                 0, 0.942227763923524-0.953239812959252,
                 0, 0.105153782211139-0.146292585170341,
                 0, 0.819201995012469-0.758183032732131)))
colnames(diff1) <- "Difference"

atitude <- data.frame(
  "Variabel"=varlist2, "Mean values"=meanlist, Col3=diff1, Encoding() stringsAsFactors = FALSE
)

library(tableHTML)
tableHTML(atitude, collapse="separate", spacing = 4,
          border = 1, caption="This table is a summary of the atitudes over two time-series datasets with differences between the two") %>%
  add_css_row(css = list('background-color', '#f2f2f2'),
              rows = odd(1:9)) %>%
  add_css_row(css = list('background-color', '#e6f0ff'),
              rows = even(1:9))