Description Usage Arguments Value Author(s) Examples
Function unifies most common reading data functions. It guesses the file extenstion and fits best function to load. Usually knowing types of parameters as: separator, decimal, header is not necessary, but function allows to put them by hand. Supported extensions: "txt", "csv", "xlsx", "tsv", "rda", "rdata", "json".
1 2 |
path |
the name of the path which the data are to be read from. Each row of the table appears as one line of the file. If it does not contain an absolute path, the path name is relative to the current working directory, |
file_extension |
the type of file which is loaded. Usually don't needed, because Hugo guesses it. |
header |
a logical value indicating whether the file contains the names of the variables as its first line. If missing, the value is determined from the file format: header is set to TRUE if and only if the first row contains one fewer field than the number of columns. |
separator |
the field separator character. Values on each line of the file are separated by this character. If sep = "" the separator is 'white space', that is one or more spaces, tabs, newlines or carriage returns. |
decimal |
the character used in the file for decimal points. |
file_name_to_save |
the name of the file where the data will be saved. |
Returns data.frame, tibble or a list.
Dariusz Komosinski
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 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 | ## Not run:
### simple loading most common types of extensions
#loading csv
path <- "http://insight.dev.schoolwires.com/HelpAssets/C2Assets/C2Files/C2SectionRobotSample.csv"
data <- hugo_read_data(path)
head(data)
#loading rda
path <- system.file("extdata", "example.rda", package = "hugo")
data <- hugo_read_data(path)
head(data)
#loading json
path <- "https://raw.githubusercontent.com/corysimmons/colors.json/master/colors.json"
data <- hugo_read_data(path)
head(data)
### specifying our own parameters
#loading csv
path <- "http://insight.dev.schoolwires.com/HelpAssets/C2Assets/C2Files/C2SectionRobotSample.csv"
data <- hugo_read_data(path, separator = ",", decimal = ".", header = TRUE)
head(data)
### interaction with user
# loading file without extension
path <- system.file("extdata", "no_extension", package = "hugo")
# input "txt"
data <- hugo_read_data(path)
head(data)
# providing your own parameters
path <- system.file("extdata", "example2.txt", package = "hugo")
data <- hugo_read_data(path, decimal = ".")
# an error occured, but you have an information to put ALL parameters
data <- hugo_read_data(path, header = TRUE, separator = ",", decimal = ".")
head(data)
### more examples
# for more examples please put an extension in <extension> below
# and try other avaliable sample files attached to package
# path <- system.file("extdata", "example.<extension>", package = "hugo")
# data <- hugo_read_data(path)
# head(data)
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.