get_data | R Documentation |
Daten importieren:
Read Text Lines
get_data(
file = NA,
na.strings = NULL,
dec = ".",
sep = ";",
sheet = 1,
range = NULL,
skip = 0,
label = 0,
as_tibble = TRUE,
cleanup.names = TRUE,
cleanup.encoding = FALSE,
cleanup.factor = TRUE,
tabel_expand = FALSE,
id.vars = 1,
value = "value",
user_na = FALSE,
from = "UTF8",
to = "latin1",
encoding = NULL,
header = TRUE,
fill = TRUE,
comment.char = "",
quote = "\"",
...
)
read.text2(
string,
na.strings = c("NA", "na"),
sep = "",
dec = ".",
stringsAsFactors = TRUE
)
file |
Demo.xla, Demo.sav, Demo.csv - ist ein Pfad zu einem csv, xls, sav oder Rdata Datensatz oder ein String in Textformat dierekt im R-File. |
na.strings |
a character vector of strings which are to be interpreted as NA values. |
dec |
the character used in the file for decimal points. |
sep |
the field separator character. |
sheet , skip , range |
an readxl::read_excel |
label |
use attribut label |
as_tibble |
output |
cleanup.encoding , cleanup.names , cleanup.factor |
cleanup UTF-8 = FALSE, |
tabel_expand |
logical FALSE - Tabellen mit haufigkeiten werden als Dataframe im long-Format ausgegeben |
id.vars |
nur mit tabel_expand - Nummer und Name der ID-Variablen bei tabel_expand default ist 1. |
value |
nur mit tabel_expand - Name der output-variable bei tabel_expand. |
user_na |
If TRUE variables with user defined missing will be read into labelled_spss objects. If FALSE, the default, user-defined missings will be converted to NA. |
encoding , from , to |
Encoding |
header |
an SPSS |
fill |
an CSV |
comment.char |
an csv |
quote |
Lesen der csv- Files = ";", = "\"", ".", |
... |
Argumente fuer spss und csv. Bei SPSS-Files kann die Zeichencodierung mit |
string |
character string |
stringsAsFactors |
TRUE |
xlsx: readxl::read_excel(file, sheet, skip, range)
csv: read.table(file, header, sep, quote, dec, na.strings, skip, fill, comment.char)
sav: haven::read_sav(file, encoding, user_na)
Text: read.text2(file, dec)
data.frame
# require(stp25tools)
dat <- get_data("
sex treatment control
m 2 3
f 3 4
",
tabel_expand = TRUE,
id.vars = 1)
xtabs(~ sex + value, dat)
dat <- get_data(
"
sex treatment neg pos
f KG 3 3
f UG 4 5
m KG 5 4
m UG 4 2
",
tabel_expand = TRUE,
id.vars = 1:2,
value = "befund"
)
ftable(xtabs(~ sex + treatment + befund, dat))
## Not run:
if(file.exists("R/dummy.csv")){
get_data("R/dummy.csv", dec = ",", na.strings = "-", skip=1, label=1)
get_data("R/dummy.xlsx", na.strings = "-")
get_data("R/dummy.xlsx")
x <- get_data("R/dummy.sav")
get_label(x)[1:4]
}
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.