2.2 Basic Data Management in R - Knowing and Subsetting Data
2nd of 4 videos on basic data management in R. This video focuses on exploring datasets in R and basic data manipulation such … source

seen from United States
seen from United States
seen from Malaysia

seen from United States

seen from United States
seen from China
seen from China
seen from China
seen from United States
seen from Greece
seen from Australia
seen from United States
seen from United States

seen from Malaysia
seen from United States
seen from China

seen from Germany

seen from United States
seen from United States

seen from United States
2.2 Basic Data Management in R - Knowing and Subsetting Data
2nd of 4 videos on basic data management in R. This video focuses on exploring datasets in R and basic data manipulation such … source
#Progress I thought https://github.com/Mpdreamz/shellprogressbar was funny (nested). Used it, good! But look at this progress indication in #Jailer. A tool for database #subsetting, schema and data browsing. Ralf Wisser did a fantastic job. 10 years in development. Comprehensible. Will report more soon. http://jailer.sourceforge.net https://www.instagram.com/p/Bowrh2lhyZr4diX7KR7ehxbcV5q8XMRu5Zmrs80/?utm_source=ig_tumblr_share&igshid=vakud6y9tf0i
fontprep - The missing font generator for Mac OSX.
Fontprep est l’outil idéal (sur Mac) pour générer des webfonts légères, en restreignant le jeu de caractères utilisé (subsetting).
Missing Indices
OOB stands for index out of bounds
[[]] and [] differ in their behavior when index is OOB
if a data frame (z) is entered: z<-data.frame(x=1:5,y=6:10)
if an atomic vector (a) is entered: a<-1:15
check the length of your object: (i.e. the # of indices)
> length(z) [1] 2
>length(z$x)
[1] 5
>length(z$y)
[1] 5
>length(c(z$x,z$y))
[1] 10
> length(a) [1] 15
now try to extract an object outside of these bounds using [[]] and []
> z[3] Error in `[.data.frame`(z, 3) : undefined columns selected
> z[[3]] Error in .subset2(x, i, exact = exact) : subscript out of bounds
> a[16] [1] NA
> a[[16]] Error in a[[16]] : subscript out of bounds
Subsetting: Data Frames
> DATA FRAMES
(if you only have 1 var in the data frame, treated like a list--with 2 or more vectors, df behaves like matrix)
Taken directly from site: How many of your friends complain regularly about their bodies? ~None: 147 ~A few: 411 ~Some: 188 ~Most: 141 ~All: 53
construct an object that reflects it:
> body_complain<-data.frame(x=c('None','A few','Some','Most','All'),y=c(147,411,188,141,53))
object $ title of column
___________________________________________________________
>DATA FRAMES>STRUCTURAL QUALITIES
the structure of data frame subsets are unique
examine the differences using this variable (a)
> a x y z 1 1 1 a 2 2 2 b 3 3 3 c 4 4 4 d
> str(a) 'data.frame': 4 obs. of 3 variables: $ x: int 1 2 3 4 $ y: int 1 2 3 4 $ z: Factor w/ 4 levels "a","b","c","d": 1 2 3 4
Now examine the structural differences which subsetting initiates in data frames
> str(a[c(1)]) 'data.frame': 4 obs. of 1 variable: $ x: int 1 2 3 4
> str(a[,c(1,3)]) 'data.frame': 4 obs. of 2 variables: $ x: int 1 2 3 4 $ z: Factor w/ 4 levels "a","b","c","d": 1 2 3 4
> str(a[c(3),]) 'data.frame': 1 obs. of 3 variables: $ x: int 3 $ y: int 3 $ z: Factor w/ 4 levels "a","b","c","d": 3
To access a subscript of a data frame use $ and []
>a$y[3]
[1] 3
__________________________________________________________
>DATA FRAME > REASSIGNMENT
reassigning data frame elements combines subsets and reassignment and is discussed further in the section: Subsetting and Assignment
Subsetting
brackets [] are known as subsetting
This is an exciting concept that will require an understanding of:
3 subsetting operators
the 6 types of subsetting
behavioral differences among different objects
subsetting with assignment
subsetting ranges from simple processes (atomic vectors) to more complicated using S3 objects and assignment operations