31
Questions about R
HuGen2071 book
Preface
1
Preparation
2
Introduction
3
Logistics
4
Artificial Intelligence
5
Active Learning and Readings
6
GitHub
7
Git Commands
8
Lecture: R Basics
9
R Basics Group Exercise
10
Lecture: R: factors, subscripting
11
R Factors Exercise
12
R Subsetting Exercise
13
Lecture: R Character Manipulation
14
R Character Exercise
15
Lecture: Loops in R
16
Loops in R, Part I
17
Conditionals in R
18
Loops in R, Part II
19
Functions
20
R Functions Excercise
21
Tidyverse
22
R Tidyverse Exercise
23
R Recoding Reshaping Exercise
24
R Merging Exercise
25
R Graphics Exercises
26
R Reordering Exercise
27
R Exploratory Data Analysis Exercise
28
Interactive Graphics
29
GRanges Exercise
30
Data Cleaning Exercise
31
Questions about R
32
R gotchas
33
Basic Shell Commands
34
Unix Basics
35
Unix Streams, Pipes, Scripts
36
Slurm script settings
37
Unix Data Manipulation
38
Unix Miscellaneous
39
Genetic Data in R and GDS
40
Summary
References
Appendices
A
Technical Details
B
WebR - R in the web browser
C
JSLinux terminal
D
webLinux terminal
Table of contents
31.1
Adding a new column to a data frame
31
Questions about R
31.1
Adding a new column to a data frame
Which of these is an
incorrect
way to add a new column to a data frame in R?**
df <- cbind(df, new_column3 = c(1, 2, 3, 4))
new_column(df) <- c(1, 2, 3, 4)
df$new_column <- c(1, 2, 3, 4)
df[, 'new_column'] <- c(1, 2, 3, 4)
30
Data Cleaning Exercise
32
R gotchas