26
Questions about R
HuGen2071 book
Preface
1
Preparation
2
Introduction
3
Logistics
4
Active Learning and Readings
5
GitHub
6
Git Commands
7
Lecture: R Basics
8
R Basics Group Exercise
9
Lecture: R: factors, subscripting
10
R Character Exercise
11
Lecture: Loops in R
12
Loops in R, Part I
13
Conditionals in R
14
Loops in R, Part II
15
Functions
16
R Functions Excercise
17
Tidyverse
18
R Tidyverse Exercise
19
R Recoding Reshaping Exercise
20
R Merging Exercise
21
R Graphics Exercise
22
R Reordering Exercise
23
R Exploratory Data Analysis Exercise
24
GRanges Exercise
25
Data Cleaning Exercise
26
Questions about R
27
R gotchas
28
Basic Shell Commands
29
Summary
References
Appendices
A
Technical Details
B
WebR - R in the web browser
C
JSLinux terminal
D
webLinux terminal
Table of contents
26.1
Adding a new column to a data frame
26
Questions about R
26.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)
25
Data Cleaning Exercise
27
R gotchas