Slip 7 - E) Write an R program to create a Dataframes which contain details of 5 employees and display the details in ascending order.

Solution:

Employees = data.frame(Name=c("Sagar","Dinesh","Komal", "Jasmine","Lalit"),
                       Gender=c("M","M","F","F","M"),
                       Age=c(23,22,25,26,32),
                       Designation=c("Clerk","Manager","Exective","CEO","ASSISTANT")
)
print("Details of the employees:")                      
print(Employees)

Employees[order(Employees$Name,decreasing=FALSE),]

Post a Comment

0 Comments