w3resource

R Programming: Create a Dataframes which contain details of 5 employees and display summary of the data

R Programming: Basic Exercise-26 with Solution

Write a R program to create a Dataframes which contain details of 5 employees and display summary of the data.

Sample Solution :

R Programming Code :

Employees = data.frame(Name=c("Anastasia S","Dima R","Katherine S", "JAMES A","LAURA MARTIN"),
                      Gender=c("M","M","F","F","M"),
                      Age=c(23,22,25,26,32),
                      Designation=c("Clerk","Manager","Exective","CEO","ASSISTANT"),
                      SSN=c("123-34-2346","123-44-779","556-24-433","123-98-987","679-77-576")
                      )
print("Summary of the data:")                      
print(summary(Employees))

Sample Output:

[1] "Summary of the data:"
           Name   Gender      Age          Designation          SSN   
 Anastasia S :1   F:2    Min.   :22.0   ASSISTANT:1    123-34-2346:1  
 Dima R      :1   M:3    1st Qu.:23.0   CEO      :1    123-44-779 :1  
 JAMES A     :1          Median :25.0   Clerk    :1    123-98-987 :1  
 Katherine S :1          Mean   :25.6   Exective :1    556-24-433 :1  
 LAURA MARTIN:1          3rd Qu.:26.0   Manager  :1    679-77-576 :1  
                         Max.   :32.0                                         

R Programming Code Editor:



Have another way to solve this solution? Contribute your code (and comments) through Disqus.

Previous: Write a R program to create a Data Frames which contain details of 5 employees and display the details.
Next: Write a R program to create the system's idea of the current date with and without time.

Test your Programming skills with w3resource's quiz.

What is the difficulty level of this exercise?



Follow us on Facebook and Twitter for latest update.