Working with Variables and Data in R | R Tutorial 1.8 | MarinStatslectures

  Рет қаралды 348,011

MarinStatsLectures-R Programming & Statistics

MarinStatsLectures-R Programming & Statistics

11 жыл бұрын

Working with Variables and Data in R and Produce Summaries: How to check variable names and types, extract a variable from a dataset, and produce summaries for in R! Practice with Free Dataset: (bit.ly/2rOfgEJ) Learn to Install R and RStudio? (bit.ly/2PYO8jS) 👍🏼Best Statistics & R Programming Language Tutorials: ( goo.gl/4vDQzT )
►► Like to support us? You can Donate (bit.ly/2CWxnP2), Share our Videos, Leave us a Comment and Give us a Like or Write us a Review! Either way We Thank You!
In this video tutorial you will learn how to check variable names, variable types, extract a variable from a dataset, and produce summaries for data based on the type of data in R.
▶︎ How to check variable names for datasets in R? We will use names function in R
▶︎ How to extract a variable from a dataset in R? We will learn to use $ or Attach function in R
▶︎ How to check the variable type (numeric or categorical) in R? We will use class function in R
▶︎ How to ask R for different levels/categories of a categorical variable? levels function in R will be used
▶︎ How to produce summary for variable in R? summary function in R will produce summary of variables based on their type, for example numeric values will be summarized by mean, median and quartiles, and factors or categorical variables will be summarized as frequencies.
▶︎▶︎Download the dataset here:
statslectures.com/r-scripts-d...
▶︎▶︎Watch More:
▶︎Getting Started with R: bit.ly/2PkTneg
▶︎Graphs and Descriptive Statistics in R: bit.ly/2PkTneg
▶︎Probability distributions in R: bit.ly/2AT3wpI
▶︎Bivariate analysis in R: bit.ly/2SXvcRi
▶︎Linear Regression in R: bit.ly/1iytAtm
▶︎Intro to Statistics Course: bit.ly/2SQOxDH
◼︎ Table of Content
0:01:06 How to use the dollar sign "$" to extract the variable within a dataset in R
0:02:25 How to make objects/variables within a data frame accessible in R? introducing the "attach" function
0:03:20 How to un-attach the data in R? working with the "detach" function
0:04:04 How to check the type or class of a variable in R? using the "class" function in R
0:05:04 How to use the "levels" function in R to find out the different levels/ categories for a factor/categorical data
0:05:34 How to produce summaries for data in R? learn to use the "summary" function in R
0:06:30 How to convert a numeric variable to categorical/factor variable in R using "as.factor" function
This video is a tutorial for programming in R Statistical Software for beginners.
Follow MarinStatsLectures
Subscribe: goo.gl/4vDQzT
website: statslectures.com
Facebook:goo.gl/qYQavS
Twitter:goo.gl/393AQG
Instagram: goo.gl/fdPiDn
Our Team:
Content Creator: Mike Marin (B.Sc., MSc.) Senior Instructor at UBC.
Producer and Creative Manager: Ladan Hamadani (B.Sc., BA., MPH)
These videos are created by #marinstatslectures to support some courses at The University of British Columbia (UBC) (#IntroductoryStatistics and #RVideoTutorials for Health Science Research), although we make all videos available to the everyone everywhere for free.
Thanks for watching! Have fun and remember that statistics is almost as beautiful as a unicorn!

