set_read: Read a data set from a data-sheet and turn it into a...

Description Usage Arguments Value See Also Examples

Description

Read a matrix of values from a csv sheet and sort them into a tibble. You can name the values and encode several additional properties into the name, which be split into several columns. Please refer to the vignette (browseVignettes("roxygen2")) and examples below for in-depth explanation and the whys and hows.

Usage

1
2
3
set_read(file_name = "set_#NUM#.csv", path = ".", num = 1, sep = ",",
  dec = ".", cols = 0, rows = 0, additional_vars = vector(),
  additional_sep = "[^[:alnum:]]+")

Arguments

file_name

Name of the file from which to read the data. May contain "#NUM#" as a placeholder if you have multiple files.

path

The path to the file (no trailing "/" or "\" !).

num

Number of the set to read, inserted for "#NUM#".

sep

Separator used in the csv-file, either "," or ";" (see utils::read.csv()).

dec

The character used for decimal points (see utils::read.csv()). "AUTO" will result in "." if sep is "," and "," for ";".

cols

Number of columns in the input matrix (0 means auto-detect).

rows

Number of rows containing values (not names / additional data) in the input matrix (0 means auto-detect).

additional_vars

Vector of strings containing the names for the additional columns.

additional_sep

String / RegExp that separates additional vars, e.g.: "ID_blue_cold" with additional_sep = "_" will be separated into three columns containing "ID", "blue" and "cold". If the separated data would exceed the columns in additional_vars the last column will contain a string with separator (e.g.: "blue_cold"). If data is missing NA is inserted.

Value

A tibble containing (at minimum) set, position, sample_id, name and value.

See Also

Other set functions: set_calc_concentrations, set_calc_variability, sets_read

Examples

 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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
# a file containing only values
read.csv(
  file = system.file("extdata", "values.csv", package = "bioset"),
  header = FALSE,
  colClasses = "character"
)

# read into a tibble
set_read(
  file_name = "values_names.csv",
  path = system.file("extdata", package = "bioset"),
)

# file containing names
read.csv(
  file = system.file("extdata", "values_names.csv", package = "bioset"),
  header = FALSE,
  colClasses = "character"
)

# read a file containing labels and store those in column "name"
set_read(
  file_name = "values_names.csv",
  path = system.file("extdata", package = "bioset"),
  additional_vars = c("name")
)

# file with names and properties
read.csv(
  file = system.file(
    "extdata", "values_names_properties.csv", package = "bioset"),
  header = FALSE,
  colClasses = "character"
)

# read a file containing labels and properties and store those in columns
# "name" and "time"
# splits names by every character that's not A-Z, a-z, 0-9
# to change that behaviour use additional_sep
set_read(
  file_name = "values_names_properties.csv",
  path = system.file("extdata", package = "bioset"),
  additional_vars = c("name", "time")
)

# read file "set_1.csv" containing labels
set_read(
  num = 1,
  path = system.file("extdata", package = "bioset"),
  additional_vars = c("name", "time")
)

# read file "set_2.csv" containing labels
set_read(
  num = 2,
  path = system.file("extdata", package = "bioset"),
  additional_vars = c("name", "time")
)

# read file "plate_2.csv" containing labels
set_read(
  num = 2,
  file_name = "plate_#NUM#.csv",
  path = system.file("extdata", package = "bioset"),
  additional_vars = c("name", "time")
)

bioset documentation built on May 2, 2019, 4 p.m.