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.]
output
> x <- c(5, 8, 4, 1, 5, 6, 5, 9, 4, 2, 5, 7, 5, 3, 6, 4, 5, 3, 7, 6)
> table(x)
x
1 2 3 4 5 6 7 8 9
1 1 2 3 6 3 2 1 1
>
the first row in the table represents the value of the variable,
the second row in the table represents the frequency of the value of the variable.
Comments
Leave a comment