ul.1B
f = seq(0,100,by = 5)
for (i in 1:21) {
if(f[i] < 50)
{f[i] = f[i] + 1}
print(f[i])
}
for (i in 1:21) {
if (f[i] == 50)
{f[i] = 50*0}
print(f[i])
}
for (i in 1:21) {
if(f[i] >= 50)
{f[i] = f[i] - 1}
print(f[i])
}
-------------------------------------------------------------
ul.2B
getwd()
dir.create("Zapocet2")
setwd("C:/Users/Sára/Documents/Zapocet2")
fileURL = "
odkaz
download.file(fileURL, destfile = "./books.xml")
install.packages("...........")
doc = xmlTreeParse(fileUrl,useInternal=TRUE)
root = xmlRoot(doc)
xmlName(root)
root[[2]]
xpathSApply(root,"//price",xmlValue)
-------------------------------------------------------------
ul.3B
set.seed(20)
tabulka = data.frame(a=rep(c("a","b"),each=10),b = rnorm(20),c = seq(1, 100,by = 5), d = 1:20)
tabulka
tabulka[[3]][1] = NA
tabulka[[3]][5] = NA
tabulka[[3]][10] = NA
tabulka
lapply(tabulka$d,quantile,probs = seq(0,0.48,0.56))
#colSums(tabulka, tabulka$b,tabulka$c,tabulka$d)
#quantile(tabulka$d,c(0,0.48,0.56))
colSums(tabulka[,2:4])
tabulka[(which(tabulka$c != is.na(c))),mean(c)] #nejde
any(is.na(tabulka$c))
sort(tabulka$b)
tabulka[,E:=b^2] #nejde
-------------------------------------------------------------
ul.4B
library(datasets)
par(mfrow = c(2, 1), mar = c(4, 4, 2, 1))
hist(CO2$conc, col = "Green", main = "Conc", breaks = 4)
hist(CO2$uptake, col = "Blue",,breaks = 40, xlab = "up", ylab = "take", main = "Uptake")
legend(x="topright", legend = levels(CO2$uptake)) #nejde
install.packages("ggplot2")
library(ggplot2)
qplot(uptake, age, data = CO2, col = Type) #nejde