Skip to contents

Reads CSVY, print YAML and fread file.

Usage

obs_read_csvy(f, n = 100, ...)

Arguments

f

path to csvy file

n

number of files to search for "—" yaml

...

extra data.table arguments

Examples

{
df <- data.frame(a = rnorm(n = 10),
                 time = Sys.time() + 1:10)

f <- paste0(tempfile(), ".csvy")
notes <- c("notes",
           "more notes")
obs_write_csvy(dt = df, notes = notes, out = f)
s <- obs_read_csvy(f)
s
# or
readLines(f)
data.table::fread(f)
}
#>  [1] "---"                                                  
#>  [2] "name: Metadata "                                      
#>  [3] "notes"                                                
#>  [4] "more notes"                                           
#>  [5] "structure: "                                          
#>  [6] "'data.frame':\t10 obs. of  2 variables:"              
#>  [7] " $ a   : num  -1.4 0.255 ..."                         
#>  [8] " $ time: POSIXct, format: \"2024-11-14 00:28:29\" ..."
#>  [9] "NULL"                                                 
#> [10] "---"                                                  
#>                a                time
#>            <num>              <POSc>
#>  1: -1.400043517 2024-11-14 00:28:29
#>  2:  0.255317055 2024-11-14 00:28:30
#>  3: -2.437263611 2024-11-14 00:28:31
#>  4: -0.005571287 2024-11-14 00:28:32
#>  5:  0.621552721 2024-11-14 00:28:33
#>  6:  1.148411606 2024-11-14 00:28:34
#>  7: -1.821817661 2024-11-14 00:28:35
#>  8: -0.247325302 2024-11-14 00:28:36
#>  9: -0.244199607 2024-11-14 00:28:37
#> 10: -0.282705449 2024-11-14 00:28:38