Importing Data and Working With Data in R (R Tutorial 1.6)

Learn how to import a dataset into R and begin to work with data. You will learn the “read.table”, “header”, “sep”, “file.choose”, “dim”, “head”, “tail”, “as.factor”, “attach”, “detach”, “levels”, and [] commands. This video is a tutorial for programming in R Statistical Software for beginners.

You can access and download the “LungCapData” dataset from
our website: http://www.statslectures.com/index.php/r-stats-datasets

or here:

Excel format: https://bit.ly/LungCapDataxls
Tab Delimited Text File: https://bit.ly/LungCapData

Here is a quick overview of the topics addressed in this video; You can click on the time stamp to jump to the specific topic.

0:00:07 how to read a dataset into R using “read.table” command and save it as an object

0:00:27 how to access the help menu in R

0:01:02 how to let R know that the first row of our data is headers by using “header” argument

0:01:14 how to let R know how the observations are separated by using “sep” argument

0:02:03 how to specify the path to the file using “file.choose” argument on the “read.table” command

0:03:15 how to use Menu options to import data into R when working with RStudio

0:05:23 how to use Excel to prepare the data for using in R

0:06:15 how to know the dimensions (the number of rows and columns) of the data in R using the “dim” command

0:06:35 how to see the first six rows of the data in R using the “head” command

0:06:45 how to see the last six rows of the data in R using the “tail” command

0:07:18 how to check if the data was read correctly into R using square brackets and subsetting data

0:08:21 how to check the variable names in R using the “names” command

http://statslectures.com/index.php

Comments

Shashim Waghmare says:

Can you give link for the datasets on which you perform operations in the tutorials

Ben Schoemann says:

How do you find the path to a file?

Debojit Chanda says:

hi Marin, In my R console, its not showing the Workspace and the history like its showing for others. could you please help?

mukong meh says:

Great Video right there. Simple and straight to the point. Good job Mate.

Jithesh Kumar says:

hey martin. How did the variable x appear in your work space upon using the ‘names’ function?

Mohammed Al-Hajri says:

excellent tutorials. much appreciated.

S Abarza says:

THANK YOU SO MUCH!! It’s in caps because I really appreciate your videos. Thank you again

Mohit Dhanjani says:

thank you sir, easy to understand and please add more complicated programming videos based on R

shubham swami says:

great work sir. I am from india. i really appreciate ur work.

harshit tilak says:

how to save our r program u didn’t tell , this thing must be teach in the beginning of tutorial .

puneet gupta says:

such a nice and clear voice , thanks.

pranav dhananiwala says:

great job mate! your videos. how can we import txt files if there are any missing values and when in few rows there are some colums more and less.
can i get your emial id

swathi muthyapu says:

how can we import fixed length files into Rstudio?

Zheng Wang says:

Thanks for your tutorial, but I have some issues when doing the tail(Lung..), in your video it shows the number of the last six column in the table that retrieved, such as 720-725, but in mine, it keep giving 1-6, this even happen when I use LungCapData[c(5,6,7,8,9), ] to retrieve the specific columns, it gives me 12345 as the column no. instead of 5,6,7,8,9 in the table I got. So do you have any idea about that? Thanks.

Chris Powley says:

Thanks for the great tutorials, I find when I import the text file it coverts the factor fields to characters. How can I make it important same way as your example?

Novice Programmer says:

Hi, just a quick question re the usefulness of R.I am under the impression R is good at handling “large” data. By large, I mean in excess of 1million records, ie something Excel has problems with.What I don’t understand is your preferred method of getting data into R.You state you like Excel (so do I!), so you typically get the data in Excel, save it as a csv then import it into R using read.table.But that would mean the size of your data you want to analyse is limited to what Excel can handle? Suppose you want to analyse data that contains 2million records (and is currently stored in Access or SQL Server). how would you import that into R?

Alan Le says:

Does anyone know the keyboard shortcut on how he pasted the previous line of command into his console?

YOON CHOI says:

I cannot move forward from 0:55 because there is an error ‘U’ without hex digits in character string starting “”U”. Please let me know how to do this:(

Picasso Harbor says:

they are so useful :3 Thank you share it with us :3

Hosse Huang says:

Best R tutorial video online, thanks!!!

Badra Sid says:

Marin… Thank you very much. You are doing a great great great job for help people to have a grasp on R

Soundararajan Mathiaru says:

Thank you for the sharing your knowledge in a very simple and easy way to learn.

Behrouz Ghanbari says:

Dear Mike, thank you for great videos, in command: read.table(file.choose(),header=T, sep=”t”), I think the sign is a backslash not slash, please correct me if I am wrong.

Badra Sid says:

Great Job Marin … Thank you so much.

Ben Schoemann says:

Also, Mine only says 10 observations. Does anybody know why that might be. I just downloaded this program so I’m thinking it might have to do with no having all the plugins I need or something.

Yameen Shah says:

thanks good guide

Write a comment

*

Human Verification: In order to verify that you are a human and not a spam bot, please enter the answer into the following box below based on the instructions contained in the graphic.


Do you like our videos?
Do you want to see more like that?

Please click below to support us on Facebook!

Send this to a friend

▷ Other ReviewsVehicles▷ Show Cars▷ Motorbikes▷ Scooters▷ Bicycles▷ Rims & Tires▷ Luxury BoatsFashion▷ Sunglasses▷ Luxury Watches▷ Luxury Purses▷ Jeans Wear▷ High Heels▷ Kinis Swimwear▷ Perfumes▷ Jewellery▷ Cosmetics▷ Shaving Helpers▷ Fashion HatsFooding▷ Chef Club▷ Fooding Helpers▷ Coktails & LiquorsSports▷ Sport Shoes▷ Fitness & Detox▷ Golf Gear▷ Racquets▷ Hiking & Trek Gear▷ Diving Equipment▷ Ski Gear▷ Snowboards▷ Surf Boards▷ Rollers & SkatesEntertainment▷ DIY Guides▷ Zik Instruments▷ Published Books▷ Music Albums▷ Cine Movies▷ Trading Helpers▷ Make Money▷ Fishing Equipment▷ Paintball Supplies▷ Trading Card Games▷ Telescopes▷ Knives▷ VapesHigh Tech▷ Flat Screens▷ Tech Devices▷ Camera Lenses▷ Audio HiFi▷ Printers▷ USB Devices▷ PC Hardware▷ Network Gear▷ Cloud Servers▷ Software Helpers▷ Programmer Helpers▷ Mobile Apps▷ Hearing AidsHome▷ Home Furniture▷ Home Appliances▷ Tools Workshop▷ Beddings▷ Floor Layings▷ Barbecues▷ Aquarium Gear▷ Safe Boxes▷ Office Supplies▷ Security Locks▷ Cleaning ProductsKids▷ Baby Strollers▷ Child Car Seats▷ Remote ControlledTravel▷ Luggages & Bags▷ Airlines Seats▷ Hotel Rooms▷ Fun Trips▷ Cruise Ships▷ Mexico Tours