Thursday, March 05, 2015

R: Appending rows to create new data (appending columns)

If you have a requirement of appending rows from different sources to create a new data row (for eg. Professor and Department he works in, to create an information snippet) here is the simplest trick, use cbind:

> profSharma<-professors(professors$Pid==3,)
> phyDepartment<-department(department$Did==19,)
> cbind(profSharma,phyDepartment)
Happy Programming!

No comments:

[Windows] Refreshing Environment variable for windows command prompt or Powershell

Sometimes, after installing a package like chocolatey ,or npm packages, it asks you to restart the cmd.exe or powershell window to reload t...