Comparing Julia and R’s Vocabularies

April 9, 2012

(This article was first published on John Myles White » Statistics, and kindly contributed to R-bloggers)

While exploring the Julia manual recently, I realized that it might be helpful to put the basic vocabularies of Julia and R side-by-side for easy comparison. So I took Hadley Wickham’s R Vocabulary section from the book he’s putting together on the devtools wiki, put all of the functions Hadley listed into a CSV file, and proceeded to fill in entries where I knew of an obvious Julia equivalent to an R function.The results are on GitHub and, as they stand today, are shown below:
?helpBasicsFirst Functions
strBasicsFirst Functions
**BasicsBasic Math
++BasicsBasic Math
--BasicsBasic Math
//BasicsBasic Math
^^BasicsBasic Math
%%mod (%%)BasicsBasic Math
%/%divBasicsBasic Math
absabsBasicsBasic Math
signsignBasicsBasic Math
acosacosBasicsBasic Math
acoshacoshBasicsBasic Math
asinasinBasicsBasic Math
asinhasinhBasicsBasic Math
atanatanBasicsBasic Math
atan2atan2BasicsBasic Math
atanhatanhBasicsBasic Math
sinsinBasicsBasic Math
sinhsinhBasicsBasic Math
coscosBasicsBasic Math
coshcoshBasicsBasic Math
tantanBasicsBasic Math
tanhtanhBasicsBasic Math
ceilingceilBasicsBasic Math
floorfloorBasicsBasic Math
roundroundBasicsBasic Math
trunctruncBasicsBasic Math
signifBasicsBasic Math
expexpBasicsBasic Math
loglogBasicsBasic Math
log10log10BasicsBasic Math
log1plog1pBasicsBasic Math
log2log2BasicsBasic Math
logbBasicsBasic Math
sqrtsqrtBasicsBasic Math
cummaxBasicsBasic Math
cumminBasicsBasic Math
cumprodcumprodBasicsBasic Math
cumsumcumsumBasicsBasic Math
diffdiffBasicsBasic Math
maxmaxBasicsBasic Math
minminBasicsBasic Math
prodprodBasicsBasic Math
sumsumBasicsBasic Math
rangeBasicsBasic Math
meanmeanBasicsBasic Math
medianmedianBasicsBasic Math
corcor_pearsonBasicsBasic Math
covcov_pearsonBasicsBasic Math
sdstdBasicsBasic Math
varvarBasicsBasic Math
pmaxBasicsBasic Math
pminBasicsBasic Math
rleBasicsBasic Math
&&BasicsLogical & Set Operations
||BasicsLogical & Set Operations
!!BasicsLogical & Set Operations
xorBasicsLogical & Set Operations
allallBasicsLogical & Set Operations
anyanyBasicsLogical & Set Operations
intersectintersectBasicsLogical & Set Operations
unionunionBasicsLogical & Set Operations
setdiffBasicsLogical & Set Operations
setequalBasicsLogical & Set Operations
whichfindBasicsLogical & Set Operations
c[] ({})BasicsVectors and Matrices
matrix[] ({})BasicsVectors and Matrices
lengthsize (length)BasicsVectors and Matrices
dimsizeBasicsVectors and Matrices
ncolsize(x, 1)BasicsVectors and Matrices
nrowsize(x, 2)BasicsVectors and Matrices
cbindhcatBasicsVectors and Matrices
rbindvcatBasicsVectors and Matrices
namesBasicsVectors and Matrices
colnamesBasicsVectors and Matrices
rownamesBasicsVectors and Matrices
tBasicsVectors and Matrices
diageyeBasicsVectors and Matrices
sweepBasicsVectors and Matrices
as.matrixBasicsVectors and Matrices
data.matrixBasicsVectors and Matrices
c[] ({})BasicsMaking Vectors
repBasicsMaking Vectors
seq[from:by:to]BasicsMaking Vectors
seq_alongBasicsMaking Vectors
seq_len[1:len]BasicsMaking Vectors
revreverseBasicsMaking Vectors
sampleBasicsMaking Vectors
choosefactorialBasicsMaking Vectors
factorialfactorialBasicsMaking Vectors
combnBasicsMaking Vectors
(is/as).(character/numeric/logical)BasicsMaking Vectors
listHashTable ([])BasicsLists & Data Frames
unlistBasicsLists & Data Frames
data.frameBasicsLists & Data Frames & Data Frames
splitBasicsLists & Data Frames
expand.gridBasicsLists & Data Frames
ififBasicsControl Flow
&&&&BasicsControl Flow
||||BasicsControl Flow
forforBasicsControl Flow
whilewhileBasicsControl Flow
nextcontinueBasicsControl Flow
breakbreakBasicsControl Flow
switchBasicsControl Flow
ifelseBasicsControl Flow
fittedStatisticsLinear Models
predictStatisticsLinear Models
residStatisticsLinear Models
rstandardStatisticsLinear Models
lmStatisticsLinear Models
glmStatisticsLinear Models
hatStatisticsLinear Models
influence.measuresStatisticsLinear Models
logLikStatisticsLinear Models
dfStatisticsLinear Models
devianceStatisticsLinear Models
formulaStatisticsLinear Models
~StatisticsLinear Models
IStatisticsLinear Models
anovaStatisticsLinear Models
coefStatisticsLinear Models
confintStatisticsLinear Models
vcovStatisticsLinear Models
contrastsStatisticsLinear Models
apropos(‘\\.test$’)StatisticsMiscellaneous Statistical Tests
betabetaStatisticsRandom Numbers
binombinomStatisticsRandom Numbers
cauchycauchyStatisticsRandom Numbers
chisqchisqStatisticsRandom Numbers
expexpStatisticsRandom Numbers
ffStatisticsRandom Numbers
gammagammaStatisticsRandom Numbers
geomgeomStatisticsRandom Numbers
hyperhyperStatisticsRandom Numbers
lnormlnormStatisticsRandom Numbers
logislogisStatisticsRandom Numbers
multinommultinomStatisticsRandom Numbers
nbinomnbinomStatisticsRandom Numbers
normnormStatisticsRandom Numbers
poispoisStatisticsRandom Numbers
signranksignrankStatisticsRandom Numbers
ttStatisticsRandom Numbers
unifunif (rand)StatisticsRandom Numbers
weibullweibullStatisticsRandom Numbers
wilcoxwilcoxStatisticsRandom Numbers
birthdaybirthdayStatisticsRandom Numbers
tukeytukeyStatisticsRandom Numbers
crossprod*StatisticsMatrix Algebra
tcrossprod*StatisticsMatrix Algebra
eigeneigStatisticsMatrix Algebra
qrqrStatisticsMatrix Algebra
svdsvdStatisticsMatrix Algebra
%*%*StatisticsMatrix Algebra
%o%StatisticsMatrix Algebra
outerStatisticsMatrix Algebra
rcondStatisticsMatrix Algebra
solve\StatisticsMatrix Algebra
duplicatedStatisticsOrdering and Tabulating
uniqueStatisticsOrdering and Tabulating
mergeStatisticsOrdering and Tabulating
orderStatisticsOrdering and Tabulating
rankStatisticsOrdering and Tabulating
quantilequantileStatisticsOrdering and Tabulating
sortsortStatisticsOrdering and Tabulating
tableStatisticsOrdering and Tabulating
ftableStatisticsOrdering and Tabulating
lswhosWorking with RWorkspace
existsWorking with RWorkspace
getWorking with RWorkspace
rmWorking with RWorkspace
getwdgetcwdWorking with RWorkspace
setwdsetcwdWorking with RWorkspace
qCtrl-DWorking with RWorkspace
sourceloadWorking with RWorkspace
install.packagesWorking with RWorkspace
libraryWorking with RWorkspace
requireWorking with RWorkspace
helphelpWorking with RHelp
?helpWorking with RHelp
help.searchWorking with RHelp
aproposWorking with RHelp
RSiteSearchWorking with RHelp
citationWorking with RHelp
demoWorking with RHelp
exampleWorking with RHelp
vignetteWorking with RHelp
tracebackWorking with RDebugging
browserWorking with RDebugging
recoverWorking with RDebugging
options(error =)Working with RDebugging
stopWorking with RDebugging
warningWorking with RDebugging
messageWorking with RDebugging
tryCatchtry/catchWorking with RDebugging
trytryWorking with RDebugging
printprint (println)I/OOutput
dataI/OReading and Writing Data
count.fieldsI/OReading and Writing Data
read.csvcsvreadI/OReading and Writing Data
read.delimdlmreadI/OReading and Writing Data
read.fwfI/OReading and Writing Data
read.tableI/OReading and Writing Data
library(foreign)I/OReading and Writing Data
write.tabledlmwriteI/OReading and Writing Data
readLinesreadlinesI/OReading and Writing Data
writeLinesI/OReading and Writing Data
loadI/OReading and Writing Data
saveI/OReading and Writing Data
readRDSI/OReading and Writing Data
saveRDSI/OReading and Writing Data
dirI/OFiles and Directories
basenameI/OFiles and Directories
dirnameI/OFiles and Directories
file.pathI/OFiles and Directories
path.expandI/OFiles and Directories
file.chooseI/OFiles and Directories
file.copyI/OFiles and Directories
file.createI/OFiles and Directories
file.removeI/OFiles and Directories
path.renameI/OFiles and Directories
dir.createI/OFiles and Directories
file.existsI/OFiles and Directories
tempdirI/OFiles and Directories
tempfileI/OFiles and Directories
download.fileI/OFiles and Directories
ISOdateSpecial DataDate / Time
ISOdatetimeSpecial DataDate / Time
strftimeSpecial DataDate / Time
strptimeSpecial DataDate / Time
dateSpecial DataDate / Time
difftimeSpecial DataDate / Time
julianSpecial DataDate / Time
monthsSpecial DataDate / Time
quartersSpecial DataDate / Time
weekdaysSpecial DataDate / Time
library(lubridate)Special DataDate / Time
grepmatchSpecial DataCharacter Manipulation
agrepSpecial DataCharacter Manipulation
gsubSpecial DataCharacter Manipulation
strsplitsplitSpecial DataCharacter Manipulation
chartrSpecial DataCharacter Manipulation
ncharstrlenSpecial DataCharacter Manipulation
tolowerSpecial DataCharacter Manipulation
toupperSpecial DataCharacter Manipulation
substrSpecial DataCharacter Manipulation
pastejoinSpecial DataCharacter Manipulation
library(stringr)Special DataCharacter Manipulation
factorSpecial DataFactors
levelsSpecial DataFactors
nlevelsSpecial DataFactors
reorderSpecial DataFactors
relevelSpecial DataFactors
cutSpecial DataFactors
findIntervalSpecial DataFactors
interactionSpecial DataFactors
options(stringsAsFactors = FALSE)Special DataFactors
array[]Special DataArray Manipulation
dimsizeSpecial DataArray Manipulation
dimnamesSpecial DataArray Manipulation
apermSpecial DataArray Manipulation
library(abind)Special DataArray Manipulation
I’d like to note that holes in the list of Julia functions can exist for several reasons:
  1. The language does not yet have the relevant features. This is true of things like factor() or data.frame().
  2. The language has draft implementations of the relevant features, but they are not yet ready to make their way into this list. This is true of Doug Bates’ GLM code, for example.
  3. I simply don’t know what the Julia equivalent is for an R function, but it may well exist. If you know of one, please fork the GitHub repository I’m using and revise the CSV file appropriately. I’ll integrate relevant pull requests as soon as I can find time.
