Type: | Package |
Title: | Read and Write '.ini' Files |
Version: | 0.3.1 |
Date: | 2018-05-19 |
Author: | David Valentim Dias |
Maintainer: | David Valentim Dias <dvdscripter@gmail.com> |
Description: | Parse simple '.ini' configuration files to an structured list. Users can manipulate this resulting list with lapply() functions. This same structured list can be used to write back to file after modifications. |
License: | GPL-3 |
URL: | https://github.com/dvdscripter/ini |
BugReports: | https://github.com/dvdscripter/ini/issues |
LazyData: | FALSE |
RoxygenNote: | 6.0.1 |
Suggests: | testthat |
NeedsCompilation: | no |
Packaged: | 2018-05-19 23:19:45 UTC; CLIENTE |
Repository: | CRAN |
Date/Publication: | 2018-05-20 03:26:39 UTC |
Read and parse .ini file to list
Description
Read and parse .ini file to list
Usage
read.ini(filepath, encoding = getOption("encoding"))
Arguments
filepath |
file to parse |
encoding |
Encoding of filepath parameter, will default to system encoding if not specifield |
Details
Lines starting with '#' or ';' are comments and will not be parsed
Value
List with length equivalent to number of [sections], each section is a new list
See Also
Examples
## Create a new temp ini for reading
iniFile <- tempfile(fileext = '.ini')
sink(iniFile)
cat("; This line is a comment\n")
cat("# This one too!\n")
cat("[ Hello World]\n")
cat("Foo = Bar \n")
cat("Foo1 = Bar=345 \n")
sink()
## Read ini
checkini <- read.ini(iniFile)
## Check structure
checkini
checkini$`Hello World`$Foo
Write list to .ini file
Description
Write list to .ini file
Usage
write.ini(x, filepath, encoding = getOption("encoding"))
Arguments
x |
List with structure to be write at .ini file. |
filepath |
file to write |
encoding |
Encoding of filepath parameter, will default to system encoding if not specifield |
See Also
Examples
## Create a new temp ini for writing
iniFile <- tempfile(fileext = '.ini')
## Create a new list holding our INI
newini <- list()
newini[[ "Hello World" ]] <- list(Foo = 'Bar')
## Write structure to file
write.ini(newini, iniFile)
## Check file content
## Not run:
file.show(iniFile)
## End(Not run)