2 + 2
[1] 4
0. RefreshR
visual
with source
)
editor: source
TRUE
/FALSE
)
TRUE + TRUE
CTRL + SHIFT + C
)()
; e.g. mean()
)class()
?mean
or clicking on the function and pressing F1
c()
[1] 3 4 5
Warning
mylist[]
returns a list, while mylist[[]]
returns the element itself
c()
|>
, with CTRL + SHIFT + M
%>%
: Tools -> Global Options -> Code -> Native Pipe Operatormtcars
, iris
install.packages()
tidyverse
1 and easystats
2 are actually collections of packageslibrary()
pkg::fun()
Tip
It is good practice to explicitly mention a function’s package when using it, e.g. dplyr::select()
, especially when using less popular functions.
ggplot2
is the main R package for data visualizationggplot()
+
x=Sepal.Length
, not x="Sepal.Length"
)
ggplot()
are inherited by the layersWarning
Misnomer: do NOT confuse arguments that are “aesthetics” in aes()
(i.e., map variable names to aesthetic features) with arguments that control the appearance of the plot (not in aes()
)
1:10
1 + "1"
returns an error. Why?c()
and list()
?True * 3
return?TRUE / 10
return?ggplot(iris, aes(x="Sepal.Length", y="Petal.Length"))
but it throws an error. Why?ggplot(iris, aes(x=Sepal.Length, y=Petal.length))
but it throws an error. Why?mutate(data, x = 3)
but it says Error in mutate(x) : could not find function "mutate"
. Why?Thank you!