Exercise 1
The code help(library) displays the Loading/Attaching and Listing of Packages. How to use the function.
The library command code executes the command. The library( ) executes an empty command.
Exercise 2
Marked in red as it's a string/ path, which has no value.
Exercise 3
The question states calculate the sum of the vector raised to the power of 4, which can be interperated in two ways. The first method calculates the (sum of the vector) raised to the power of 4, and the second method calculates the sum of (vector raised to the power of 4)
Exercise 4
Exercise5
The conclusion is that the sum of the entire sequence of numbers ranging from 1-30 is equal to the total sum of the odd numbers from 1-30 and even numbers from 2-30.
Exercise 6
Exercise 7
In R, matrices are created by column by defult, therefore byrow=TRUE will create the matrix by row.
Exercise 8
Exercise 9
Exercise 10
2 is the value of the input, and 7 is the value of the output.
The command var(x) computes the variance of x, whcih can be a numeric vector, matrix or data frame.
y= sum of x z= mean of x n= number of x m= square of x minus mean a= sum of the bars sd= variance
Exercise 11
w= weight of body in kg h= height of body in m
Exercise 12
Week 1 practical content:
Basic operation in R
Use of markdown cells
Built in help functions in R
Changing path and verifying location of workspace
Working with vairables and objects, to perform simple calculations
Assigning value to object
The print command
Creating vectors and matrices, as well as their manipulation and calculations.
Transform numbers to characters.
Rearranging dimensions of matrices
Create user defined functions
Calculation of variance