image Post Your Answer


image

Import data in R


I want to import data in R language. But I have no clue how to do it. Could someone please help me?

All Answers (3 Answers In All)

By Niranjan Singh Answered 5 years ago

Most of my data was saved in MS Excel. I have shared the steps I followed to import those data. Go through it. Open the Excel data and go to File > Save As or press Ctrl+Shift+S Name this with anything, say Data. Then before clicking Save, make sure to change the File Format to Comma Delimited Text and better set the directory to My Documents folder, for Windows. When saved, this file will have a name Data.csv. Now open R, and run the following MyRData <- read.csv (“Data.csv”, header = TRUE) (Note- The argument header = TRUE tells R that the first row of the data are the labels of every column. If set to FALSE, means the first row of the data are not the labels)


By Parul Singh Answered 5 years ago

You can import data either from STATA or SAS file by using the following codes STATA – > library(“foreign”) > mydata names(mydata) > write.dta(mydata, file = “mydata.dta”) SAS – library(“foreign”) mydata<-read.xport("SASData.xpt") names(mydata)


By Rekha Bajaj Answered 5 years ago

Lalit, do you want to import data from Excel file or SPSS file or from SAS? Please specify. I have imported data from SPSS file. These codes will let you import data to R language. > library(“foreign”) > mydata names(mydata)


Your Answer


View Related Questions












asked at 09 Jul, 2018 15:53 in Data collection By Sur M