Blog

Practice Questions on Data Import / Export 

1) Show the Current Working Directory for your R environment.

2) List all the files or folders in the Current Working Directory .

3) Show only those Files or Folders which are having 'delim' in their name.

4) Install the Package 'readxl' in your R environment .

5) List all the excel files saved during the installation of readxl Package.

6) Show the folder path where a set of excel files for practice were saved during the readxl package installation.

7) Go to the Folder in your system ( as shown in previous question ) , and copy all the excel files into your Current Working Directory of R.

8) now open the file 'clippy.xls' and then save it as 'comma separated value' file  as 'clippy.csv'.
hint - while saving the file select the CSV format from the drop down in the save dialog box.

9) again open the file 'clippy.xls' and then save it as 'tab delimited (*.txt) ' file as 'clippy.txt'.
     
10) Now read the 'clippy.csv' which is a Comma Separated file into R using read.table() .without considering that the first row in the csv file is a header.

11) Now , again read the 'clippy.csv' which is a Comma Separated file into R using read.table() , considering that the first row in the csv file is a header.

12) show , the structure of the R data frame into which the clippy.csv is read into.

13) Now , read again the 'clippy.csv' into R using read.table() , considering that the first row is header , but also ensure that the string columns are not converted into factor.

14) Now , read again the 'clippy.csv' into R using read.table() , considering that the first row is header , but also ensure that only first column is not being converted into factor whereas second column gets converted to factor type.

15) Now , read again the 'clippy.csv' into R using read.csv() , considering that the first row is header , but also ensure that the string columns are not converted into factor.

16) Read the 'clippy.txt' (tab delimited file )  into R using read.delim() , considering that the first row is header.

17) Read the 'clippy.txt' (tab delimited file )  into R using read.table(), considering that the first row is header.

18) Read the 'clippy.txt' (tab delimited file )  into R using read.table(), considering that the first row is header and also skip reading the first row from the file .

19) Show the count of the sheets in the excel "deaths.xls" file

20) Show the name of all the sheets in the excel "deaths.xls" file

21) Read the second sheet in the excel file "deaths.xls" file

22) Read sheet number 4 from "datasets.xls" file and only read 10 records from excel . save the data read into a data frame named Out_excel_file .

23) write the Out_excel_file dataframe as Out_excel_file.csv on your working directory folder .
@AUTHOR : Admin

Tags:Eco, Water, Air, Environment

Comments (0)

    No Comments Found
Leave a Comment