Skip to content

Instantly share code, notes, and snippets.

@johnmyleswhite
Last active December 31, 2015 15:58
Show Gist options
  • Save johnmyleswhite/8010089 to your computer and use it in GitHub Desktop.
Save johnmyleswhite/8010089 to your computer and use it in GitHub Desktop.
Zany stuff that happens in R 3.0.2 on OS X: some cool, some absolutely awful
M <- matrix(c(1, 0, 0, 1), byrow = 1, nrow = 2)
df <- data.frame(A = 1)
df$B <- list(M)
df
# A B
# 1 1, 0, 0, 1
# Only works on some platforms: this was on OS X 10.9 with R version 3.0.1 (2013-05-16) -- "Good Sport"
NaN + NA_real_
# [1] NaN
NA_real_ + NaN
# [1] NA
x <- c(1, 2, 3, 4)
x[NA]
# [1] NA NA NA NA
x[TRUE]
# [1] 1 2 3 4
data <- "MySQLID\n1000\n1001"
ids <- read.csv(text = data)
ids[1, 1] == ids[2, 1]
# [1] FALSE
data <- "MySQLID\n100000000000000000\n100000000000000001"
ids <- read.csv(text = data)
ids[1, 1] == ids[2, 1]
# [1] TRUE
@fpepin
Copy link

fpepin commented Dec 17, 2013

Output is slightly misleading (at least to me) as the first 1 is the row name.

print(df,row.names=FALSE)
#A          B
#1 1, 0, 0, 1

@johnmyleswhite
Copy link
Author

Good point. Changed to remove row name.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment