Assigning the number of rows or columns
nrowAssign.rdFunction nrow<- assigns dim with a new number of rows.
Function ncol<- assigns dim with a new number of columns.
Arguments
- x
a object that has
dimAND can be assigned ONE new dimension- value
the new size of the assigned dimension
Details
Currently only asssigning new rows to ffdf is supported.
The new ffdf rows are not initialized (usually become zero).
NOTE that
Examples
a <- as.ff(1:26)
b <- as.ff(factor(letters)) # vmode="integer"
c <- as.ff(factor(letters), vmode="ubyte")
df <- ffdf(a,b,c)
nrow(df) <- 2*26
df
#> ffdf (all open) dim=c(52,3), dimorder=c(1,2) row.names=NULL
#> ffdf virtual mapping
#> PhysicalName VirtualVmode PhysicalVmode AsIs VirtualIsMatrix
#> a a integer integer FALSE FALSE
#> b b integer integer FALSE FALSE
#> c c ubyte ubyte FALSE FALSE
#> PhysicalIsMatrix PhysicalElementNo PhysicalFirstCol PhysicalLastCol
#> a FALSE 1 1 1
#> b FALSE 2 1 1
#> c FALSE 3 1 1
#> PhysicalIsOpen
#> a TRUE
#> b TRUE
#> c TRUE
#> ffdf data
#> a b c
#> 1 1 a a
#> 2 2 b b
#> 3 3 c c
#> 4 4 d d
#> 5 5 e e
#> 6 6 f f
#> 7 7 g g
#> 8 8 h h
#> : : : :
#> 45 0 <0> a
#> 46 0 <0> a
#> 47 0 <0> a
#> 48 0 <0> a
#> 49 0 <0> a
#> 50 0 <0> a
#> 51 0 <0> a
#> 52 0 <0> a
message("NOTE that the new rows have silently the first level 'a' for UNSIGNED vmodes")
#> NOTE that the new rows have silently the first level 'a' for UNSIGNED vmodes
message("NOTE that the new rows have an illegal factor level <0> for SIGNED vmodes")
#> NOTE that the new rows have an illegal factor level <0> for SIGNED vmodes
message("It is your responsibility to put meaningful content here")
#> It is your responsibility to put meaningful content here
message("As an example we replace the illegal zeros by NA")
#> As an example we replace the illegal zeros by NA
df$b[27:52] <- NA
df
#> ffdf (all open) dim=c(52,3), dimorder=c(1,2) row.names=NULL
#> ffdf virtual mapping
#> PhysicalName VirtualVmode PhysicalVmode AsIs VirtualIsMatrix
#> a a integer integer FALSE FALSE
#> b b integer integer FALSE FALSE
#> c c ubyte ubyte FALSE FALSE
#> PhysicalIsMatrix PhysicalElementNo PhysicalFirstCol PhysicalLastCol
#> a FALSE 1 1 1
#> b FALSE 3 1 1
#> c FALSE 2 1 1
#> PhysicalIsOpen
#> a TRUE
#> b TRUE
#> c TRUE
#> ffdf data
#> a b c
#> 1 1 a a
#> 2 2 b b
#> 3 3 c c
#> 4 4 d d
#> 5 5 e e
#> 6 6 f f
#> 7 7 g g
#> 8 8 h h
#> : : : :
#> 45 0 NA a
#> 46 0 NA a
#> 47 0 NA a
#> 48 0 NA a
#> 49 0 NA a
#> 50 0 NA a
#> 51 0 NA a
#> 52 0 NA a
rm(a,b,c,df); gc()
#> used (Mb) gc trigger (Mb) max used (Mb)
#> Ncells 1252491 66.9 2239654 119.7 2239654 119.7
#> Vcells 2306926 17.7 8388608 64.0 8387257 64.0