rlh2
rlh2

Reputation: 1089

It seems that there is a weird Segmentation Fault when using R POSIXct class

It seems that there is an odd issue when trying to table or convert long POSIXct variables. It is relatively easy to get around this, but it is still annoying. Has anyone else experienced this? An easy example is the following

z <- 1472562988  
tst <- as.POSIXct(z+(1:150000), origin = "1960-01-01")  
tst2 <- z+1:150000  
segFault <- table(tst)  
segFault2 <- as.character(tst)  
segFault3 <- as.factor(tst)  
noSegFault <- table(tst2)

The reason I ask, is that if I import data from a sql table and want to use by() with a date index, I cannot do it without first converting my date column to a character format in SQL. Here is the output of sessionInfo():

R version 2.12.0 (2010-10-15) Platform: sparc-sun-solaris2.10 (32-bit)

locale: [1] C

attached base packages: [1] grid stats graphics grDevices utils datasets methods
[8] base

other attached packages: [1] timeDate_2120.90 ggplot2_0.8.8 proto_0.3-8 reshape_0.8.3
[5] plyr_1.2.1

Upvotes: 0

Views: 359

Answers (2)

Ben Bolker
Ben Bolker

Reputation: 226182

[moved from comments]

Solaris has a smaller user base, hence is less thoroughly tested, hence there is a slightly larger possibility than usual that you have found a new bug. Update to R 2.12.1 patched (to avoid getting Ripleyed), run with --vanilla (avoid loading any other packages), and see if the problem persists. If it does, post to r-devel and/or submit a bug report (with full system details, middle name of your maternal grandmother, etc.) ... [runs fine for me on R 2.12.1 on Ubuntu Linux]

Upvotes: 3

Joshua Ulrich
Joshua Ulrich

Reputation: 176648

You're most likely using an R version prior to 2.11.1 (when the segfault issue in format.POSIXlt was patched). You need to upgrade to 2.11.1 or later--preferably 2.12.1.

Your code runs fine with R-2.12.1 on WinXP.

Upvotes: 3

Related Questions