Read and parse .ini file to list

read.ini(filepath, encoding = getOption("encoding"))

Arguments

filepath

file to parse

encoding

Encoding of filepath parameter, will default to system encoding if not specifield

Value

List with length equivalent to number of [sections], each section is a new list

Details

Lines starting with '#' or ';' are comments and will not be parsed

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
#> $`Hello World`
#> $`Hello World`$Foo
#> [1] "Bar"
#> 
#> $`Hello World`$Foo1
#> [1] "Bar=345"
#> 
#> 
checkini$`Hello World`$Foo
#> [1] "Bar"