Lecture 2.2 - Basic Graphics with ggplot2

Csv le pathtosavelenamedta writexlsxdatcsv le

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: and .xlsx to use the functions write.dta and write.xlsx Saving Data First set the directory to where you like to save the file write.csv(dat.csv, file = "path/to/save/filename.csv") write.table(dat.csv, file = "path/to/save/filename.txt", sep = "\t", na=".") write.dta(dat.csv, file = "path/to/save/filename.dta") write.xlsx(dat.csv, file = "path/to/save/filename.xlsx", sheetName="hsb2") You can save to binary R format for multiple datasets and R objects save(dat.csv, dat.dta, dat.spss, dat.txt, file = filename.RData) Dai-Trang Le Lecture 2.2 - Basic Graphics with ggplot2 Graphics with ggplot2 (25 minutes) Group Discussion (15 minutes) Q and A (10 minutes) Writing Loading Data Saving Data Saving Data to different formats You can save a data in a number of formats, including text .txt, stata .dta, and Excel .xlsx. You will need to install or load two packages, foreign and .xlsx to use the functions write.dta and write.xlsx Saving Data First set the directory to where you like to save the file write.csv(dat.csv, file = "path/to/save/filename.csv") write.table(dat.csv, file = "path/to/save/filename.txt", sep = "\t", na=".") write.dta(dat.csv, file = "path/to/save/filename.dta") write.xlsx(dat.csv, file = "path/to/save/filename.xlsx", sheetName="hsb2") You can save to binary R format for multiple datasets and R objects save(dat.csv, dat.dta, dat.spss, dat.txt, file = filename.RData) Dai-Trang Le Lecture 2.2 - Basic Graphics with ggplot2...
View Full Document

This document was uploaded on 12/05/2013.

Ask a homework question - tutors are online