Documentos de Académico
Documentos de Profesional
Documentos de Cultura
l <- c(10:20)
> l[(l<15)]
[1] 10 11 12 13 14
l<15
[1] TRUE TRUE TRUE TRUE TRUE FALSE FALSE FALSE FALSE FALSE FALSE
> l[(TRUE)]
[1] 10 11 12 13 14 15 16 17 18 19 20
>
l[c(TRUE , TRUE, TRUE , TRUE , TRUE ,FALSE, FALSE ,FALSE, FALSE, FALSE, FALSE)]
[1] 10 11 12 13 14
df[,'ID']
[1] 10 20 30 40
> df$ID
[1] 10 20 30 40
> df[,1]
[1] 10 20 30 40
-----
# Create a new vector
quantity <- c(10, 35, 40, 5)
-----------
------
df <-data_frame[order(-data_frame$c3, data_frame$c4),]
--------
print(df_primary)
# A tibble: 5 x 2
ID y
<chr> <dbl>
1 A 5
2 B 5
3 C 8
4 D 0
5 F 9
print(df_secondary)
# A tibble: 5 x 2
ID y
<chr> <dbl>
1 A 30
2 B 21
3 C 22
4 D 25
5 E 29
--------
messy %>% gather("L1(Bj)", "L2 (Ai.Bj)", B1:B4) %>% spread("L1(Bj)", "L2 (Ai.Bj)")
A.i. B1 B2 B3 B4
1 A1 A1.B1 A1.B2 A1.B3 A1.B4
2 A2 A2.B1 A2.B2 A2.B2 A2.B4
3 A3 A3.B1 A3.B2 A3.B3 A3.B4
--
colnames(movies)[colnames(movies) == 'surname'] <- 'name'
----------