
Code $$\PageIndex{1}$$ (R):

data <- read.table("data/bugs.txt", h=TRUE)
hist(data$WEIGHT, breaks=c(seq(0, 100, 20)) Here should be Code $$\PageIndex{2}$$ (R): data <- read.table("data/bugs.txt", h=TRUE) hist(data$WEIGHT, breaks=c(seq(0, 100, 20)))

By the way, non-paired brackets (and also non-paired quotes) are among the most frequent mistakes in R.

Even more, function seq() makes vector so function c() is unnecessary and the better variant of the same command is

Code $$\PageIndex{3}$$ (R):

data <- read.table("data/bugs.txt", h=TRUE)
hist(data\$WEIGHT, breaks=seq(0, 100, 20))

Now the truth is that there are two mistakes in the text. We are sorry about it, but we believe it will help you to understand R code better. Second is not syntactic mistake, it is more like inconsistency between the text and example. Please find it yourself.

This page titled 8.6: Answers to exercises is shared under a Public Domain license and was authored, remixed, and/or curated by Alexey Shipunov via source content that was edited to the style and standards of the LibreTexts platform; a detailed edit history is available upon request.