Description Usage Arguments Details Examples
these functions are meant for reading various types of configuration files, returning the content as (lists of) data frames.
'read.sheet' reads a file that contains named data.frames and returns the single requested sheet.
1 | read.sheet(file, sheet, header, sep, fileEncoding, stringsAsFactors, strip.white, ...)
|
file |
the name of -or an open connection to- the configuration file. |
sheet |
the name of the sheet that is to be read |
header |
in read.sheet, sets default value to TRUE, as opposed to read.table, where it is FALSE. |
sep |
in read.sheet, sets default value to "\t", as opposed to read.table, where it is " ". |
fileEncoding |
the encoding of the file to be read. |
stringsAsFactors |
in read.sheet, sets default value to FALSE, as opposed to read.table, where it is TRUE. |
strip.white |
in read.sheet, sets default value to TRUE, as opposed to read.table, where it is FALSE. |
... |
passed to included functions |
the first block is assumed to hold only one textual record.
all following blocks are assumed to hold named records formed of only numeric values. the first field is the name of the data.frame in the resulting list, the value of the first field is the name of the record (the row in the data.frame).
an example will help understand. imagine you need defining the global
properties fileDescription
and sourceSystem
and two
'scenario' records, named 'nat' and 'droog'. you put the information
in a dcf file, looking something like this:
1 2 3 4 5 6 7 8 9 10 11 12 13 | fileDescription: overstortput, by LzScripter
sourceSystem: Lizard G-A Functions
scenario: nat
aanslagpeil: -0.38
afslagpeil: -0.40
gemaalcapaciteit: 300.0
scenario: droog
aanslagpeil: -0.42
afslagpeil: -0.44
gemaalcapaciteit: 300.0
|
reading the above file using read.dcf.parsed
will give you a
list with two elements, named '"fileDescription"' and '"scenario"'.
the two elements would look like this:
1 2 3 4 5 6 7 8 9 | $fileDescription
fileDescription sourceSystem
1 overstortput, by LzScripter Lizard G-A Functions
$scenario
aanslagpeil afslagpeil gemaalcapaciteit
nat -0.38 -0.40 300
droog -0.42 -0.44 300
|
write.PI
uses this format for one of its input parameters.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | read.sheet(textConnection('-- first
ts v
"2009-09-30 10:00:00" -2.081609
"2009-09-30 10:15:00" -2.079778
-- second
a b
3 4
2 2'), 'first', sep=" ")
read.sheet(textConnection('-- first
ts v
"2009-09-30 10:00:00" -2.081609
"2009-09-30 10:15:00" -2.079778
-- second
a b
3 4
2 2'), 'second', sep=" ")
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.