Export Data from R (csv , txt and other formats) | R Tutorial 1.6 | MarinStatsLectures

Поделиться
HTML-код
  • Опубликовано: 23 авг 2024
  • Export data out of R: How to Export Data out of R and Save in Various Formats: csv, tab-delimited, space-delimited. Find the Practice Dataset(DataToExport) and R Script: (bit.ly/2rOfgEJ); 👍🏼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 Thumbs up! Either way We Thank You!
    How to export data out of R and save in various formats such as csv, tab-delimited, space-delimited:
    ▶︎ In this R programming video tutorial, you will learn to use various R functions such as "write.table", "write.csv", "write.csv2", “write.command” and "write.delim" to export data out of R.
    ▶︎ In this tutorial, you will learn to use "sep" argument to specify the file format or separator for the values, “row.names” argument to include or exclude the row names.
    ◼︎ Table of Content:
    0:00:34 Introducing the 'write. table' command for exporting data out of R.
    0:00:39 How to access the help menu for a command in R
    0:00:53 How to use the 'write.table' command in R Software
    0:01:08 How to use "sep" argument to specify the file format or separator for the values in R
    0:01:50 How to include or exclude the row names while exporting data out of R Programming software using 'row.names' argument
    0:02:21 How to save file exported from R to a folder other than the current working directory:
    0:03:01 How to use the "write.csv" command to export data from R (this will not require using "sep" argument as it is implied in the write.csv that we would like this to be saved as a comma separated value file)
    0:03:22 a quick overview of "write.csv2" command that is used in Western Europe and would use a comma for a decimal point and a semicolon for a separator rather than a comma
    0:03:33 How to use write.command in for saving in other file formats for example a tab delimited text file
    These video tutorials are useful for anyone interested in learning data science and statistics with R programming language using RStudio.
    ► ► Watch More:
    ► Intro to Statistics Course: bit.ly/2SQOxDH
    ►Data Science with R bit.ly/1A1Pixc
    ►Getting Started with R (Series 1): bit.ly/2PkTneg
    ►Graphs and Descriptive Statistics in R (Series 2): bit.ly/2PkTneg
    ►Probability distributions in R (Series 3): bit.ly/2AT3wpI
    ►Bivariate analysis in R (Series 4): bit.ly/2SXvcRi
    ►Linear Regression in R (Series 5): bit.ly/1iytAtm
    ►ANOVA Concept and with R bit.ly/2zBwjgL
    ►Hypothesis Testing: bit.ly/2Ff3J9e
    ►Linear Regression Concept and with R Lectures bit.ly/2z8fXg1
    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!

