Reference no: EM132988506
R Studio should be used to answer the following questions:
1. Run the following line of code to create a matrix "mat" with three rows and three columns.
mat <- matrix(1:9, nrow=3, ncol=3)
Check to ensure the code worked by typing "mat" into your R console and viewing the output. Include the R console output as part of your answer.
Write a line of code that would extract the observation in the first row, and second column. Write a line of code that would extract the entire third column. Write a line of code that would extract everything except for the first row. Be sure to include the output values for each line of code as part of your answer.
2. Variable class is always important in analysis to ensure our models treat the variables correctly. Suppose you have a dataset called "dat" and a variable called "prestige" that R reads as a factor, but that your model requires to be numeric. Write a line of code that converts the prestige variable to numeric. Write a separate line of code that would check to ensure the variable is transformed.
3. One essential skill for new R users is being able to read and understand the package documentation to understand the arguments that various functions require. The easiest way to access these package documents is by using R's help feature. Write two lines of code, one for an exact search of "poisson"; and one for a fuzzy search of "poisson." What is the difference between the two help approaches?