Data files contain one or many variables (as in Matlab). Open file with variables
load("filename")
Note that existing variables in the global environment will be overwritten by the ones saved in the file.
Save file
save(vars, file = "filename)
library(foreign) mydata <- read.dta("filename")
Export via Excel
library(readxl) data <- read_excel("", sheet = "sheetname", col_names = TRUE, skip = 0)
Export
library(xlsx) write.xlsx(mydata100, file = "test", sheetName = "sheet", col.names=TRUE, row.names=TRUE, append=FALSE, showNA=TRUE)
CSV files with semicolon are read with read_csv2()
library(readr) read_csv2(file, col_names = TRUE, col_types = NULL, skip = 0, n_max = -1)
n_max = 100
, only the first 100 rows are read. col_names
are either TRUE/FALSE or a character vector of column names.col_types = "cde_D"
(char, decimal, decimal with comma, ignore, Y-m-d dates), or a list or a named list.How does skip work if col_names = TRUE?
Delimeted files can be read with a similar set of options as read_csv:
library(readr) read_delim(file, delim , ...)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.