Displaying 4 results from an estimated 4 matches for "col_05".
Did you mean:
col_01
2020 Oct 31
2
fast way to find most common value across columns dataframe
...ot;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.max(table(x)))
}
df$most = q
```
2020 Oct 31
0
fast way to find most common value across columns dataframe
...; 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.max(table(x)))
> }
> df$most = q
> ```
>
> ___________________________________...
2020 Oct 31
2
fast way to find most common value across columns dataframe
...0,
> > 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.max(table(x)))
> > }
> > df$most = q
> > ```...
2020 Oct 31
0
fast way to find most common value across columns dataframe
...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.max(table(x)))
>> > }
>>...