Transcription of SAS <-> R :: CHEAT SHEET
{{id}} {{{paragraph}}}
SAS <-> R :: CHEAT SHEETI ntroductionThis guide aims to familiarise SAS users with examples make use of tidyverse collection of tidyverse:Attach tidyverse packages for ("tidyverse")library(tidyverse)R data here in data frames , and occasionally vectors (via c( ) )Other R structures (lists, ) are not explored shortcuts: <-Alt+ -%>%Ctrl+ Shift+ mDatasets; drop, keep & rename variablesdatanew_data;setold_data;run;ne w_data <-old_datadata new_data(keep=id);set old_data(drop=job_title);run;new_data <-old_data %>%select(-job_title)%>%select(id)data new_data(drop= temp:);set old_data;run;new_data <-old_data %>%select( -starts_with("temp")data new_data;set old_data;renameold_name=new_name;run;new _data <-old_data %>%rename(new_name =old_name)Conditional filteringdata new_data;set old_data;ifSex="M";run;new_data <-old_data %>%filter(Sex== "M")data new_data;set old_data;ifyearin(2010,2011,2012);run;ne w_data <-old_data %>%filter(year%i))
u \hdu v \hdu v ghsw $ % \hdu v ghsw $ % vdohv
Domain:
Source:
Link to this page:
Please notify us if you found a problem with this document:
{{id}} {{{paragraph}}}