nrowAssign.rdFunction nrow<- assigns dim with a new number of rows.
Function ncol<- assigns dim with a new number of columns.
a object that has dim AND can be assigned ONE new dimension
the new size of the assigned dimension
Currently only asssigning new rows to ffdf is supported.
The new ffdf rows are not initialized (usually become zero).
NOTE that
The object with a modified dimension
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 1162483 62.1 1994352 106.6 1994352 106.6
#> Vcells 2166824 16.6 8790397 67.1 8790397 67.1