27
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 Exercises
22
R Reordering Exercise
23
R Exploratory Data Analysis Exercise
24
Interactive Graphics
25
GRanges Exercise
26
Data Cleaning Exercise
27
Questions about R
28
R gotchas
29
Basic Shell Commands
30
Unix Basics
31
Unix Streams, Pipes, Scripts
32
Unix Data Manipulation
33
Unix Miscellaneous
34
Summary
References
Appendices
A
Technical Details
B
WebR - R in the web browser
C
JSLinux terminal
D
webLinux terminal
Table of contents
27.1
Adding a new column to a data frame
27
Questions about R
27.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)
26
Data Cleaning Exercise
28
R gotchas