12345678910111213141516171819202122232425262728293031323334 |
- mydat_aclew <- read.csv(paste0('../data_output/', 'aclew','_metrics_scaled.csv'))
- mydat_aclew <- mydat_aclew[is.element(mydat_aclew$experiment, corpora),]
- read.csv("../input/aclew_md.csv")->x
- x$labname[x$labname=="ROW"]<-"luc"
- x$labname[x$labname=="SOD"]<-"win"
- x$ch_id=paste(tolower(x$labname),as.character(x$child_level_id))
- x$n_of_siblings<-x$number_older_sibs
- x$ch_id[x$labname %in% c("BER")] = paste(tolower(x$labname[x$labname %in% c("BER")]),as.numeric(as.character(x$child_level_id[x$labname %in% c("BER")])))
- x=x[!duplicated(x$ch_id),]
- mydat_aclew$lab=substr(mydat_aclew$experiment,1,3)
- mydat_aclew$ch_id=paste(mydat_aclew$lab,gsub(".* ","",mydat_aclew$child_id))
- mydat_aclew$ch_id[mydat_aclew$experiment=="warlaumont"]=gsub(" 0"," ",mydat_aclew$ch_id[mydat_aclew$experiment=="warlaumont"])
- mydat_aclew$ch_id[mydat_aclew$experiment=="winnipeg"]=gsub(" C"," CW",mydat_aclew$ch_id[mydat_aclew$experiment=="winnipeg"])
- #sort(factor(mydat_aclew$ch_id[mydat_aclew$experiment=="winnipeg"]))
- #sort(x$ch_id[x$lab=="win"])
- #sum(mydat_aclew$ch_id %in% x$ch_id)
- #sum(x$ch_id %in% mydat_aclew$ch_id)
- metadata=x[,c("ch_id","n_of_siblings")]
- read.csv("../input/quechua_md.csv")->x
- x$ch_id=paste("que",x$child_id)
- metadata=rbind(metadata,x[,c("ch_id","n_of_siblings")])
- mydat2=merge(mydat_aclew,metadata,all.x=T,by="ch_id")
- #table(mydat2$n_of_siblings,mydat2$experiment)
- mydat2$sib_presence=ifelse(mydat2$n_of_siblings!=0,"present","absent")
- write.csv(mydat2[,c("age_s","n_of_siblings","sib_presence","experiment","child_id","voc_dur_och_ph")],"../data_output/dat_sib_ana.csv",row.names=F)
|