PHD Discussions Logo

Ask, Learn and Accelerate in your PhD Research

Question Icon Post Your Answer

Question Icon

6 years ago in Data collection By Lalit Mudra

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 7 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

By Parul Singh Answered 7 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

By Rekha Bajaj Answered 7 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