User:Bequw/Stata to R

Todo: Look for the chapter and section references. Similar sites: http://hyperpolyglot.org/numerical-analysis http://rosettacode.org/wiki/Category:R =Getting Started= =Data manipulation and management=
 * help
 * search

Basic data commands

 * codebook
 * data management
 * data types
 * datetime
 * describe #TODO mention str
 * edit
 * format
 * inspect
 * label
 * list
 * missing values
 * rename >names(df)[match("oldname",names(df))] = "newname" #note this won't give an error if there is no variable named "oldname"
 * save
 * sort #This is not required in R before merging, aggregating, repeated group analysis >df = df[order(df$PrimarySortCol, df$SecondarySortCol),]
 * use
 * varmanage

Creating and dropping variables

 * clear see remove #TODO note how to clear _all
 * compress
 * drop >df = df[, !names(df) %in% c("var1todrop", "var2todrop")]
 * egen/generate If the dataset already has observations can do stuff like >df$sum = df$x1 + df$x2 >df$id = NA If you have an empty dataframe (greated by something like data.frame) then you can do stuff like >df$sum = numeric
 * functions

Functions and expressions

 * egen
 * functions

Dates and times

 * bcal
 * datetime
 * datetime business calendars
 * datetime business calendars creation
 * datetime display formats
 * datetime translation

Loading, saving, importing, and exporting data

 * edit
 * export
 * haver
 * import
 * import excel
 * import sasxport
 * infile (fixed format)
 * infile (free format)
 * infix (fixed format)
 * input
 * insheet
 * odbc
 * outfile
 * outsheet
 * save
 * sysuse
 * use
 * webuse
 * xmlsave

Combining data

 * append
 * mi append
 * cross
 * joinby
 * merge
 * mi merge

Reshaping datasets

 * collapse
 * >aggregate
 * contract
 * expand
 * expandcl
 * fillin
 * obs
 * reshape
 * mi reshape
 * rolling
 * separate
 * ssd
 * stack
 * statsby
 * xpose

Labeling, display formats, and notes

 * format
 * label
 * label language
 * labelbook
 * notes
 * varmanage

Changing and renaming variables

 * clonevar
 * destring
 * encode
 * generate
 * mvencode
 * order
 * recode
 * rename
 * rename group
 * split
 * varmanage

Examining data

 * cf
 * codebook
 * compare
 * count
 * describe
 * ds
 * duplicates
 * edit
 * gsort
 * inspect
 * isid
 * lookfor
 * misstable
 * mi describe
 * mi misstable
 * pctile
 * stdescribe
 * summarize
 * svy: tabulate oneway
 * svy: tabulate twoway
 * tabdisp
 * table
 * tabstat
 * tabulate oneway; tabulate twoway
 * >table
 * tabulate, summarize
 * xtdescribe

File manipulation

 * cd >getwd >setwd("Path") #Window's default windows folder separator character '/' will have be replaced with '\' or fully escaped '//' to work right. If you working interactively, you can enter >scan( ,  , n=1) and then at the prompt past directly a windows folder path (with '/'s in it) and it will auto-escape it for you.
 * cf
 * changeeol
 * checksum
 * copy
 * dir
 * erase
 * filefilter
 * mkdir
 * rmdir
 * type
 * zipfile

Miscellaneous data commands

 * corr2data
 * drawnorm
 * dydx
 * icd9
 * ipolate
 * range
 * sample

Multiple imputation

 * mi add
 * mi append
 * mi convert
 * mi copy
 * mi describe
 * mi erase
 * mi expand
 * mi export
 * mi export ice
 * mi export nhanes1
 * mi extract
 * mi import
 * mi import flong
 * mi import flongsep
 * mi import ice
 * mi import nhanes1
 * mi import wide
 * mi merge
 * mi misstable
 * mi passive
 * mi ptrace
 * mi rename
 * mi replace0
 * mi reset
 * mi reshape
 * mi set
 * mi stsplit
 * mi update
 * mi varying
 * mi xeq
 * mi XXXset
 * noupdate option
 * styles
 * workflow