Errata for Quantitative Corpus Linguistics with R ================================================= p. 11, line 14: "inventory (e.g. the" -> "inventory had to be paraphrased (e.g. the" (thanks to Sung-Hoon Hong for pointing this out to me) p. 15, Table 2: "" -> " widespread" (thanks to Sung-Hoon Hong for pointing this out to me) p. 17, line 2 from bottom: "retorts to" -> "resorts to" (thanks to Sung-Hoon Hong for pointing this out to me) p. 22, first line after first grey block of code: "i.e. smaller-than followed by space." -> "i.e. greater-than followed by space." (thanks to Alexander Perrone for pointing this out to me) p. 33, third line in last grey block of code: ",∙.what=" -> ",∙what=" (thanks to Joseph Sorell for pointing this out to me) p. 38, third line in last grey block of code: "greater•than•9•in•the•" -> "greater•than•8•in•the•" (thanks to Martin Schweinberger for pointing this out to me) p. 40, first line in first grey block of code: "[1]•9•5•2" -> "[1]•9•6•2" (thanks to Martin Schweinberger for pointing this out to me) p. 47, first grey block of code: "read.table(file=...,∙header=F,∙sep="",∙quote="\"‘",∙dec=".",∙row.names,∙na.strings="NA",∙comment.char="#")" -> "read.table(file=...,∙header=F,∙sep="",∙quote="\"‘",∙dec=".",∙row.names=1,∙na.strings="NA",∙comment.char="#")" (thanks to Joseph Sorell for pointing this out to me) p. 48, first grey block of code: ">∙write.table(x,∙file="C:/_qclwr/_outputfiles/03-4-2_df-a.txt"),∙quote=F,∙sep="\t",∙row.names=F)¶" -> ">∙write.table(x,∙file="C:/_qclwr/_outputfiles/03-4-2_df-a.txt",∙quote=F,∙sep="\t",∙row.names=F)¶" (thanks to Joseph Sorell for pointing this out to me) p. 48, second grey block of code: ">∙write.table(x.2,∙file="C:/_qclwr/_outputfiles/03-4-2_df-b.txt"),∙quote=F,∙sep="\t",∙col.names=NA)¶" -> ">∙write.table(x.2,∙file="C:/_qclwr/_outputfiles/03-4-2_df-b.txt",∙quote=F,∙sep="\t",∙col.names=NA)¶" (thanks to Joseph Sorell for pointing this out to me) p. 48, third grey block of code: ",∙sep="\t",∙;comment.char="")¶" -> ",∙sep="\t",∙comment.char="")¶" (thanks to Viola Wiegand for pointing this out to me) # exercise box 3.2 "# (10) Reorder the data frame according to, first, PERSON (ascending), second, NUMBER (alpabetically ascending), and third, PRONOUN (alpabetically ascending)." -> "# (10) Reorder the data frame according to, first, PERSON (ascending), second, NUMBER (alpabetically descending), and third, PRONOUN (alpabetically ascending)." (thanks to Joseph Sorell for pointing this out to me) p. 70, last sentence: "If you want to paste together several vectors of length 1, sep and collapse don't make a difference." -> "If you want to paste together several vectors of length 1, use sep." p. 74, line 2 after last grey block of code: "This list has as many vectors as the data structure that was searched has vectors," -> "This list has as many vectors as the vector that was searched has elements," (thanks to Silvie Cinkova for pointing this out to me) p. 95, third grey block of code: >•strapply(text,•"([a-z]*)i([a-z]*)",•ignore.case=T,•perl=T)¶ [[1]] [1]•"This"••"is"••••"f"••••"rst" -> >•strapply(text,•"[a-z]*i[a-z]*",•ignore.case=T,•perl=T)¶ [[1]] [1]•"This"••"is"••••"first" (i.e., change it to what was listed in the code file, thanks to John Newman and Joseph Sorell for pointing this out to me) p. 96, third grey block of code: >•strapply(text,•"([a-z]*)i([a-z]*)",•c,•ignore.case=T,•perl=T,•backref=-1)¶ -> >•strapply(text,•"([a-z]*)i([a-z]*)",•c,•ignore.case=T,•perl=T,•backref=1)¶ (i.e., change it to what was listed in the code file, thanks to John Newman for pointing this out to me) p. 109, first grey block of code: >•words.list•<-•strsplit(textfile,•"\\W+)•#•the•change•is•the•"+"¶ -> >•words.list•<-•strsplit(textfile,•"\\W+")•#•the•change•is•the•"+"¶ (i.e., change it to what was listed in the code file, thanks to Joseph Sorell for pointing this out to me) p. 117, first block of code, second line: >•sub("([^>].*?)>(.*$)",•"\\2\>\\1",•names(sorted.freq.list),•perl=T) -> >•sub("([^>].*?)>(.*$)",•"\\2\t\\1",•names(sorted.freq.list),•perl=T) (thanks to Joseph Sorell for pointing this out to me) p. 121, last block of code >•all.word.pairs<-unlist(strapply(corpus.file.2,•"•*([^_]+_[^•]+)(?=•([^_]+_[^•]+))",•backref=-2,•(?=•([^_]+_[^•]+)),•paste,•perl=T)) -> >•all.word.pairs<-unlist(strapply(corpus.file.2,•"•*([^_]+_[^•]+)(?=•([^_]+_[^•]+))",•backref=-2,•paste,•perl=T)) (i.e., change it to what was listed in the code file, thanks to John Newman for pointing this out to me) p. 123, third block of code, line 2 file=output.file,•append=T)•#•print•into•file¶ -> file=interim.file,•append=T)•#•print•into•file¶ (thanks to Choongil Yoon for pointing this out to me) p. 140, first grey block of code: >•stops<-starts+unlist(sapply(matches,•attributes))-1¶ -> >•stops<-starts+unlist(sapply(matches,•attributes)[1,])-1¶ # or >•stops<-starts+unlist(sapply(matches,•attr,•"match.length"))-1¶ (this was not an error but gregexpr changed over time. Thanks to Eman Alnafjan for pointing out to me that the old code didn't work anymore) p. 168, third grey block of code: >•"\u0451"•#•Ё:•character•in•Unicode¶ [1]•"Ё" -> >•"\u0451"•#•ё:•character•in•Unicode¶ [1]•"ё" p. 184, lower third: The former probability p to get the obtained result when the null hypothesis H0 is true is the probability to err when accepting H0. -> The former probability p to get the obtained result when the null hypothesis H0 is true is the probability to err when rejecting H0. (thanks to Silvie Cinkova for pointing this out to me) p. 187, other player, namely 50 times. -> other player. (thanks to Patrick Schultz for pointing this out to me) p. 195, Table 5.11: Table 5.11 Observed distribution of verb-particle constructions in Gries (2003) -> Table 5.11 Expected distribution of verb-particle constructions in Gries (2003) (thanks to John Newman for pointing this out to me) p. 209, first bullet point: alternative="two-sided" -> alternative="two.sided" (thanks to Earl Brown for pointing this out to me) p. 213, first line after second grey block of code: so that we might want to -> so that we can (thanks to Joseph Sorell for pointing this out to me) The script referred to a vector chi.square.tests that was only defined in the script , which has now been fixed. (thanks to John Newman for pointing this out to me) ######################### last updated 10 Oct 2016 STG