R code used at VAPMS Selected Applications of Mathematical Statistics, summer semester 2018/2019.

Class 1 (Feb 14 2019)

raw data (air pollution and temperature at Ostrava-Českobratrská during 24 hour period on Sep 20 2015)
pm25 <- c(5, 5, 7, 8, 9, 10, 8, 6, 6, 6, 6, 10, 11, 11, 13, 12, 12, 15, 14, 12, 11, 12, 14, 13) 
temp <- c(10, 10, 10, 10, 10, 10, 10, 8.5, 8.5, 8.5, 7, 6.5, 6.5, 7, 7, 7, 8, 6, 5.5, 5.5, 5.5, 4, 4, 5.5)
plot (temp, pm25)

Displaying histogram of pm25:
1st way:
hhist <- function (v)
{
	u <- unique(sort(v));
	n <- length(u);
	d <- rep (0, times=length(u));
	for (i in (1:n))
	{
		for (val in v)
		{
			if (val == u[i])
			{
				d[i] <- d[i] + 1;
			}
		}
	}
	plot (u,d, lwd=10, type="h");
}
2nd way:
u <- unique(sort(pm25));
n <- length(u);
d <- rep (0, times=length(u));
for (i in (1:n))
{	
	d[i] = sum(pm25 == u[i]);
}	
plot (u,d, lwd=10, type="h")
3rd way: hist (pm25)


Created: Wed Sep 30 2015
Last modified: Thu Feb 14 17:00:18 CET 2019