Displaying 4 results from an estimated 4 matches for "n_for".
2016 Oct 27
4
Encontrar la primera columna no NA
...<-
  microbenchmark(
    # JVG_dplyr ={
    #   dat %>%
    #     apply( MARGIN = 1, FUN =
    #              function(x){
    #                which( !is.na(x)  ) %>%  min( na.rm = TRUE ) %>%
return()
    #                }
    #     )
    #   dat[ , First_month := First_month]
    #   N_for <- length( unique(First_month ))
    #   for( j in 1:N_for){
    #     x <- dat[  First_month == j,  j,  with = FALSE]
    #     dat[ First_month == j , Value_First_month := x ]
    #   }
    # },
    JVG ={
      dat <-
        data.table( Uno    = sample( c(runif(numero) , rep(NA , numer...
2016 Oct 27
2
Encontrar la primera columna no NA
...ro )
            )
t <- Sys.time()
First_month <-
  dat %>%
  apply( MARGIN = 1, FUN =
           function(x){
             which( !is.na(x)  ) %>%  min( na.rm = TRUE ) %>%  return()
           }
  )
First_month %>%  table %>%  prop.table
dat[ , First_month := First_month]
N_for <- length( unique(First_month ))
for( j in 1:N_for){
  x <- dat[  First_month == j,  j,  with = FALSE]
  dat[ First_month == j , Value_First_month := x ]
}
dat %>%  print
# dat %>%  summary
cat( "===============================\n", difftime( Sys.time(), t, units =
"min&...
2016 Oct 27
3
Encontrar la primera columna no NA
...ro )
            )
t <- Sys.time()
First_month <-
  dat %>%
  apply( MARGIN = 1, FUN =
           function(x){
             which( !is.na(x)  ) %>%  min( na.rm = TRUE ) %>%  return()
           }
  )
First_month %>%  table %>%  prop.table
dat[ , First_month := First_month]
N_for <- length( unique(First_month ))
for( j in 1:N_for){
  x <- dat[  First_month == j,  j,  with = FALSE]
  dat[ First_month == j , Value_First_month := x ]
}
dat %>%  print
# dat %>%  summary
cat( "===============================\n", difftime( Sys.time(), t, units =
"min&...
2016 Oct 28
2
Encontrar la primera columna no NA
...umero) , rep(NA , numero /1e3
        )) , size = numero )
        )
    First_month <-
      apply(X = dat,  MARGIN = 1, FUN =
              function(x){
                return(   min(  which( !is.na(x)  ),  na.rm = TRUE ) )
              }
      )
      dat[ , First_month := First_month]
      N_for <- length( unique(First_month ))
      for( j in 1:N_for){
        x <- dat[  First_month == j,  j,  with = FALSE]
        dat[ First_month == j , Value_First_month := x ]
      }
    },
    Olivier ={
      dat <-
        data.table( Uno    = sample( c(runif(numero) , rep(NA , numero /2e0...