Comparing Julia and R’s Vocabularies

[This article was first published on John Myles White » Statistics, and kindly contributed to R-bloggers]. (You can report issue about the content on this page here)
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

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:
R Julia Category Subcategory
https:// github.com/ hadley/devtools/ wiki/vocabulary http:// julialang.org/ manual/ standard- library-reference/ Resources Vocabulary
? help Basics First Functions
str Basics First Functions
%in% Basics Operators
match Basics Operators
= = Basics Operators
<- = Basics Operators
<<- Basics Operators
assign Basics Operators
$ [] Basics Operators
[] [] Basics Operators
[[]] [] Basics Operators
replace Basics Operators
head Basics Operators
tail Basics Operators
subset Basics Operators
with Basics Operators
within Basics Operators
all.equal Basics Comparison
identical Basics Comparison
!= != Basics Comparison
== == Basics Comparison
> > Basics Comparison
>= >= Basics Comparison
< < Basics Comparison
<= <= Basics Comparison
is.na Basics Comparison
is.nan Basics Comparison
is.finite Basics Comparison
complete.cases Basics Comparison
* * Basics Basic Math
+ + Basics Basic Math
Basics Basic Math
/ / Basics Basic Math
^ ^ Basics Basic Math
%% mod (%%) Basics Basic Math
%/% div Basics Basic Math
abs abs Basics Basic Math
sign sign Basics Basic Math
acos acos Basics Basic Math
acosh acosh Basics Basic Math
asin asin Basics Basic Math
asinh asinh Basics Basic Math
atan atan Basics Basic Math
atan2 atan2 Basics Basic Math
atanh atanh Basics Basic Math
sin sin Basics Basic Math
sinh sinh Basics Basic Math
cos cos Basics Basic Math
cosh cosh Basics Basic Math
tan tan Basics Basic Math
tanh tanh Basics Basic Math
ceiling ceil Basics Basic Math
floor floor Basics Basic Math
round round Basics Basic Math
trunc trunc Basics Basic Math
signif Basics Basic Math
exp exp Basics Basic Math
log log Basics Basic Math
log10 log10 Basics Basic Math
log1p log1p Basics Basic Math
log2 log2 Basics Basic Math
logb Basics Basic Math
sqrt sqrt Basics Basic Math
cummax Basics Basic Math
cummin Basics Basic Math
cumprod cumprod Basics Basic Math
cumsum cumsum Basics Basic Math
diff diff Basics Basic Math
max max Basics Basic Math
min min Basics Basic Math
prod prod Basics Basic Math
sum sum Basics Basic Math
range Basics Basic Math
mean mean Basics Basic Math
median median Basics Basic Math
cor cor_pearson Basics Basic Math
cov cov_pearson Basics Basic Math
sd std Basics Basic Math
var var Basics Basic Math
pmax Basics Basic Math
pmin Basics Basic Math
rle Basics Basic Math
function function Basics Functions
missing Basics Functions
on.exit Basics Functions
return return Basics Functions
invisible Basics Functions
& & Basics Logical & Set Operations
| | Basics Logical & Set Operations
! ! Basics Logical & Set Operations
xor Basics Logical & Set Operations
all all Basics Logical & Set Operations
any any Basics Logical & Set Operations
intersect intersect Basics Logical & Set Operations
union union Basics Logical & Set Operations
setdiff Basics Logical & Set Operations
setequal Basics Logical & Set Operations
which find Basics Logical & Set Operations
c [] ({}) Basics Vectors and Matrices
matrix [] ({}) Basics Vectors and Matrices
length size (length) Basics Vectors and Matrices
dim size Basics Vectors and Matrices
ncol size(x, 1) Basics Vectors and Matrices
nrow size(x, 2) Basics Vectors and Matrices
cbind hcat Basics Vectors and Matrices
rbind vcat Basics Vectors and Matrices
names Basics Vectors and Matrices
colnames Basics Vectors and Matrices
rownames Basics Vectors and Matrices
t Basics Vectors and Matrices
diag eye Basics Vectors and Matrices
sweep Basics Vectors and Matrices
as.matrix Basics Vectors and Matrices
data.matrix Basics Vectors and Matrices
c [] ({}) Basics Making Vectors
rep Basics Making Vectors
seq [from:by:to] Basics Making Vectors
seq_along Basics Making Vectors
seq_len [1:len] Basics Making Vectors
rev reverse Basics Making Vectors
sample Basics Making Vectors
choose factorial Basics Making Vectors
factorial factorial Basics Making Vectors
combn Basics Making Vectors
(is/as).(character/numeric/logical) Basics Making Vectors
list HashTable ([]) Basics Lists & Data Frames
unlist Basics Lists & Data Frames
data.frame Basics Lists & Data Frames
as.data.frame Basics Lists & Data Frames
split Basics Lists & Data Frames
expand.grid Basics Lists & Data Frames
if if Basics Control Flow
&& && Basics Control Flow
|| || Basics Control Flow
for for Basics Control Flow
while while Basics Control Flow
next continue Basics Control Flow
break break Basics Control Flow
switch Basics Control Flow
ifelse Basics Control Flow
fitted Statistics Linear Models
predict Statistics Linear Models
resid Statistics Linear Models
rstandard Statistics Linear Models
lm Statistics Linear Models
glm Statistics Linear Models
hat Statistics Linear Models
influence.measures Statistics Linear Models
logLik Statistics Linear Models
df Statistics Linear Models
deviance Statistics Linear Models
formula Statistics Linear Models
~ Statistics Linear Models
I Statistics Linear Models
anova Statistics Linear Models
coef Statistics Linear Models
confint Statistics Linear Models
vcov Statistics Linear Models
contrasts Statistics Linear Models
apropos(‘\\.test$’) Statistics Miscellaneous Statistical Tests
beta beta Statistics Random Numbers
binom binom Statistics Random Numbers
cauchy cauchy Statistics Random Numbers
chisq chisq Statistics Random Numbers
exp exp Statistics Random Numbers
f f Statistics Random Numbers
gamma gamma Statistics Random Numbers
geom geom Statistics Random Numbers
hyper hyper Statistics Random Numbers
lnorm lnorm Statistics Random Numbers
logis logis Statistics Random Numbers
multinom multinom Statistics Random Numbers
nbinom nbinom Statistics Random Numbers
norm norm Statistics Random Numbers
pois pois Statistics Random Numbers
signrank signrank Statistics Random Numbers
t t Statistics Random Numbers
unif unif (rand) Statistics Random Numbers
weibull weibull Statistics Random Numbers
wilcox wilcox Statistics Random Numbers
birthday birthday Statistics Random Numbers
tukey tukey Statistics Random Numbers
crossprod * Statistics Matrix Algebra
tcrossprod * Statistics Matrix Algebra
eigen eig Statistics Matrix Algebra
qr qr Statistics Matrix Algebra
svd svd Statistics Matrix Algebra
%*% * Statistics Matrix Algebra
%o% Statistics Matrix Algebra
outer Statistics Matrix Algebra
rcond Statistics Matrix Algebra
solve \ Statistics Matrix Algebra
duplicated Statistics Ordering and Tabulating
unique Statistics Ordering and Tabulating
merge Statistics Ordering and Tabulating
order Statistics Ordering and Tabulating
rank Statistics Ordering and Tabulating
quantile quantile Statistics Ordering and Tabulating
sort sort Statistics Ordering and Tabulating
table Statistics Ordering and Tabulating
ftable Statistics Ordering and Tabulating
ls whos Working with R Workspace
exists Working with R Workspace
get Working with R Workspace
rm Working with R Workspace
getwd getcwd Working with R Workspace
setwd setcwd Working with R Workspace
q Ctrl-D Working with R Workspace
source load Working with R Workspace
install.packages Working with R Workspace
library Working with R Workspace
require Working with R Workspace
help help Working with R Help
? help Working with R Help
help.search Working with R Help
apropos Working with R Help
RSiteSearch Working with R Help
citation Working with R Help
demo Working with R Help
example Working with R Help
vignette Working with R Help
traceback Working with R Debugging
browser Working with R Debugging
recover Working with R Debugging
options(error =) Working with R Debugging
stop Working with R Debugging
warning Working with R Debugging
message Working with R Debugging
tryCatch try/catch Working with R Debugging
try try Working with R Debugging
print print (println) I/O Output
cat I/O Output
message I/O Output
warning I/O Output
dput I/O Output
format I/O Output
sink I/O Output
data I/O Reading and Writing Data
count.fields I/O Reading and Writing Data
read.csv csvread I/O Reading and Writing Data
read.delim dlmread I/O Reading and Writing Data
read.fwf I/O Reading and Writing Data
read.table I/O Reading and Writing Data
library(foreign) I/O Reading and Writing Data
write.table dlmwrite I/O Reading and Writing Data
readLines readlines I/O Reading and Writing Data
writeLines I/O Reading and Writing Data
load I/O Reading and Writing Data
save I/O Reading and Writing Data
readRDS I/O Reading and Writing Data
saveRDS I/O Reading and Writing Data
dir I/O Files and Directories
basename I/O Files and Directories
dirname I/O Files and Directories
file.path I/O Files and Directories
path.expand I/O Files and Directories
file.choose I/O Files and Directories
file.copy I/O Files and Directories
file.create I/O Files and Directories
file.remove I/O Files and Directories
path.rename I/O Files and Directories
dir.create I/O Files and Directories
file.exists I/O Files and Directories
tempdir I/O Files and Directories
tempfile I/O Files and Directories
download.file I/O Files and Directories
ISOdate Special Data Date / Time
ISOdatetime Special Data Date / Time
strftime Special Data Date / Time
strptime Special Data Date / Time
date Special Data Date / Time
difftime Special Data Date / Time
julian Special Data Date / Time
months Special Data Date / Time
quarters Special Data Date / Time
weekdays Special Data Date / Time
library(lubridate) Special Data Date / Time
grep match Special Data Character Manipulation
agrep Special Data Character Manipulation
gsub Special Data Character Manipulation
strsplit split Special Data Character Manipulation
chartr Special Data Character Manipulation
nchar strlen Special Data Character Manipulation
tolower Special Data Character Manipulation
toupper Special Data Character Manipulation
substr Special Data Character Manipulation
paste join Special Data Character Manipulation
library(stringr) Special Data Character Manipulation
factor Special Data Factors
levels Special Data Factors
nlevels Special Data Factors
reorder Special Data Factors
relevel Special Data Factors
cut Special Data Factors
findInterval Special Data Factors
interaction Special Data Factors
options(stringsAsFactors = FALSE) Special Data Factors
array [] Special Data Array Manipulation
dim size Special Data Array Manipulation
dimnames Special Data Array Manipulation
aperm Special Data Array Manipulation
library(abind) Special Data Array 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 their blog: John Myles White » Statistics.

R-bloggers.com offers daily e-mail updates about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

Never miss an update!
Subscribe to R-bloggers to receive
e-mails with the latest R posts.
(You will not see this message again.)

Click here to close (This popup will not appear again)