islands dataset sort and find largest and snalest
R Studio Applied statistics using R problems Sample Codes

Access Data Set Islands and Find Largest and Smallest Masses

  • Access the data set Islands from the base package of R. Use suitable R command to find 3 largest masses and 3 smallest masses from the data set.

Solution:-
> x<-sort(islands);
> len=length(x)

> x[1:3]
      Vancouver          Hainan Prince of Wales 
             12              13              13 
> x[len:(len-2)]
         Asia        Africa North America 
        16988         11506          9390 

Sort the data set and stored it in another variable. Find length of dataset and print first 3 and last 3 elements.

Screen Shot:-

islands dataset sort and find largest and snalest

One Reply to “Access Data Set Islands and Find Largest and Smallest Masses

Leave a Reply

Your email address will not be published.