In addition to explaining the presence of the many holes you can see this in this list, I’d also like to note how quickly these holes are being filled in: Doug Bates already finished a wrapper for the Rmath library, which means that Julia now has tools for calculating the PDF’s, CDF’s, and inverse CDF’s of most statistical distributions as well as the ability to draw random samples from them. That means that almost any sort of MCMC you’d like to do is already possible in Julia. (I, for one, am really interested to see if someone will use Julia’s sparse matrix support and these new Rmath functions to build MCMC code that’s easy on the eyes while also running at an appropriately fast speed on complicated, big data problems like matrix factorizations.)On my end, I’ve been working on filling some of the missing entries in this list by adding in pieces that I think I understand well enough to implement from scratch, such as:
  • Optimization algorithms (optim.jl):
    • Simulated annealing
    • Gradient descent
    • Newton’s method
  • Statistical hypothesis tests (stats.jl):
    • t-Tests
  • Utility functions (utils.jl):
    • range
    • keys
    • cummax
    • cummin

To leave a comment for the author, please follow the link and comment on his blog: John Myles White » Statistics. offers daily e-mail updates about R news and tutorials on topics such as: visualization (ggplot2, Boxplots, maps, animation), programming (RStudio, Sweave, LaTeX, SQL, Eclipse, git, hadoop, Web Scraping) statistics (regression, PCA, time series, trading) and more...

If you got this far, why not subscribe for updates from the site? Choose your flavor: e-mail, twitter, RSS, or facebook...

Tags: ,

Comments are closed.