Skip to content

Commit

Permalink
added vocab example
Browse files Browse the repository at this point in the history
  • Loading branch information
JohnFranchak committed Jan 7, 2021
0 parents commit f8ac618
Show file tree
Hide file tree
Showing 5 changed files with 108 additions and 0 deletions.
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
.Rproj.user
.Rhistory
.RData
.Ruserdata
13 changes: 13 additions & 0 deletions 259-files-import.Rproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
Version: 1.0

RestoreWorkspace: Default
SaveWorkspace: Default
AlwaysSaveHistory: Default

EnableCodeIndexing: Yes
UseSpacesForTab: Yes
NumSpacesForTab: 2
Encoding: UTF-8

RnwWeave: Sweave
LaTeX: pdfLaTeX
Binary file added data-raw/.DS_Store
Binary file not shown.
52 changes: 52 additions & 0 deletions data-raw/vocab.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
12,12.5,13,13.5,14,14.5,15,15.5,16,16.5,17,17.5,18,18.5,19,19.5,20,20.5,21,21.5,22,22.5,23,23.5,24
book ,dad,,cat,baby,socks/shoes,banana,cheese,shoes,monkey,hello,bear,milk/drink,cleanup,grandpa,mouth,coffee,agua,octopus,(wrist) watch,shower,hyena,heart,singing,top
ball,,,,,dog (animal),llama,turkey,berry,apple,oh no,go,car,that,more,peacock,cup,hide,too,blanket,peanut butter,running,empty,that one,sandal
bye bye,,,,,,,beep,hi,box,night-night,jacket,dinosaur,wow,snack/food,wash,stroller,shark,grandma,face,lemon,potty,the end,over there,make
,,,,,,,,diaper,bubble,fish,,tea,peekaboo,mama,keys,yellow,pasta,spoon,light,button,penis,finger,this one,both
,,,,,,,,teeth,mmmm,lion,,google,trash,cow,broccoli,yogurt,outside,toy,train,spaghetti,stairs,black,wipe,loud
,,,,,,,,uhoh,stick,,,hat,elephant,no,yeah,zebra,circle,lap,towel,back,oatmeal,xylophone,crib,where
,,,,,,,,,sticker,,,cookie,[eating sound],bee,tree,high five,eat,plate,plane,olive,pepper (vegetable),cough,dolphin,lay down
,,,,,,,,,,,,,poop,done,rabbit,(fist) bump,up,tray,people,ice cream,animal,window,letter,walrus
,,,,,,,,,,,,,nose,hippo,tissue,bread,girl,orange (color),frog,rice,art,marker,number,kicking
,,,,,,,,,,,,,bag,gentle,pig,pear,horse,here,soap,pee,mine,drum,goes,shorts
,,,,,,,,,,,,,gentle,owl,bird,cereal,flower,school,mirror,(finger) nail,lip,music,hold,bite
,,,,,,,,,,,,,,thank you,zebra,squirrel,spider,kiwi,read,picture,bless you,spatula,clock,happy
,,,,,,,,,,,,,,racoon,house,pancake,bumblebee,watermelon,wheel,computer,snake,wet,dark,curtain
,,,,,,,,,,,,,,Jonah,paper,cheek,shirt,big,roll (v),guitar,zuchinni,broken,rhino,pork
,,,,,,,,,,,,,,belly,help,sheep,dip,butterfly,bless you,skateboard,woof,move,cap,juice
,,,,,,,,,,,,,,cracker,down,bamba,do it,little,hot,alligator,pocket,clip,everybody,close
,,,,,,,,,,,,,,bib,slide,laundry,away,boat,green,stop,meow,bed,gone,fit
,,,,,,,,,,,,,,wash,open,toes,penguin,fork,red,piece,oink,pepper (spice),garbage,working
,,,,,,,,,,,,,,,yay,cheers,bus,feet,balloon,duckie,roar,vacuum,upside down,ravioli
,,,,,,,,,,,,,,,sleep sack,egg,pants,goose,clap,mail,moo,friend,knife,farm
,,,,,,,,,,,,,,,couch,color,cactus,drink,taco,tortilla,castle,dolphin,please,right there
,,,,,,,,,,,,,,,chicken,chair,hand,towel,sweep,breakfast,crab,count,market,booger
,,,,,,,,,,,,,,,carrot,orange (fruit),,rail,robot,chili,star,noodle,castle,bathroom
,,,,,,,,,,,,,,,cheers,ear,,rock,shopping,tower,alright,green bean,wiggle,(eye) gunk
,,,,,,,,,,,,,,,avocado,exercise,,jumping,tail,tent,snail,blueberry,loud,nectarine
,,,,,,,,,,,,,,,hug,,,glasses,home,brush,(guitar) pick,bike,pajamas,pouch
,,,,,,,,,,,,,,,,,,grape,footloose,page,phone,puzzle,stove,reach
,,,,,,,,,,,,,,,,,,throw,kitchen,kiss,swim,climb,happy,haircut
,,,,,,,,,,,,,,,,,,walk,leaf,park,white,that way,teacher,elbow
,,,,,,,,,,,,,,,,,,hair,table,umbrella,coaster,bug,show,fall down
,,,,,,,,,,,,,,,,,,,boy,pull,[gorilla sound],basket,toast,three
,,,,,,,,,,,,,,,,,,,this,purple,neigh,magnet,upstairs,like
,,,,,,,,,,,,,,,,,,,turn,pillow,baa,kale,plum,excuse me
,,,,,,,,,,,,,,,,,,,get,out,button,time,tiger,barn
,,,,,,,,,,,,,,,,,,,,pink,nurse,tv,dishes,sauce
,,,,,,,,,,,,,,,,,,,,catch,sun,sheet,rooster,dishwasher
,,,,,,,,,,,,,,,,,,,,tomato,panda,got it,sky,all
,,,,,,,,,,,,,,,,,,,,shut,change,shoulder,driving,off
,,,,,,,,,,,,,,,,,,,,,cooking,elbow,found it,on
,,,,,,,,,,,,,,,,,,,,,belly button,family,moon,watch (v)
,,,,,,,,,,,,,,,,,,,,,polar bear,camera,pumpkin,bounce
,,,,,,,,,,,,,,,,,,,,,see,thumb,playground,ice
,,,,,,,,,,,,,,,,,,,,,leopard,swing,push,messy
,,,,,,,,,,,,,,,,,,,,,goat,ride,camel,carpet
,,,,,,,,,,,,,,,,,,,,,sound,fast,napkin,tickle
,,,,,,,,,,,,,,,,,,,,,soft,fox,crayon,cut
,,,,,,,,,,,,,,,,,,,,,cry,play,rocket,pot
,,,,,,,,,,,,,,,,,,,,,floor,two,dry,bottle
,,,,,,,,,,,,,,,,,,,,,,,,new
,,,,,,,,,,,,,,,,,,,,,,,,spicy
,,,,,,,,,,,,,,,,,,,,,,,,spin
39 changes: 39 additions & 0 deletions vocab.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
library(tidyverse)
library(visdat)

