28
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 Character Exercise
12
Lecture: Loops in R
13
Loops in R, Part I
14
Conditionals in R
15
Loops in R, Part II
16
Functions
17
R Functions Excercise
18
Tidyverse
19
R Tidyverse Exercise
20
R Recoding Reshaping Exercise
21
R Merging Exercise
22
R Graphics Exercises
23
R Reordering Exercise
24
R Exploratory Data Analysis Exercise
25
Interactive Graphics
26
GRanges Exercise
27
Data Cleaning Exercise
28
Questions about R
29
R gotchas
30
Basic Shell Commands
31
Unix Basics
32
Unix Streams, Pipes, Scripts
33
Slurm script settings
34
Unix Data Manipulation
35
Unix Miscellaneous
36
Genetic Data in R and GDS
37
Summary
References
Appendices
A
Technical Details
B
WebR - R in the web browser
C
JSLinux terminal
D
webLinux terminal
Table of contents
28.1
Adding a new column to a data frame
28
Questions about R
28.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)
27
Data Cleaning Exercise
29
R gotchas