2. Vocabulary and R functions Enter the following command in R to read a simple
ID: 3203659 • Letter: 2
Question
2. Vocabulary and R functions
Enter the following command in R to read a simple help page about the table() command (this is for your information, you do not need to show the output):
?table
Now enter the following command and describe the output of the table() command. What does the first row of numbers in table() output represent? What does the second row of output represent?
x <- c(5, 8, 4, 1, 5, 6, 5, 9, 4, 2, 5, 7, 5, 3, 6, 4, 5, 3, 7, 6)
table(x)
[optional: You can test your theory by altering the numbers and rerunning the table command.]
Explanation / Answer
Ans:x <- c(5, 8, 4, 1, 5, 6, 5, 9, 4, 2, 5, 7, 5, 3, 6, 4, 5, 3, 7, 6)
The above line represent that x is a vector which have elements 5,8,4 and so on.
table(x) represent that how many x values are repeated i.e. the frequency of the values.
# The output will be
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.