Комментарии • 105

  • @marinstatlectures
    @marinstatlectures  5 лет назад +20

    In this R stats video, we learn to use various R functions such as "write.table", "write.csv", "write.csv2", “write.command” and "write.delim" to export data out of R and save in various formats such as csv, tab-delimited, space-delimited. Make sure to practice with the free Dataset(‘DataToExport’) and R Script here: (bit.ly/2rOfgEJ); ) If Like to support us you can Donate (bit.ly/2CWxnP2), Share our Videos, Leave us a Comment, Give us a Like 👍🏼 or write us a review! Either way We Thank You!

    • @atifdai313
      @atifdai313 3 года назад

      how to check the current working directory?

  • @khramterl
    @khramterl 6 лет назад +21

    You are a hero of science, my friend.

  • @ParanoidMarvinMk2
    @ParanoidMarvinMk2 6 лет назад +17

    I recommend this series as THE go-to intro reference for undergrads learning R. I still use it as a reference myself sometimes. Keep up the good work!

  • @sartiw
    @sartiw 4 года назад +2

    Hi Marins, Hello from Brazil. This is my second try to lerning R. You are the best teacher I ever seen. Thanks for the classes.

  • @katomoon6170
    @katomoon6170 2 года назад +2

    Many thanks. Your students are very previliged and lucky to have you as their professor. You are such a wonderful instructor capable of making complex topics so easy to understand. God bless you and your entire team behind these videos including your little son whose voice appears at the end of some of stats /R these videos.

  • @crazystats1413
    @crazystats1413 8 месяцев назад +1

    Thank you Martin, you are really doing a great job of explaining R

  • @yaseminozturk5863
    @yaseminozturk5863 3 года назад +1

    You are wizard of R. Simple and straightforward explanations. Really helpful. These videos saved my day :)

  • @deepandharmaraj4513
    @deepandharmaraj4513 5 лет назад +4

    Hi Mike your tutorials are absolutely fantastic and very easy to follow superb work please keep posting tutorials on R! Thank you so much for producing excellent R video tutorials!

  • @izabelaedmunds9746
    @izabelaedmunds9746 6 лет назад +5

    Nice to see you back on this channel 👍

    • @marinstatlectures
      @marinstatlectures  6 лет назад +1

      thanks, things got quite busy in our lives for the past couple of years, but we're gearing up to create a bunch of new videos over the coming months :)

  • @umaralhajiabubakar4869
    @umaralhajiabubakar4869 5 лет назад +3

    Great. This is so self explanatory and help-full. Thanks

  • @charleshenderson4373
    @charleshenderson4373 6 лет назад +2

    Excellent, "to the point" presentation! Thanks!

    • @marinstatlectures
      @marinstatlectures  6 лет назад

      thanks, appreciate that Charles! we try our best to pack as much info into as little time as possible, while keeping it easily digestible and not feeling like a cognitive overload!

  • @sokielevel1
    @sokielevel1 2 года назад

    you saved my life. good contents.

  • @flamboyantperson5936
    @flamboyantperson5936 6 лет назад +3

    Great to see you back. Could you please make videos on advance machine learning in R? Thank you.

    • @marinstatlectures
      @marinstatlectures  6 лет назад +4

      thanks, we will likely get there at some point, but for the time being we are more focussed on introductory and intermediate methods, and we also have a bit of a focus on applications of stats in Epidemiology, as i teach biostatistics in the school of population and public health at UBC, and so a lot of what we create is relevant to the courses I'm teaching here.

    • @flamboyantperson5936
      @flamboyantperson5936 6 лет назад +2

      That would be awesome if you teach us application of statistics in Epidemiology. I'm waiting to learn from your videos.

  • @bliksum58
    @bliksum58 6 лет назад +3

    Awesome!!! I love the way you teach.

  • @Sina69devil
    @Sina69devil 5 лет назад +1

    Your videos are so helpful! I want to thank you, and plz keep making these learning videos

    • @marinstatlectures
      @marinstatlectures  5 лет назад +1

      thanks! we plan on continually making these videos :)

  • @luizguilhermedefreitasbord5802

    Thank you professor! That helps me

  • @infinitecosmos
    @infinitecosmos 4 года назад

    you are very good teacher

  • @sangeethab3652
    @sangeethab3652 6 лет назад +3

    Thanks a lot for the series...

  • @romerootavio368
    @romerootavio368 3 года назад

    tks Marin for the excellent class! Hugs

  • @nisarbaig3050
    @nisarbaig3050 5 лет назад +3

    thank you so much for this video.

  • @Ommbye
    @Ommbye 2 года назад

    Thanks very easy to understand!

  • @sibusisomani1746
    @sibusisomani1746 2 года назад

    Thanks a lot for this demonstration

  • @sophieroux2063
    @sophieroux2063 4 года назад +1

    Hi Mike, can you please tell me the code you used to save the data as the object 'DataToExport'?

  • @amatwumwaaacheampong3227
    @amatwumwaaacheampong3227 5 лет назад

    Thanks very much. The best so far

  • @gautamspeax
    @gautamspeax 3 года назад

    Cool, very nice and to the point, I wasted half hour trying to do it using websites and blogs, they all overcomplicated things, this is so much easier, R is easy if some wankers don't try to make it look difficult (ps. sorry that I said it like that).

  • @tharushanonis8046
    @tharushanonis8046 3 года назад

    Thank you very much it is really helpful

  • @puspitalestarikhanna8582
    @puspitalestarikhanna8582 2 года назад

    thanks, so helpful !!

  • @Ninenine3
    @Ninenine3 2 года назад

    Very useful ! Thanks a lot

  • @cindyelizabethchavarriamin7999
    @cindyelizabethchavarriamin7999 5 лет назад

    I love your videos! This video was super helpful.

  • @yadunandanacharya8951
    @yadunandanacharya8951 5 лет назад

    Like these can you please send Python for Data science, because of this channel I'am getting confidence to study Data Science, thank you so much sir.

    • @marinstatlectures
      @marinstatlectures  5 лет назад

      Hi, at the moment we dont have plans to create videos for Python. we have too much to cover with R and with general statistics concepts. glad to hear that youre finding our videos useful!

  • @MsRSecon
    @MsRSecon Год назад

    Thank you for the video . Have you done or can you do a video on how to consolidate data set using different sources . Thank you

  • @Aviseniamarina
    @Aviseniamarina 5 лет назад +1

    Thank you for the informative tutorial. I have a small question, how to export an r object which contains data in tibble format to csv file. and also how to convert tibble to normal data.frame object. Thank you so much for your help.

  • @MitaTRAN
    @MitaTRAN 6 лет назад

    I have .txt file, I dont know how to export file .bed or .bedGraph? Could you nice help me how to do? Thank you very much!

  • @chiragsharma4606
    @chiragsharma4606 4 года назад +1

    how do I export 100 files as a CSV format in a folder without writing scripts again and again?

  • @Bromoteknada
    @Bromoteknada 6 лет назад +2

    Thanks!!!

  • @myworld6303
    @myworld6303 2 года назад

    😍 it was perfect

  • @magdalenaa99
    @magdalenaa99 4 года назад

    that helped a lot, THANK YOU!!!

  • @user-bf6sk3gu5u
    @user-bf6sk3gu5u 3 года назад

    Is there a convenient way to open the exported file automatically from an R script? (Equivalent to double clicking the file and having it open in excel, etc)

  • @swastikaputri
    @swastikaputri 2 года назад

    i have a data imported using GetSymbols (quantmod), and tried to export it in excel sheet. Yet, using write.table command, the date column is left out. Please suggest what best to do.. thank you!

  • @Damadedatos
    @Damadedatos 2 года назад

    May the lord bless you

  • @macramalho
    @macramalho 3 года назад

    Hi!
    Do you know or have a tutorial about how I export a .csv file or table to a Sharepoint folder?
    Thank you!

  • @roiad876
    @roiad876 4 года назад

    Hello thanks for the tutorial, do you know the best way to export data produced with lavaan? I created a df with the summary of cfa but it came up all wrangled up, no headers or nothing.

  • @wardahmustahsan888
    @wardahmustahsan888 5 лет назад

    What if it's a large amount of data with max.print = 100,000. The reason I am asking is sometimes at the end of data you may get omitted ### entries. If I try sink it gives the same output the consel gives not the complete output. How do I fix that?

  • @thegdt37
    @thegdt37 4 года назад +1

    Hello Mike,
    When I export my data as .csv and open it in Excel, all data are fit in only one column and data in the same row are seperated by commas. How can I solve this problem? Thanks for the videos by the way.

    • @thegdt37
      @thegdt37 4 года назад +4

      *I used write.csv2 and it is solved.*

    • @exelyugure
      @exelyugure 2 года назад

      @@thegdt37 thanks

  • @ravikrishnarpan
    @ravikrishnarpan 3 года назад

    Can we export the data from R studio to a Web Application?

  • @same9309
    @same9309 Год назад

    TYSM

  • @sia_ibk
    @sia_ibk 3 года назад

    I exported data using the write.csv function, but the table gets truncated. The original table has 4,073,561 rows, but the csv file has about 700,000 rows. Please how do I rectify this?

  • @alexisjose7515
    @alexisjose7515 4 года назад

    Hi Marin, I'd like calculate the odds radio with library "finalfit", buy I can't open my data set, which is .sav (spss file). Do you now a form to open this file and calculate the odds radio?, please. Thank you

  • @kalpeshyajnik
    @kalpeshyajnik Год назад +1

    I am getting error: Error in is.data.frame(x) : object 'DataToExport' not found. How to resolve it?

    • @easydatascience2508
      @easydatascience2508 Год назад

      You can watch mine. Playlists for Python and R provide most of the fundamentals, step by step tutorials with downloadable source files.

  • @chrisbrook3480
    @chrisbrook3480 5 лет назад

    how do you set the name of the file as data from a variable e.g. creating the file in a for loop (so it wouldn't be overwritten when the next file is created)
    thanks in advance :)

  • @gehadmohamed9751
    @gehadmohamed9751 Год назад

    thx sir🥰🥰

  • @infamousprince88
    @infamousprince88 3 года назад

    Is there a way to export graphs from R to Excel?

  • @lucasguidi
    @lucasguidi 4 года назад

    Hello, I'm trying to export a table by Power Query using R, I tried the following code
    # 'dataset' has input data for this script
    write.table (dataset, file = paste0 ("C: / Users / Acer / OneDrive / ALLPARTS / VIN_", Sys.time (), ".csv"))
    I want to save it with the date so I don't overlap my files, can you help me? Do you have another suggestion? I wanted a date format that was yyyymmdd. It's possible?
    Thank's for your time!

  • @runsenliu3226
    @runsenliu3226 5 лет назад +1

    Hi, in order to export data, there should be data in advance. But I can only see the code in the link and where is the data? Thanks.

    • @marinstatlectures
      @marinstatlectures  5 лет назад

      Hi there, you should be able to see the dataset (DataToExport) now (statslectures.com/r-scripts-datasets)

    • @runsenliu3226
      @runsenliu3226 5 лет назад

      @@marinstatlectures I click the website and it shows Error 404.

    • @shahabuddin1559
      @shahabuddin1559 5 лет назад

      @@runsenliu3226 correct one is statslectures.com/r-scripts-datasets

    • @cyrilatung8467
      @cyrilatung8467 5 лет назад

      @@runsenliu3226 Mike you are a life saver in this tutorial. All your tutorials are simple and clear

  • @MJA0983
    @MJA0983 4 года назад

    The 2nd step where you attempt to set row.names = f does not work. It produces an error message "Error in isTRUE(row.names) : object 'f' not found"

    • @marinstatlectures
      @marinstatlectures  4 года назад +1

      It needs to be either F or FALSE , R is case-sensitive, and so it doesn’t recognize a lower-case f as meaning false

  • @aishwaryawalkar5950
    @aishwaryawalkar5950 3 года назад

    Why I am getting error "DataToExport" not found :/

  • @alexrika5692
    @alexrika5692 5 лет назад

    Hey, you create a CSV file but how does it show in an Excel file on each column. I do that then i get a file where the rows contain the data separated by ",". Can you help me?

    • @marinstatlectures
      @marinstatlectures  5 лет назад +2

      Hi, either click on the file and use “open with”, and then select Excel. Or, go into Excel, then under file select to “open” a file, and then select the csv file there

  • @lalitjoshi97
    @lalitjoshi97 4 года назад

    If I have to export a table into CSV format, which I've just imported from some Database, using R, will I be able to do so?

  • @tamikabrown1409
    @tamikabrown1409 5 лет назад +1

    I've clicked on both links in the description, and I can't find the Dataset "DatatoExport". I only see the R script

    • @marinstatlectures
      @marinstatlectures  5 лет назад

      Hello there, thanks for letting us know!It is fixed now, you should be able to find the dataset now statslectures.com/r-scripts-datasets

    • @tamikabrown1409
      @tamikabrown1409 5 лет назад

      Thanks so much. I got it

  • @divyamehra2708
    @divyamehra2708 3 года назад

    i try it ! but i can't run its show me error in data frame

  • @markk364
    @markk364 5 лет назад

    Great video - thank you.
    For me - the write.table command is returning errors - can anyone help please?
    write.table(datatoexport, file="ExportedLundDataExample.csv", sep=",")
    Error in file(file, ifelse(append, "a", "w")) :
    cannot open the connection
    In addition: Warning message:
    In file(file, ifelse(append, "a", "w")) :
    cannot open file 'ExportedLundDataExample.csv': Permission denied

    • @prabpharm07
      @prabpharm07 5 лет назад

      for file argument, supply the "complete directory path" (e.g. file="D:/PrabhakarP/LungCapData.csv"), not just the name of the file, how would R know where that file is stored in your computer. Also, note the use of \ instead of / while writing the directory path.

  • @Pontiakos
    @Pontiakos 5 лет назад

    Help, when I do this I get the following error: Error in as.data.frame.default(x[[i]], optional = TRUE, stringsAsFactors = stringsAsFactors) :
    cannot coerce class ""summary.multinom"" to a data.frame. What can I do to correct the error?

    • @marinstatlectures
      @marinstatlectures  5 лет назад

      Hi, it is hard to tell without knowing the code you've used, and what you're trying to export, etc... but the error message suggests that you are trying to export the "summary" from a fitted model...and this won't work. the write.table is to export something that is saved as a data frame (or in a matrix format).

    • @Pontiakos
      @Pontiakos 5 лет назад +1

      @@marinstatlectures that is correct. It is a fitted model. What command can I use to export?

  • @anandanmremo
    @anandanmremo 2 года назад

    How to download directly to excel instead of CSV..bcos I need format..any expert pls explain

  • @naomisatam1519
    @naomisatam1519 6 лет назад +8

    Donald Trump is -25.5 lol

    • @marinstatlectures
      @marinstatlectures  6 лет назад +4

      glad to see someone caught that! and i must say, that score is still probably too high ;)

  • @slumdogskillionaire923
    @slumdogskillionaire923 4 года назад +2

    The score of Donald Trump is -25 hahahaha :DDDDD

  • @aklepatzky
    @aklepatzky 2 года назад

    On my PC I have to use \\ instead of /, why?

  • @juandiegomunozprieto1224
    @juandiegomunozprieto1224 3 года назад

    Package: Translations (dont know wich version)

  • @aminabahri7638
    @aminabahri7638 5 лет назад

    how can i export data i XML file plz???

    • @marinstatlectures
      @marinstatlectures  5 лет назад

      Hi, very similar to what is shown ins this video, except use *write.xml*. you can see here for more: www.rdocumentation.org/packages/kulife/versions/0.1-14/topics/write.xml

  • @prabpharm07
    @prabpharm07 5 лет назад

    Hi Mike, the link - statslectures.com/r-stats-datasets is not working, please check. Thank you!

  • @chrysenthenum2
    @chrysenthenum2 3 года назад

    this was so unhelful tbh

  • @prfgee8788
    @prfgee8788 3 года назад

    Thanks!