Movatterモバイル変換


[0]ホーム

URL:


Skip to contents

Create a RecordBatch

Source:R/record-batch.R
record_batch.Rd

Create a RecordBatch

Usage

record_batch(..., schema=NULL)

Arguments

...

Adata.frame or a named set of Arrays or vectors. If given amixture of data.frames and vectors, the inputs will be autospliced together(see examples). Alternatively, you can provide a single Arrow IPCInputStream,Message,Buffer, or Rraw object containing aBuffer.

schema

aSchema, orNULL (the default) to infer the schema fromthe data in.... When providing an Arrow IPC buffer,schema is required.

Examples

batch<-record_batch(name=rownames(mtcars),mtcars)dim(batch)#> [1] 32 12dim(head(batch))#> [1]  6 12names(batch)#>  [1] "name" "mpg"  "cyl"  "disp" "hp"   "drat" "wt"   "qsec" "vs"   "am"#> [11] "gear" "carb"batch$mpg#> Array#> <double>#> [#>   21,#>   21,#>   22.8,#>   21.4,#>   18.7,#>   18.1,#>   14.3,#>   24.4,#>   22.8,#>   19.2,#>   ...#>   15.2,#>   13.3,#>   19.2,#>   27.3,#>   26,#>   30.4,#>   15.8,#>   19.7,#>   15,#>   21.4#> ]batch[["cyl"]]#> Array#> <double>#> [#>   6,#>   6,#>   4,#>   6,#>   8,#>   6,#>   8,#>   4,#>   4,#>   6,#>   ...#>   8,#>   8,#>   8,#>   4,#>   4,#>   4,#>   8,#>   6,#>   8,#>   4#> ]as.data.frame(batch[4:8,c("gear","hp","wt")])#>   gear  hp    wt#> 1    3 110 3.215#> 2    3 175 3.440#> 3    3 105 3.460#> 4    3 245 3.570#> 5    4  62 3.190

[8]ページ先頭

©2009-2025 Movatter.jp