Question 1 Basic R operations a Let x SolutionAnswer of ques
Solution
Answer of question 1.
part (a)
x=1 2 3 4 5 6 7 8 9 10 11 12
[1] 1 2 2 3 3 3 4 4 4 4 5 5 5 5 5 6 6 6 6 6 6 7 7 7 7
[26] 7 7 7 8 8 8 8 8 8 8 8 9 9 9 9 9 9 9 9 9 10 10 10 10 10
[51] 10 10 10 10 10 11 11 11 11 11 11 11 11 11 11 11 12 12 12 12 12 12 12 12 12
[76] 12 12 12
part(b)
this command matrix (x, ncol=3,byrow=T) will generate a matrix of number of column =3 and element of matrix will be arranged row wise.i.e first row will be filled as 1, 2 ,3 and next row as 4,5,6 and so on as [,1] [,2] [,3]
[1,] 1 2 3
[2,] 4 5 6
[3,] 7 8 9
[4,] 10 11 12
dim(x) will genrate number of number of row and number of column of matrix x.
c(4,3) also generate 4,3 as an element , where as dim(x) is also generating 4.3 but it is number of row and number of column in matrix
Part (c)
sample (x) takes a sample from the elements of x using either with or without replacement.
order returns a permutation which rearranges its first argument into ascending or descending order, breaking ties by further arguments.
question 2 need to do oneself
![Question 1 Basic R operations (a) Let x SolutionAnswer of question 1. part (a) x=1 2 3 4 5 6 7 8 9 10 11 12 [1] 1 2 2 3 3 3 4 4 4 4 5 5 5 5 5 6 6 6 6 6 6 7 7 7 Question 1 Basic R operations (a) Let x SolutionAnswer of question 1. part (a) x=1 2 3 4 5 6 7 8 9 10 11 12 [1] 1 2 2 3 3 3 4 4 4 4 5 5 5 5 5 6 6 6 6 6 6 7 7 7](/WebImages/30/question-1-basic-r-operations-a-let-x-solutionanswer-of-ques-1084314-1761569888-0.webp)