Albart Coster
Objects of class numeric
n1 with 20 random numbers (you could use function sample for this).n11. Copy elements at positions 11 to 20 to vector n12.n11 and n12 into nnew.n1 to neven (use function seq and read about the by argument of this function).Objects of class character:
fName with your first name and lName with your last name.fName and lName into vector Name.Name into pName with a space between your first name and your last name.Matching and replacing:
(1,2,3) occur in vector n1. If not, make them occur in n1.(1,2,3) occur in n1.n1 where (1,2,3) occur with NA (NA is used in R for Not Available).Splitting a character string:
Name back into fName1 and lName1.fName and fName1 are identical (hint: use the identical function).fName1 into single characters and count the number of characters.Matrices
mat1 of three rows. The elements of mat1 should be NA.mat1 with 1 and the off-diagonal elements with increasing numbers ( use function diag to obtain and replace the diagonals, and functions upper.tri and lower.tri to obtain and replace the off-diagonals of the matrix.mat1 with 2 times their value.mat1.mat2 as the combination of two mat1 by row and mat3 as the combination by columns.Data.frames
ChickWeight dataset (?ChickWeight). Summarize this data.frame.ChickWeight where Time == 0 to CW.Time == 0.Chick column in reality is.Writing and reading data
ChickWeight data.frame into a *.csv file.ChickWeight1 and compare if the two data.frames are identical.Iteration
ChickWeight data (use function sd to calcute the standard deviation).ChickWeight data.tapply to repeat the questions in the exercise above. If you did already, repeat the previous exercises using a loop.