More elegant solution for conditional filtering? [closed]
Closed 57 mins ago.
Creating a large number of columns in R tidyverse based on a comparison with a specific column
I have a dataset in R tidyverse and I want to create 192 columns based on comparison with the sp column, just like the mp_comp_1 column. How can I do this for 192 columns in tidyverse?
Add values across dataframe columns
I have a dataframe where missingness in indicated by “Z” (there may also be some “z” and NA
entries present in the data), and values are entered as characters (“0”, “1”, etc). I need to create scores (“updrs1”, “updrs2″, updrs3”) that add up the non-missing values across columns selected by colname prefix (“NP1”, “NP2”, “NP3”).
R flag a change in column value
I have the following dataset with 20 million rows. It’s data on companies and user by month.
I have created first_app_company, which flags first appeareance of a company in the dataset. The code is as follows