Fda 3
Fda 3
Lists
1. Write a R program to create a list containing strings, numbers, vectors and a logical
value.
Code:
Output:
Output:
Output:
Output:
Output:
Matrix
1. R Program to create a blank or empty matrix
Code:
Output:
2. Write a R program to create two 2x3 matrix and add, subtract, multiply and divide
the matrixes.
Code:
Output:
3. Write a R program to create a matrix taking a given vector of numbers as input and
define the column and row names. Display the matrix.
Code:
Output:
Data Frame
1. Write a R program to create a data frame from four given vectors.
name = c('Anastasia', 'Dima', 'Katherine', 'James', 'Emily', 'Michael', 'Matthew', 'Laura',
'Kevin', 'Jonas')
score = c(12.5, 9, 16.5, 12, 9, 20, 14.5, 13.5, 8, 19)
attempts = c(1, 3, 2, 3, 2, 3, 1, 1, 2, 1)
qualify = c('yes', 'no', 'yes', 'no', 'no', 'yes', 'yes', 'no', 'no', 'yes')
Code:
Output:
2. R Program to Convert a List to a Dataframe
Code:
Output:
Output:
Output:
6. Write a R program to extract specific column from a data frame using column name.
Code:
Output: