In [1]:
?runif
Freitextsuche
In [2]:
??"Cumulative Distribution Function"
In [3]:
library(ggplot2)
Installieren
In [4]:
#install.packages("name")
In [5]:
variable1 <- 1
print(variable1)
Auch Datenvektoren
In [6]:
variable.zwei <- c(1, 2, 2.5, 100)
print(variable.zwei)
Erzeugung von Vektoren
In [7]:
v.drei <- 1:10
In [8]:
v4 <- seq(1, 10, 0.5)
In [9]:
c(v.drei, 1, 0, v4)
In [10]:
rep(v4, times = 3)
In [11]:
1 + 1
In [12]:
1 - 1
In [13]:
1 * 2
In [14]:
1 / 2
In [15]:
2 ** 2
In [16]:
2 ^ 2
In [17]:
sqrt(2)
In [18]:
sin(2)
In [19]:
cos(2)
In [20]:
1:12 %% 2 # Modulo
In [21]:
1:12 %/% 5 # Ganzzahlige Division
In [22]:
# Kommentare
In [23]:
0/0
In [24]:
x <- NA # missing value
is.na(x)
In [25]:
objects()
In [26]:
ls()
In [27]:
rm(v.drei)
rm(list=ls())
In [28]:
(1:3) ** 2
In [29]:
x <- c()
print(x)
In [30]:
vector(mode="numeric")
In [31]:
numeric(0)
In [32]:
(1:5) > 2
In [33]:
1 == 2
In [34]:
(1:4) + (4:1)
In [35]:
(1:4) + (1:2)
In [36]:
crossprod((1:3), (1:3))
In [37]:
(1:3) %*% (1:3)
In [38]:
min(runif(n = 10))
In [39]:
# maximale Ergebnis aus drei Wuerfelwuerfen mit einem
# sechseitigen Wuerfel
max(sample(x = 1:6, replace = TRUE, size=3))
In [40]:
sum(1:10)
In [41]:
cumsum(1:10) # Kumulative Summe
In [42]:
sort(sample(x = 1:6, replace = FALSE, size=6), decreasing = TRUE)
In [43]:
mean(1:10) # Mittelwert
In [44]:
var(runif(1000)) # Varianz
In [45]:
floor(c(1, 1.5, 2.3, 4.1))
In [46]:
ceiling(pi)
In [47]:
mean((1:floor(sqrt(1000)))**2)