Data frames in R - Exporting data in R
Key Takeaways
The video demonstrates how to export data in R using the write.csv and write.table functions, specifically for saving data into shareable CSV files and tab-delimited text documents.
Full Transcript
hi and welcome back to our for statistics and data science in this lesson we will go full circle and complete the stellar saga of importing and exporting data in R so we have our data we have done some manipulations and we want to share our work with others through Dropbox on a flash drive preferably without giving our whole computer away to save your data into a shareable CSV file you use write dot CSV with write dot CSV - version for those of us who use a comma to denote a decimal and to save data into a tab delimited text document you use write that table let's export our Star Wars data from the first lesson on data frames and they sect what's happening if you need to recreate it I have put the code right here so you can pause and copy it obviously the first argument we pass is the data we want saved then we specify what the filename of our data should be once saved it does not have to be identical to the name of the data frame but be careful our is a little little Oh sometimes and for everything to work correctly and for your file to actually save in CSV format you will have to specify that by providing the extension dot CSV in the file name - ok ok finally and this is important the road names argument should be set to false in addition to literal R can be a little buggy sometimes if you save a file with the road names argument set to true it will add an extra column in the beginning of the table marking each row from 1 to n guessing that your actual first column is the names of the rows but wait you think that doesn't sound so bad yeah but it is because if you reopen the file you just saved our will somehow have forgotten it has saved it with this additional column that marks the row numbers and instead we'll consider the numbers to be part of your data and congratulations now you have a column you very much do not need repeat that a few more times and you will end up with n number of redundant columns and nothing to do with them in conclusion adding the row names argument and setting it to false is going to save you some unnecessary work okay I promised a short lesson and that was it thanks for watching everyone for more videos like this one please subscribe
Original Description
👉🏻 Download Our Free Data Science Career Guide: https://bit.ly/319cjkd
👉🏻 FREE MONTH! Get full access to our newly redesigned platform and all our courses (18th October - 18th November): https://bit.ly/3iYuwaf
Let's learn how we can export data in R.
To save your data into a shareable CSV file, you use write.csv (with a write.csv2 version for those of us who use a comma to denote a decimal). And to save data into a tab-delimited text document, the function to use is write.table.
The first argument is the data we want saved. Then, the file name of our saved data must be. This does not have to be identical to the name of the data frame. For everything to work correctly and your file to actually save in CSV format, you’d have to specify that by providing the extension .csv.
IMPORTANT: the row.names = argument should be set to FALSE, because if you save a file with the row.names = argument set to TRUE, it will add an extra column in the beginning of the table marking each row from 1 to n, assuming that your actual first column is just the names of the rows.
Adding the row.names = argument and setting it to FALSE is going to save you a lot of unnecessary actions.
► Consider hitting the SUBSCRIBE button if you LIKE the content: https://www.youtube.com/c/365DataScience?sub_confirmation=1
► VISIT our website: https://bit.ly/365ds
🤝 Connect with us LinkedIn: https://www.linkedin.com/company/365datascience/
365 Data Science is an online educational career website that offers the incredible opportunity to find your way into the data science world no matter your previous knowledge and experience. We have prepared numerous courses that suit the needs of aspiring BI analysts, Data analysts and Data scientists.
We at 365 Data Science are committed educators who believe that curiosity should not be hindered by inability to access good learning resources. This is why we focus all our efforts on creating high-quality educational content which anyone can access
Watch on YouTube ↗
(saves to browser)
Sign in to unlock AI tutor explanation · ⚡30
Playlist
Uploads from 365 Data Science · 365 Data Science · 30 of 60
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
▶
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
Population vs Sample
365 Data Science
Data Science & Statistics: Levels of measurement
365 Data Science
Statistics Tutorials: Mean, median and mode
365 Data Science
Skewness
365 Data Science
What is a distribution?
365 Data Science
The Normal Distribution
365 Data Science
Central limit theorem
365 Data Science
Student's T Distribution
365 Data Science
Type I error vs Type II error
365 Data Science
Hypothesis testing. Null vs alternative
365 Data Science
The linear regression model
365 Data Science
Simple linear regression model. Geometrical representation
365 Data Science
INDEX and MATCH application of the two functions separately and combined [Advanced Excel]
365 Data Science
INDIRECT Excel Function: How it works and when to use it [Advanced Excel]
365 Data Science
VLOOKUP and MATCH another useful functions combination [Advanced Excel]
365 Data Science
VLOOKUP COLUMN and ROW - Handle large data tables with ease [Advanced Excel]
365 Data Science
The ELIF keyword [Python Fundamentals]
365 Data Science
Working with Tuples in Python
365 Data Science
Database Terminology - A Beginners Guide
365 Data Science
Relational Database Essentials
365 Data Science
Database vs Spreadsheet - Advantages and Disadvantages
365 Data Science
Conditional Statements and Loops
365 Data Science
Backpropagation – The Math Behind Optimization
365 Data Science
Monte Carlo: Forecasting Stock Prices Part I
365 Data Science
Monte Carlo: Forecasting Stock Prices Part II
365 Data Science
Monte Carlo: Forecasting Stock Prices Part III
365 Data Science
365 Data Science Online Program
365 Data Science
Data frames - Creating a data frame
365 Data Science
Data Science & Statistics: Slicing a matrix in R
365 Data Science
Data frames in R - Exporting data in R
365 Data Science
Data frames in R - Transforming data PART II
365 Data Science
Data Frames in R - Subsetting a data frame
365 Data Science
Data Science & Statistics: Matrix arithmetic in R
365 Data Science
Data Science & Statistics: Indexing an element from a matrix
365 Data Science
Data Frames in R - Extending a data frame
365 Data Science
Data Science & Statistics: Creating a matrix in R FASTER
365 Data Science
Data Science & Statistics: Creating a Matrix in R
365 Data Science
Data frames - Importing data in R
365 Data Science
Data frames in R - Getting a sense of your data
365 Data Science
Data frames in R - Transforming data PART I
365 Data Science
Data frames in R - Import a CSV in R
365 Data Science
Data Science & Statistics: Matrix operations in R
365 Data Science
Data Science & Statistics: Matrix recycling in R
365 Data Science
Tableau vs Excel: When to use Tableau and when to use Excel
365 Data Science
Download Tableau: Learn how to download Tableau Public
365 Data Science
Connecting data sources: Useful tips when connecting data sources to Tableau
365 Data Science
The Tableau interface: See how to navigate through the Tableau interface
365 Data Science
Tableau data visualization: Create your first Tableau visualization!
365 Data Science
Duplicating sheets: This is how to duplicate a sheet in Tableau
365 Data Science
Build a table in Tableau: The steps needed to create a simple table in Tableau
365 Data Science
Custom fields in Tableau: Using Tableau operators to create custom fields
365 Data Science
Custom fields in Tableau: Add calculations to tables through custom fields
365 Data Science
Totals in Tableau: Learn how to display subtotals and totals in Tableau
365 Data Science
Gross Margin calculation in Tableau
365 Data Science
What is a filter in Tableau: Set up a filter in Tableau to specify the data you want to show
365 Data Science
Joins in Tableau: Inner, outer, left, or a right join in Tableau
365 Data Science
Building a Tableau dashboard: Three types of charts you want to have in a Tableau dashboard
365 Data Science
Creating great looking charts in Tableau: Real life Exercise on charts in Tableau
365 Data Science
Joins in Tableau: Choose the correct join type
365 Data Science
How to make a data check in Tableau: A quick data check is better than no data check
365 Data Science
More on: ML Pipelines
View skill →
🎓
Tutor Explanation
DeepCamp AI