ds <- read_csv('data-raw/vocab.csv')
vis_dat(ds)
vis_expect(ds, ~ nchar(.x) > 10)

ds <- pivot_longer(ds, cols = everything(), names_to = "age", values_to = "word")
ds$age <- as.numeric(ds$age)

ds <- ds %>%
arrange(age) %>%
filter(!is.na(word)) %>%
filter(!duplicated(word))

vis_dat(ds)
vis_expect(ds, ~ nchar(.x) > 10)

ds <- ds %>% group_by(age) %>% mutate(n = n()) %>% ungroup()
ds <- ds %>% mutate(item = 1, vocab_size = cumsum(item), item = NULL)

ds %>%
group_by(age) %>%
summarize(vocab_size = max(vocab_size)) %>%
ggplot(aes(x = age, y = vocab_size)) +
geom_line() +
geom_point() +
scale_x_continuous(name = "Age (months)", breaks = seq(12,24,1)) +
ylab("Productive vocabulary size") +
theme_minimal()

ds %>%
group_by(age) %>%
mutate(item = 1, item_by_age = cumsum(item))%>%
ungroup %>%
ggplot(aes(x = age, y = item_by_age, label = word)) +
geom_text(size = 3) +
scale_x_continuous(name = "Age (months)", breaks = seq(12,24,1)) +
theme_minimal()

0 comments on commit f8ac618

Please sign in to comment.