Пікірлер: 263
@09Nipz
@09Nipz 6 жыл бұрын
I know these were uploaded in 2013 but they feel more relevant than the confusing tutorials they have us doing in postgrad, this year! Saved my life. I was so stuck in stats, getting behind and struggling to progress. Not because I didn't understand the concepts of statistics, but because I couldn't figure out where I was going wrong in R. Thank you!
@retearwqtaet
@retearwqtaet 6 жыл бұрын
You're better than explaining this than my professor...Thanks for putting this into a format people can actually understand. You knocked out in 10 minutes what he hadn't adequately demonstrated in over an hour.
@rogerrosewall6
@rogerrosewall6 Күн бұрын
Your videos are excellent. In addition to the high quality content, your clear and focused voice track enhance the learning experience. Many thanks!
@batchrocketproject4720
@batchrocketproject4720 3 жыл бұрын
Thanks for these videos. I've been using R for about a year and found many of its quirks frustrating until I found your videos which work through things in much the same way a user needs. Really useful, thanks.
@MrKocharrohit
@MrKocharrohit 10 жыл бұрын
You have explained R in a very simple way. I loved it.
@marinstatlectures
@marinstatlectures 10 жыл бұрын
Thanks Rohit Kochar , we appreciate that!
@user-xd8uw9zi9y
@user-xd8uw9zi9y 8 жыл бұрын
I JUST BEGAN LEARNING THIS R STUFF AND IT WAS SOOOO HARD. THE TUTORIAL VIDS ARE SO GOOD AND REALLY HELPED ME OUT! THANK YOU!
@marinstatlectures
@marinstatlectures 8 жыл бұрын
you're welcome +郭宝淇 , glad we could help!
@Oggygroggy1
@Oggygroggy1 7 жыл бұрын
Yeah, me to!
@TheJojolapatates
@TheJojolapatates 6 жыл бұрын
Help me a lot as well ! Thank you !
@simonambat
@simonambat 10 жыл бұрын
Your videos are excellent! I was into R for some time. Your videos gave me good clarity of R and its usage in a very systematic way. It helps a lot in my research work. Thank you so much!!
@marinstatlectures
@marinstatlectures 10 жыл бұрын
You're very welcome simon EK , thanks for the compliments, and thanks for watching!
@nevinpicard5988
@nevinpicard5988 7 жыл бұрын
If you are have an issue with some of the "Factor" type Names being listed as "Characters" you can change them when importing your Data. When importing, go to the data preview window and click "Character" under the [Gender, Caesarean and Smoke] categories and a drop down list should appear allowing you to change them to "Factors". Please thumbs this up for visibility.
@TomTomDam
@TomTomDam 7 жыл бұрын
Where is Factor? In the dropdown list I only see Character, Numeric, Date, Include, Skip. Im using Windows 10 RStudio 3.3.3.
@ringatingting
@ringatingting 6 жыл бұрын
Thank you!!!
@pranavgarimella8987
@pranavgarimella8987 3 жыл бұрын
Thanks, i think this explains why i have the following output > summary(LungCapData$Smoke) Length Class Mode 725 character character
@nl7247
@nl7247 2 жыл бұрын
Thank you. I'm using RStudio 2021.09.2+382 "Ghost Orchid" version. In "Import Dataset" pop-up, select "Strings as factors", then Import.
@bandhanjotkdhiman6130
@bandhanjotkdhiman6130 2 жыл бұрын
@@nl7247 I did not understand, I m also using the latest R version
@peaceandlove6389
@peaceandlove6389 6 жыл бұрын
And 5 years later this still saves our grades. I just started with this. THANK YOU! :)
@ndriunitedagbians5949
@ndriunitedagbians5949 3 жыл бұрын
Your tutorials are easy to understand, learn the concepts sir. Thank you for teaching students like me across the globe virtually.
@TJ-gp6to
@TJ-gp6to 9 жыл бұрын
You're tutorials are truly the best. I'm taking a programming course and your tutorials are lifesavers. I only learn through hands on and visual teaching methods. This is really driving the materials home, not to mention saving me from a lot of wasted time and a ton of headaches! :)
@marinstatlectures
@marinstatlectures 9 жыл бұрын
That's great to hear ***** !
@IamJustinYoung
@IamJustinYoung 8 жыл бұрын
Thank you! Just getting started but this is making me feel more comfortable with the language
@marinstatlectures
@marinstatlectures 8 жыл бұрын
great to hear +Justin Young
@warpenator
@warpenator 9 жыл бұрын
Mike, your tutorials are wonderful. They are so straightforward and easy to follow. A lot of tutorials I find online deliver the content in a somewhat 'look how much smarter than you I am' kind of way. I don't get that from you. You clearly love what you do, and I thank you for putting these videos together. I think I am finally understanding this stuff.
@marinstatlectures
@marinstatlectures 9 жыл бұрын
thanks warpenator , that's great to hear! and you are correct, i have always loved teaching!!
@bettys7298
@bettys7298 4 жыл бұрын
Thanks for introducing attach() detach() function in R! Very helpful!
@DL-fl5ul
@DL-fl5ul 4 жыл бұрын
You're a hero man. This is only thing in a new job I don't know and your tutorials are the only way I think I can be completely covered on R.
@marinstatlectures
@marinstatlectures 4 жыл бұрын
that's great to hear!
@vyshakkakkat2990
@vyshakkakkat2990 8 жыл бұрын
You have some badass tutoring skills! Really appreciate all the effort you have put into making these. Awesome and easy to understand, helped me a lot.
@marinstatlectures
@marinstatlectures 8 жыл бұрын
Thanks +Vyshak Kakkat , teaching is my passion (and my job). and my wife loves the video editing and annotating, etc, so we make a good team, and each bring our own unique set of skills ;)
@sizhuhicks1775
@sizhuhicks1775 9 жыл бұрын
This is the best R tutorials I found on youtube so far. thank you
@marinstatlectures
@marinstatlectures 9 жыл бұрын
thanks +Sizhu Hicks , we appreciate that!
@soundsofsoul7389
@soundsofsoul7389 4 жыл бұрын
Dear Marin, you're a lifesaver! Thank you :)
@CollMomo1
@CollMomo1 8 жыл бұрын
Thanks for the tutorial. At 1.5x speed, its perfect :P
@puneetohri6256
@puneetohri6256 6 жыл бұрын
a man's amazing , love you marin
@MaschlNES
@MaschlNES 8 жыл бұрын
All of your videos are so helpful for me. I used to use my PC for listening to musik, but now I have to deal with R in connection with my master thesis. I´ve watched many R tutorial videos, since I found yours and I just want to tell you, that your doing a great job. Thank you so much! Kind regards from Germany
@marinstatlectures
@marinstatlectures 8 жыл бұрын
thanks +Mienchen Sto , we appreciate that! good luck with your studies!
@vjrobs09
@vjrobs09 7 жыл бұрын
Great Explanation of very useful stuff in R... Thanks a ton!!!
@goldy5858
@goldy5858 10 жыл бұрын
I don't have words to show gratitude for how much the videos are helping me to learn R. :) Thanks and respect for the great work.
@marinstatlectures
@marinstatlectures 10 жыл бұрын
you're welcome Avishek Raha , and we appreciate you saying that!
@angleeas
@angleeas 3 жыл бұрын
I have just started learning r language < thank you so much for this amazing vids, I will let you know updates
@TheArabari
@TheArabari 9 жыл бұрын
Thank you Dear Marin, with your easy way of lecturing method you turned the dark to light, I was confused before i got your tube. No words to express how your tutorial is useful in my life.
@marinstatlectures
@marinstatlectures 9 жыл бұрын
We're very happy to hear that, thanks Amir Mohammed !
@bernardmartinelli268
@bernardmartinelli268 8 жыл бұрын
These videos are the god for my R assignment. I am going to put these video links as a playlist to my references at the end. Thank you so much.
@marinstatlectures
@marinstatlectures 8 жыл бұрын
you're welcome +Bernard Martinelli , glad to hear you're finding them helpful!
@sharnalunn1970
@sharnalunn1970 4 жыл бұрын
Thank you so much! Tried learning R at least 4 times over the past few years and each time lose faith as it's assumed you already understand the principles of coding. I couldn't even get my data to read. You've saved me a lot of pain, THANK YOU!!!!!
@marinstatlectures
@marinstatlectures 4 жыл бұрын
great to hear! you're welcome :)
@sushantchinchkar8042
@sushantchinchkar8042 8 жыл бұрын
Sir, you are doing an awesome job. Videos are proving far better than reading manuals for beginners. Please keep it up. _/\_
@christiananwogu2808
@christiananwogu2808 7 жыл бұрын
thanks for this tutorial, i finally have a good start to learning r
@marinstatlectures
@marinstatlectures 7 жыл бұрын
you're welcome +Christiana Nwoko
@rajeshchouhan9016
@rajeshchouhan9016 6 жыл бұрын
kudos to you sir..For your valuable efforts.. Thanx a lot..these lectures helped me a lot as a beginner..❤👌🙏🙌
@marinstatlectures
@marinstatlectures 5 жыл бұрын
Learn how to work with variables in R, check variable names for the dataset that you imported into R (kzbin.info/www/bejne/p4HOYYx7gM2keJo ), check variable types (numeric or categorical), extract a variable from a dataset and produce summaries for data in R. Use the dataset to practice along (bit.ly/2rOfgEJ)! Like to support us? You can Donate statslectures.com/support-us or Share the Videos.
@muhammadsaif5626
@muhammadsaif5626 5 жыл бұрын
Excellent! Thank you
@emelytja8838
@emelytja8838 5 жыл бұрын
Thank you you helped me a lot with this video. Even though it is already 5 years old. Everything still works.
@marinstatlectures
@marinstatlectures 5 жыл бұрын
glad you find them helpful!
@tingtingli6158
@tingtingli6158 7 жыл бұрын
Hello,Mike,by learning from your video about RStudio, i find it is very easy to get the knowledge of R language.Thank you and your team very much.Wish you have a good day! I will try my best to get the points.
@marinstatlectures
@marinstatlectures 7 жыл бұрын
thanks +tingting li , we appreciate that!
@jafarnamdar6
@jafarnamdar6 6 жыл бұрын
Appreciated, great videos!
@sarahlucan1832
@sarahlucan1832 4 жыл бұрын
THANK YOU! Assignment due in minus 24hrs and now i can actually create graphs!
@marinstatlectures
@marinstatlectures 4 жыл бұрын
great to hear :)
@MermaidLolly
@MermaidLolly 7 жыл бұрын
Thank you so much for this! I'm studying a Masters degree in Linguistics and now have to use this software for my dissertation. I found it so difficult until I found your videos!
@marinstatlectures
@marinstatlectures 7 жыл бұрын
good to hear +Mermaid Lolly !
@weerachonsawangproh8738
@weerachonsawangproh8738 6 жыл бұрын
Fantastic R tutorials :)
@lesterraynanjala3875
@lesterraynanjala3875 6 жыл бұрын
Am working wit R to analyse my bird Data in the first place it was so had at the point of giving up on R until i discover MARINSTATSLECTURES thanks to you
@marinstatlectures
@marinstatlectures 6 жыл бұрын
great to hear Ray Nanjala!
@ramikashef
@ramikashef 8 жыл бұрын
Thank you for this very helpfull tutorials! veeeeerry nice
@alberto6888
@alberto6888 7 жыл бұрын
Very very good! Thank you so much!
@user-nr7xl6qk7h
@user-nr7xl6qk7h 7 жыл бұрын
I am teaching statistics at University; I am using STATA for individual research, but it is too expensive to use in Undergraduate STAT class. Your lecture or R is just awesome. You just use a minimal explanation for lecturing R and it really helps. I plan to suggest this website for students who take my course in advance to be familiar with R, It will really save time and make us happier.Sincerely appreciate your effort !!!
@marinstatlectures
@marinstatlectures 7 жыл бұрын
you're welcome +김중백(정경대학 사회학과) ­. yes, please share these with your students. the start of creating these videos was to use for my class (i teach an intro stats course for graduate students in public health), so they are built to work with most standard intro stats courses.
@ramkaushikpochiraju4550
@ramkaushikpochiraju4550 9 жыл бұрын
Thanks a lot Marin! Your lectures are great .. :)
@marinstatlectures
@marinstatlectures 9 жыл бұрын
You're welcome Ram Kaushik Pochiraju
@8retnuoc
@8retnuoc 10 жыл бұрын
Very useful so far. Thank you
@marinstatlectures
@marinstatlectures 10 жыл бұрын
You're very welcome, thanks for watching!
@retrosak1977
@retrosak1977 4 жыл бұрын
Excellent videos! Thank you very much for the great job!
@marinstatlectures
@marinstatlectures 4 жыл бұрын
you're welcome!
@godsonchikelu6024
@godsonchikelu6024 8 жыл бұрын
Thank you for teaching me the attach command. you are awesome!
@marinstatlectures
@marinstatlectures 8 жыл бұрын
you're welcome +Godson Chikelu , glad you're finding our videos helpful!
@alexisthibo7988
@alexisthibo7988 3 жыл бұрын
Thank you so much🙏
@kathyqing212
@kathyqing212 8 жыл бұрын
Your video is so amazing. Thank you a LOT!!
@marinstatlectures
@marinstatlectures 8 жыл бұрын
you're welcome +Xiaoqing Zhang
@mdyeasinarafath4450
@mdyeasinarafath4450 6 жыл бұрын
Thanks a lot, Sir! These are all useful videos. I have one question at this point. Do we work only in console in R?
@foyzih
@foyzih 7 жыл бұрын
superb!
@wessamahmed4266
@wessamahmed4266 7 жыл бұрын
finally, I were able to find a tutorial which is not long and I can understand
@marinstatlectures
@marinstatlectures 7 жыл бұрын
happy to help +wessam ahmed . we've got 60+ more of them...
@korrin897
@korrin897 10 жыл бұрын
thank you so much you have helped me a lot!!!!
@marinstatlectures
@marinstatlectures 10 жыл бұрын
You're welcome, happy to help!
@junhuijiang6107
@junhuijiang6107 8 жыл бұрын
I love your tutorial video records!
@marinstatlectures
@marinstatlectures 8 жыл бұрын
thanks +Junhui Jiang !
@kerumble
@kerumble 8 жыл бұрын
These are excellent, thank you very much!
@marinstatlectures
@marinstatlectures 8 жыл бұрын
you're welcome +kerumble !
@Kawiibear101
@Kawiibear101 5 жыл бұрын
Thank you so much I can finally use R!
@marinstatlectures
@marinstatlectures 5 жыл бұрын
great to hear!
@mohamedouzarf
@mohamedouzarf 8 жыл бұрын
thanks for tutorial video and dataset
@marinstatlectures
@marinstatlectures 8 жыл бұрын
you're welcome +MOHAMED OUZARF !
@McLighthawk
@McLighthawk 9 жыл бұрын
Thank you for this very helpfull tutorials!
@marinstatlectures
@marinstatlectures 9 жыл бұрын
you're welcome +McLighthawk !
@davitoshioinada2977
@davitoshioinada2977 9 жыл бұрын
Loving :)
@abbas8646
@abbas8646 9 жыл бұрын
another great video, thank you
@marinstatlectures
@marinstatlectures 9 жыл бұрын
thanks abbas8646 !
@ravikrishnarpan
@ravikrishnarpan 9 жыл бұрын
U r a Gem , really appreciate ur training
@marinstatlectures
@marinstatlectures 9 жыл бұрын
you're welcome Ravi Krishnarpan
@deepakkota9480
@deepakkota9480 8 жыл бұрын
Really good lecture. But I think it's not the personal preference to use attach, detach, but it is a precaution, because if you are working with a variable "Age"(for instance Age = 8) in this example, it neglects the "Age" column in the working file even though it is attached. For instance if you type mean(Age), it gives 8 instead of mean(LungCapData$Age).
@aperson1181
@aperson1181 6 жыл бұрын
thank you for the video, I'm getting Smoke Length:725 Class :character, Mode :character; and Gender is the same, R doesn't break down male/female, just gives me Length, Class and Mode
@mohamedkhalil8468
@mohamedkhalil8468 8 жыл бұрын
Love your videos sir :)
@marinstatlectures
@marinstatlectures 8 жыл бұрын
thanks +Mellal Mohamed Khalil !
@inf3rno691
@inf3rno691 4 жыл бұрын
Mate you save me... Critical explanations on commands...Please make a video for Bayesian Logistic Regression! :P
@2003budisu
@2003budisu 9 жыл бұрын
nice and very helpful... :)
@marinstatlectures
@marinstatlectures 9 жыл бұрын
thanks buditsu !
@nageshgoud721
@nageshgoud721 8 жыл бұрын
Hi Marin, the classes are really awesome... These are really helpful.. .. Do you have any videos where I can read/Learn statistics.
@marinstatlectures
@marinstatlectures 8 жыл бұрын
thanks +nagesh goud , unfortunately we haven't really had time to dive into a set of videos like that yet. we'd like to create those at some point, but at the moment we haven't had much time to work on more videos, and when we do find small chunks of time, we've been using it to add to our R video library.
@Shahada2012
@Shahada2012 7 жыл бұрын
awesome
@behnam2534
@behnam2534 8 жыл бұрын
Hello I just started learning R. You are amazing and lessons are so clear and awesome. I was wondering if there is a way that I can download the " Longcap data?" so that I can compare my results with yours. Thanks again. Good job Behnam
@marinstatlectures
@marinstatlectures 8 жыл бұрын
Hi +Behnam AliMohammadi , thanks, we appreciate that! yes, just click on "SHOW MORE" under the video, and you will see a link there to download a copy of the data. in some of our later videos, we also have the R Script there for download as well.
@Avangelis
@Avangelis 5 жыл бұрын
OMG Life Saver
@marinstatlectures
@marinstatlectures 5 жыл бұрын
Always nice to hear the kind words 😊
@ravinduabeygunasekara833
@ravinduabeygunasekara833 8 жыл бұрын
sir these tutorial are pretty awesome!! thanks alot! are there any exercies available so that we can try these other than 'lungcapdata" , or any kind of question paper in R??
@marinstatlectures
@marinstatlectures 8 жыл бұрын
Thanks +Ravindu Abeygunasekara ! at the moment i don't have other material i can recommend. we are working on putting together an eText, but that will take a bit of time to complete. in the meantime, id recommend just searching around online. on the web you can find lots of datasets and examples of analysis done on them. you can then just save a copy of the data for yourself, and try to repeat their analysis. hope that helps you out!
@ravinduabeygunasekara833
@ravinduabeygunasekara833 8 жыл бұрын
+MarinStatsLectures thanks a lot sir
@tuhinsuryachakraborty
@tuhinsuryachakraborty 3 ай бұрын
Yo great
@gosiama480
@gosiama480 4 жыл бұрын
Why the heck tutors at uni dont teach like you!!!
@yuvenmuniandy8202
@yuvenmuniandy8202 8 жыл бұрын
Hi Your videos are awesome! By the way I want to know how to save the console outputs to html, Rmd, and Rproj files. Kindly could you please help
@nehapachpande7556
@nehapachpande7556 7 жыл бұрын
Hello Make, I am beginner of R and this are very good lectures for beginners. Thanks for sharing such valuable stuff. I have question can you please Ans it: AS shown in lecture number 7 I found that "types of Class" (Variable type). Its shows Age as "Interger" and LungCap & Height as "Numeric" but when I tried with Rstudio with same example it show me "numeric" for all three variable (LungCap, Age,Height). Why?
@endospore1
@endospore1 8 жыл бұрын
Thank you so much for these tutorials! I just need a little help, I tried the attach command and I am getting a message saying the object is masked by GlobalEnv. I have tried to detach and the help function but I keep getting plus signs. What did I do wrong? Thank you again.
@marinstatlectures
@marinstatlectures 8 жыл бұрын
Hi +endospore1 that's because you have either 1) attached it multiple times, or 2) have read in and attached 2 different datasets that have at least one same variable name (and have not detached them). what this error mean is that, for example, you have attached a dataset with a variable "Age" and then you have attached again something that has a variable "Age", and one of them is overwritten (masked) by the other. each time you attach data, when your done working, you should detach it. id suggest to start by detaching the data that you've used, and enter this command over and over until you get an error. (e.g.) detach(data), then again detach(data), and so on. once you get an error message, this means that there are no more versions of 'data' attached. for example if you enter that command 3 times with no error, and then on the fourth you get an error, that means that the "data" was attached 3 times, and you removed all 3 of those, and on the fourth try R is telling you that "there is nothing called data to detach", and so it gives you an error. this will most likely solve your problem. and in the future, make it a habit to detach data that you've attached when you are done working. and just attach the next time you start up again. on a side note, this is what from a programming/coding point of view, it is better to work with $ and not attach. (e.g.) *data$variable* , not *attach(data)* and then just call on *variable*. but for introduction to a beginner, it is easier to avoid the use of the $, and just work with attached data.
@geetharaghukumar4929
@geetharaghukumar4929 6 жыл бұрын
Hi Mike, Your lectures are so clear and easy to follow. I am still at the early stages and when I am trying to start working with the data in LungCapData2, my R Studio is reading the categorical variables gender and smoke etc as character, but when I put in the command for levels of these, it returns it as "NULL" and when I try to summarize, it does not put out the frequencies of the categorical variables. Could you, please, explain, what might be going wrong? Thanks, GR
@Valky1988
@Valky1988 6 жыл бұрын
You have to convert the column format from character to factor, for example: LungCapData$Gender
@geetharaghukumar4929
@geetharaghukumar4929 6 жыл бұрын
Thanks.
@edhava
@edhava 7 жыл бұрын
Sorry, if this is a dumb question. I am just getting started with R. Qsn: What are the disadvantages of working with data 'attached' . Does it takes up RAM space and slows down the process of certain functions?
@soham6649
@soham6649 7 жыл бұрын
If the data is small, it wont take up much of the systems memory. However if you have loads of rows (really only applicable to industrial level application) then your computation time will be slower
@pedrokobler6555
@pedrokobler6555 2 жыл бұрын
Hi, Mike! There is a difference between working with an attached data frame and using '$'. While using an attached data frame, the command does not change the content of the data frame. Smoke
@marinstatlectures
@marinstatlectures 2 жыл бұрын
That’s correct. Your first command there will change the “attached” smoke variable to a factor but the smoke variable inside the data frame will remain as it originally is. In general it is better to work without attaching data, but since my videos are geared more towards beginners with R (at least the earlier series videos), I try to reduce the amount of syntax necessary and make it a bit more simple visually
@joohojeong6261
@joohojeong6261 8 жыл бұрын
Thanks for the lectures. Without your lectures, I would not be able to keep up with my statistics classes. By the way, I tried to Import the dataset but it keeps failing to do so. What can I do to keep this from happening?
@marinstatlectures
@marinstatlectures 8 жыл бұрын
thanks +doe john , good to hear that! you'll have to elaborate on the error a bit in order for me to help. knowing that the data is failing to import isn't enough for me to troubleshoot you error and let you know what you're doing wrong. if you explain a bit more about what you're doing, and the error you are getting, i can try to help you out...
@joohojeong6261
@joohojeong6261 8 жыл бұрын
okay its like this : Error in file(con, "r") : cannot open the connection In addition: Warning message: In file(con, "r") : cannot open file 'C:/Users/二쇳샇/Desktop/MarinLectures/LungCapData.prn': No such file or directory
@joohojeong6261
@joohojeong6261 8 жыл бұрын
when I try to import the dataset
@marinstatlectures
@marinstatlectures 8 жыл бұрын
Hi doe john , ok, it sounds like it's probably because the file extension is .prn . I'm not sure exactly what format that is, or what info it contains with it, but i don't think R can handle that format of file. it's better to save the file as a .txt or as a .csv file. it may also be that the path to the file is incorrect, as the error is saying that the file or directory don't exist. id suggest to save the file as a .csv or .txt file , and id also suggest either instead of specifying the path to the file, you use *file=file.choose()* in the read.tale command when reading in the data, or just use the *"import dataset"* tab in RStudio, as both of these avoid having to specify the path to the file.
@joohojeong6261
@joohojeong6261 8 жыл бұрын
okay thanks.
@artarz9542
@artarz9542 4 жыл бұрын
Hi, I just begin using R statistic and learn from the very basic. You're video truly helpful. However, I found issues, when I typed class(), it revealed "character" instead of factor. I attempted to use as.factor(), it wasn't working still. Moreover, in levels() function, it then revealed "NULL", do you have an idea what is going wrong here?
@ryanr2986
@ryanr2986 Жыл бұрын
any one reading this i am having the same problem
@RandolphAbelardo
@RandolphAbelardo 8 жыл бұрын
is there a command to print / view the classes of all the variables (timeframe 4:30)? really like your channel! it's as if you're conversing with me, unlike others that sounds robotic or sound as if they're just reading from the powerpoint deck : ) thanks in advance.
@marinstatlectures
@marinstatlectures 8 жыл бұрын
Thanks +Randolph Abelardo ! sure, if you enter the command *sapply(data, class)*, R will "apply" the "class" function (asking the class of a variable) to all of the columns of *data*. and it is worth mentioning that the "apply" family of functions (apply, sapply, lapply,.) can be used for much more than this...then can 'apply' a function to rows/columns of a data frame, etc.
@paulinalewandowska6390
@paulinalewandowska6390 7 жыл бұрын
Thank you very much for your great videos! They are a HUGE help for me, struggling to learn statistics in a right way :) I wonder if you could advise me something on one problem. I keep getting 'NULL' for all columns after calling the 'levels()' function, and all materials on R in internet sound like a foreign language to me, I simply don't know how to solve this :( I tried to attach levels on my own, but then the 'summary()' doesn't reveal more detailed information about the data (like the number of "female" and "male" in "Gender", etc.). I wonder if there's something to do about this?
@sujeetkushwaha4791
@sujeetkushwaha4791 6 жыл бұрын
can we meet sujeetkuwh@gmail.com
@shyamshankarh.r9762
@shyamshankarh.r9762 2 жыл бұрын
We should have converted those columns to factors (if not done automatically). Use: LungCapData$Smoke
@alighadami2519
@alighadami2519 2 жыл бұрын
Hi, thank you very much for the video. I have a question about the class of the Gender, Smoke, Caesarean. In you tutorial it shows them as a "factor", however in my R studio it's shown as a "character". And when I use Levels() command on them it returns "NULL". Also in summary () results for example for gender, it doesn't show me how many how many "males" and how many "females" separately, it only show the total number. I would appreciate it if someone has an answer for this.
@oliviaglass137
@oliviaglass137 11 ай бұрын
I also have this outcome!
@pedromrfernandes
@pedromrfernandes 7 жыл бұрын
Hi Mike I've not been able to find out how to create lag variables in R. Can you help me? Thanks
@anasbafaqeeh4193
@anasbafaqeeh4193 5 жыл бұрын
Hello... although along of time with this video, but still great reference for learning R... if you do not mind, i have a question that have bothered me.. what the differences between typeof(), class(), mode(), str()?
@marinstatlectures
@marinstatlectures 5 жыл бұрын
it is quite confusing, and difficult to explain...this may help... stats.stackexchange.com/questions/3212/mode-class-and-type-of-r-objects
@xueqizhang8112
@xueqizhang8112 7 жыл бұрын
Helle, Mike! I have a problem with the class of variables Smoke, Gender and Caesarean. When I 'm loading the data into RStudio, it presumably sets these variables to be character. I want to change the class to factor by choosing the factor option from the drop down menu alongside the variable. Then there's a pump showing "please enter the format string". So what should I enter? I've googled online and found no answer. RStudio 1.0.44, MAC 10.11.4 . Thank you.
@syedrezwankabir1070
@syedrezwankabir1070 8 жыл бұрын
Thank you for these videos, very helpful. I have a question, when I am dealing with a data set of about 57000 rows and try to do the same thing like calculating age, an error pops up. it says-[reached getoption("max.print)--omitted 47000 entries]. What does it mean? How do I solve this problem?
@marinstatlectures
@marinstatlectures 8 жыл бұрын
Hi +Syed Rezwan Kabir , the error is because you are trying to "print" (or show) all of the observation in the console in R, and R will only show the first 10000 observations. so R is jut telling you that beyond the first 10000 observations, it will not how anymore. this isn't really an error thought. you can still do everything with your data, you just ant view all of it in the console. but you can still do everything else, like *mean(age)* will calculate the mean of age, etc. hope that clears it up for you
@mayanbriller655
@mayanbriller655 7 жыл бұрын
while attaching the dataset, I did not see the new variables appear in the "workspace" area. why? are they not local variables now?
@SiddharthSharma21
@SiddharthSharma21 6 жыл бұрын
can we put AGE in a variable and use it as and when required ? Personally, it's convenient than what is already stated. Isn't it ?
@mumtazalam2289
@mumtazalam2289 7 жыл бұрын
> levels(Smoke) NULL > levels(Gender) NULL > levels(Smoke) NULL > > levels(Gender) NULL >
@questscape
@questscape 3 жыл бұрын
In the video class(Caesarean) was a factor but for me, it was a character so doing as follows helped in to run the levels command. When initializing a data frame, pass stringsAsFactors = T in the initialization eg. dataFrame
@Max-my6rk
@Max-my6rk 7 жыл бұрын
Man you can open a course on Udemy! I really hope to see some advanced class from you! plz!
@Erqin
@Erqin Жыл бұрын
Hi Mike. Thanks for the video. For levels command, I just get 'null'. What is the problem? Thanks.
@marinstatlectures
@marinstatlectures Жыл бұрын
It sounds most likely like your variable is a ‘character’ not a factor. You need to classify it as a factor on import, or use the as.factor() command to change it to a factor once imported
@andreannebenidir7765
@andreannebenidir7765 9 жыл бұрын
Hello Mike, have to say great explanations for working with these variable types of data. Simple question I'm sure but still thoughts I'd throw it out here for peace of mind. I'm getting the data classes integer as distinct from numeric and factor. Unclear as to what the difference really is between integer vs. numeric rather than numeric having decimal places...I would have thought however that is would all be coded as numeric. R gives similar type of summary for both so I'm not being too concerned with this distinction at the moment. Is there something more sensitive that I should know about this distinction in R? Thanks so much.
@marinstatlectures
@marinstatlectures 9 жыл бұрын
***** , someone asked this question before, so I'm just going to copy/paste my reply from there: there's not much difference from the user-point of view. what happens with R internally will be a little bit different depending on if the object is of class "numeric" or "integer", but from a practical point of view, when using R, it wont make much difference to you if you have the 0/1's as numeric or integer. unless your data set is extremely large, it wont matter much either way. you can always do some reading about data types in computer languages if you want to understand the subtle differences. but from the point of view of analyzing some data, it wont make much difference to you (externally, the two classes are treated pretty much the same)
@andreannebenidir7765
@andreannebenidir7765 9 жыл бұрын
MarinStatsLectures Thank you for your response. Much appreciated
@TheCooPeer
@TheCooPeer 5 жыл бұрын
How can I exclude missing values( NA values) from being transformed using the as.numeric command? When I have missing data values ALL of the values I want to transform become NA..
@julianvermeersch6341
@julianvermeersch6341 9 жыл бұрын
Hi Mike, i have some data, and 3 variables to it, yes no and NA, how can I recall the variable without the NA responses?
@marinstatlectures
@marinstatlectures 9 жыл бұрын
Hi Jn Vermeersch , you can use the *na.omit()* command. for example, suppose you have the following variable: *x
@pranavgarimella8987
@pranavgarimella8987 3 жыл бұрын
thank you for the great tutorials. I have been following along so far and it has been excellent. I was trying some of the code you were showing and for some reason, I am receiving a diffent output for the yes/no variables and was wondreing if you can tell me why? I have pasted the outpout for the variable 'smoke' below after running the summary command. Thanks for your great videos > summary(LungCapData$Smoke) Length Class Mode 725 character character
@marinstatlectures
@marinstatlectures 3 жыл бұрын
It is because the smoke variable is “character” while for me it is a “factor”. Character is essentially R seeing this as words rather than categories. You can change smoke to a factor when importing the data, or by using LungCapData$Smoke
@pranavgarimella8987
@pranavgarimella8987 3 жыл бұрын
@@marinstatlectures Thanks, yes. I watched until the end of your 'Handling variables lecture' and did just that :D thanks for the great tutorials.
@rakeshreddy4827
@rakeshreddy4827 3 жыл бұрын
Hello Martin, When I am using levels for the same data set , I am getting NULL. Can you help with this please
@dimamedvedev4124
@dimamedvedev4124 3 жыл бұрын
When I do all like on this video but using own file I recive NA for mean command. Class variable is numeric for my data. Summary works well but mean, max and othe command does not. Could me advise anyone, please?
@ksairamreddy5540
@ksairamreddy5540 7 жыл бұрын
R studio is showing class(caesarean) is a character and not a factor. Can you please say me the difference between character and the factor
@salmanniaz91
@salmanniaz91 3 жыл бұрын
Sir ! I make work sheet same as you and also I change the variable class as you shown but summary of my data is not showing frequencies. for example in your video its showing Gender , male:367 , Female : 364 while my data only show character in written form like this Gender, class : character, mode : character
Subsetting (Sort/Select) Data in R with Square Brackets | R Tutorial 1.9| MarinStatsLectures
4:39
MarinStatsLectures-R Programming & Statistics
Рет қаралды 291 М.
Importing , Checking and Working with Data in R | R Tutorial 1.7 | MarinStatsLectures
8:46
MarinStatsLectures-R Programming & Statistics
Рет қаралды 456 М.
A little girl was shy at her first ballet lesson #shorts
00:35
Fabiosa Animated
Рет қаралды 15 МЛН
Slow motion boy #shorts by Tsuriki Show
00:14
Tsuriki Show
Рет қаралды 9 МЛН
路飞太过分了,自己游泳。#海贼王#路飞
00:28
路飞与唐舞桐
Рет қаралды 35 МЛН
Red❤️+Green💚=
00:38
ISSEI / いっせい
Рет қаралды 87 МЛН
Loops using R programming
13:37
R Programming 101
Рет қаралды 12 М.
Bootstrap Hypothesis Testing in R with Example | R Video Tutorial 4.4 | MarinStatsLecutres
14:48
MarinStatsLectures-R Programming & Statistics
Рет қаралды 50 М.
Selecting and removing rows in R dataframes
11:06
Richard Webster
Рет қаралды 161 М.
8.3 Effect Modification: Stratifying vs Modelling With Interaction Term
9:40
MarinStatsLectures-R Programming & Statistics
Рет қаралды 9 М.
Lubridate - how to manipulate date and time data in R
18:05
R Programming 101
Рет қаралды 10 М.
Factor Variables in R
9:51
Equitable Equations
Рет қаралды 17 М.
Importing/Reading Excel data into R using RStudio (readxl) | R Tutorial 1.5b | MarinStatsLectures
8:12
MarinStatsLectures-R Programming & Statistics
Рет қаралды 197 М.
How to interpret (and assess!) a GLM in R
17:36
Chloe Fouilloux
Рет қаралды 26 М.
R Tutorial - Using the Data Frame in R
5:24
DataCamp
Рет қаралды 219 М.
A little girl was shy at her first ballet lesson #shorts
00:35
Fabiosa Animated
Рет қаралды 15 МЛН