0% found this document useful (0 votes)
5 views

Fda 4

Uploaded by

sharmansai6
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views

Fda 4

Uploaded by

sharmansai6
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 15

FDA ASSIGNMENT

1. Print the dataset mtcars

2. Print the strcture of the dataset

3.What is the datatype of the datset

4. How many colmns and rows are there in the dataset?


5. Print the row names

6. Print the column names

7. What information (structure summary) you will get from str() function?

It provides summary of

• Type of the object


• Dimensions
• Variable names
• Data types
• Sample data

8. Print all the elements of 2nd row

9. Print all the elements of 2nd, 5th and 13th row


10. Print the elements of rows from 15 to 20

11. Print the elements of rows from 13 to 24, 28 and 30

12. Print all odd indexed rows (rows 1,3,5,...)


13. Print all even indexed rows (rows 2,4,6,...)

14. Print every 3rd row from 1st row (1,4,7,10..)

15. Print first row and last row


16. Print last 3 rows without using tail() function

17. Print the elements of 3rd column

18. Print the elements of column with name “wt”

19. Print the elements of columns “mpg”and “qsec”


20. Print first three columns

21. Print the elements of columns from 5 to 10


22. Print the elements of columns from 3 to 7, 9 and 11

23. Print all odd indexed columns (1,3,5,...)


24. Print all even indexed columns (2,4,6,...)

25. Print every 3rd column from 1st column (1,4,7,10..)


26 . Print first column and last column

27. Print last 3 columns


28. Print first Row and 2nd and third column

29. Print First, Second Row and Second and Third Column

30. Print element at 2nd row, third column

31. Print all the rows having “mpg” value greater than 14
32. Print all the rows having "hp" value less than 100

33. Print all the rows having “disp” value is between 100 and 200

HEAD & TAIL FUNCTIONS

34. find what head() and tail() commands do

head(): This function returns the first few rows of a data frame or vector. By default, it shows the first
6 rows, but you can specify a different number if desired.

tail(): This function returns the last few rows of a data frame or vector. By default, it shows the last 6
rows, but you can also specify a different number.

35. Use head() and tail() commands to display sample observations of mtcars dataset
36. Use head() command to Print first 10 observations

37. Use tail() commands to Print last 15 observations


SORTING

38. Sort the observations of the dataset “mtcars” in increasing order based on the

values in the column ”mpg”

39. Sort the observations of the dataset “mtcars” in decreasing order based on the

values in the column “cyl”


40. Sort the observations of the dataset “mtcars” in increasing order based on the

values in the columns both “mpg” and “cyl”

41. Sort the observations of the dataset “mtcars” in decreasing order based on the

values in the columns both “mpg” and “cyl”


42. Sort the observations of the dataset “mtcars” by column “mpg” in increasing

order and column “cyl” in decreasing order

You might also like