w3resource

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

R Programming: Basic Exercise-25 with Solution

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

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("Details of the employees:")                      
print(Employees)

Sample Output:

[1] "Details of the employees:"
          Name Gender Age Designation         SSN
1  Anastasia S      M  23       Clerk 123-34-2346
2       Dima R      M  22     Manager  123-44-779
3  Katherine S      F  25    Exective  556-24-433
4      JAMES A      F  26         CEO  123-98-987
5 LAURA MARTIN      M  32   ASSISTANT  679-77-576                         

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 list of heterogeneous data, which include character, numeric and logical vectors. Print the lists.
Next: Write a R program to create a Data Frames which contain details of 5 employees and display summary of the data.

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.