MoveCells2left: Move filled cells to the leftmost empty cells.

Usage Arguments Value References Examples

View source: R/MoveCells2left.R

Usage

1
MoveCells2left(df, fillwith = NA, shift = 1, ef = c(NA, -999, 0))

Arguments

df

table (data.frame/2D-matrix) to be checked

fillwith

what is the character/number to fill the "empty" cells. Default the same as flag

...

ef arguments passed to setEmptyCellsValue

Value

a data.frame/2D-matrix

References

http://stackoverflow.com/questions/23285215/advanced-dataframe-manipulation-in-r-shifting-cells-to-the-left

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
# example 1
xe <- data.frame(x=c("l","m",NA,NA,"p"),
                 y=c(NA,"b","c",NA,NA),
                 z=c("u",NA,"w","x","y"))
print(xe)
MoveCells2left(df = xe, ef = NA)
# example 2
xe <- data.frame(a = 3:6, b = 0, c = 0, d = 0, e = 0)
xe[2, 1] <- 0
xe[1, 4] <- 3
xe[2, 3] <- 3
xe[3, 3] <- 3
xe[3, 5] <- 3
xe[4, 2] <- 3
print(xe)
MoveCells2left(df = xe, ef = 0)

mathphysmx/cleanTable documentation built on May 29, 2019, 2:51 p.m.