Displaying 4 results from an estimated 4 matches for "col_03".
Did you mean:
col103
2020 Oct 31
2
fast way to find most common value across columns dataframe
...and memory consuming.
Is there a way to run it more efficiently?
Thank you
```
V = c("A", "B", "C", "D")
df = data.frame(n = 1:10,
col_01 = sample(V, 10, replace = TRUE, prob = NULL),
col_02 = sample(V, 10, replace = TRUE, prob = NULL),
col_03 = sample(V, 10, replace = TRUE, prob = NULL),
col_04 = sample(V, 10, replace = TRUE, prob = NULL),
col_05 = sample(V, 10, replace = TRUE, prob = NULL),
stringsAsFactors = FALSE)
q = vector()
for(i in 1:nrow(df)) {
x = as.vector(t(df[i,2:ncol(df)]))
q[i] = names(which.ma...
2020 Oct 31
0
fast way to find most common value across columns dataframe
...o run it more efficiently?
> Thank you
>
> ```
> V = c("A", "B", "C", "D")
> df = data.frame(n = 1:10,
> col_01 = sample(V, 10, replace = TRUE, prob = NULL),
> col_02 = sample(V, 10, replace = TRUE, prob = NULL),
> col_03 = sample(V, 10, replace = TRUE, prob = NULL),
> col_04 = sample(V, 10, replace = TRUE, prob = NULL),
> col_05 = sample(V, 10, replace = TRUE, prob = NULL),
> stringsAsFactors = FALSE)
>
> q = vector()
> for(i in 1:nrow(df)) {
> x = as.vector(t(df[i,2:ncol...
2020 Oct 31
2
fast way to find most common value across columns dataframe
...nk you
> >
> > ```
> > V = c("A", "B", "C", "D")
> > df = data.frame(n = 1:10,
> > col_01 = sample(V, 10, replace = TRUE, prob = NULL),
> > col_02 = sample(V, 10, replace = TRUE, prob = NULL),
> > col_03 = sample(V, 10, replace = TRUE, prob = NULL),
> > col_04 = sample(V, 10, replace = TRUE, prob = NULL),
> > col_05 = sample(V, 10, replace = TRUE, prob = NULL),
> > stringsAsFactors = FALSE)
> >
> > q = vector()
> > for(i in 1:nrow(df)) {
>...
2020 Oct 31
0
fast way to find most common value across columns dataframe
...; > ```
>> > V = c("A", "B", "C", "D")
>> > df = data.frame(n = 1:10,
>> > col_01 = sample(V, 10, replace = TRUE, prob = NULL),
>> > col_02 = sample(V, 10, replace = TRUE, prob = NULL),
>> > col_03 = sample(V, 10, replace = TRUE, prob = NULL),
>> > col_04 = sample(V, 10, replace = TRUE, prob = NULL),
>> > col_05 = sample(V, 10, replace = TRUE, prob = NULL),
>> > stringsAsFactors = FALSE)
>> >
>> > q = vector()
>> > for...