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  -0.936 -0.016 ..."                      
#>  [8] " $ time: POSIXct, format: \"2025-07-24 19:17:36\" ..."
#>  [9] "NULL"                                                 
#> [10] "---"                                                  
#>               a                time
#>           <num>              <POSc>
#>  1: -0.93584735 2025-07-24 19:17:36
#>  2: -0.01595031 2025-07-24 19:17:37
#>  3: -0.82678895 2025-07-24 19:17:38
#>  4: -1.51239965 2025-07-24 19:17:39
#>  5:  0.93536319 2025-07-24 19:17:40
#>  6:  0.17648861 2025-07-24 19:17:41
#>  7:  0.24368546 2025-07-24 19:17:42
#>  8:  1.62354888 2025-07-24 19:17:43
#>  9:  0.11203808 2025-07-24 19:17:44
#> 10: -0.13399701 2025-07-24 19:17:45