Analytics with R: Assignment / Class Work-1
1. How to get a description of the version of R and its attached packages used in the current session?
2. Create object called “abc” by assigning the number 3.
3. Create different vectors (“a” is numeric, “b” is character and “c” is logical).
4. List all the objects in the current session.
5. Create vector “x” with the values {4, 4, 5, 6, 7, 2, 9}.
a. Calculate the number of observation (n), mean, sum, max, min, variance of the vector ‘x”.
b. Also print the 3rd element, odd positions elements and elements from 2 to 6 positions.
6. Create 6×4 matrix(6 rows and 4 columns) using 1 to 24 numbers.
7. Create data frame with the below vectors
a. StoreID – (111, 208, 113, 408)
b. Tenure – (25, 34, 28, 52)
c. StoreType – (“Type1”, “Type2”, “Type1”, “Type1”)
d. status – (“Poor”, “Improved”, “Excellent”, “Poor”)
8. Print the data in different programs.
a. only storeId, tenure
b. only storetype and status
c. only tenure
9. Create different factors using the below vectors and label the values and order the levels for factors “outcome” and “status”.
a. ethnicity – “White”, “African Amrican”, “Black”, “Asian”
b. status – “Poor”, “Improved”, “Excellent”, “Poor”
c. outcome – c(1, 3, 2, 4, 3, 1, 1) –
d. labels- “Poor”, “Average”, “Good”, “Excellent”
10. Read the stores.csv data set and find the summary statistics for all the columns.