Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

segfault when calling robjects.r.table() #15

Closed
lgautier opened this issue Apr 29, 2009 · 1 comment
Closed

segfault when calling robjects.r.table() #15

lgautier opened this issue Apr 29, 2009 · 1 comment

Comments

@lgautier
Copy link
Member

Original report by Laurent Gautier (Bitbucket: lgautier, GitHub: lgautier).


Bug report from Kylee Kim

#---

Hi,

I am getting segmentation fault error for robjects.r.table() and trying to understand why this happens.
Here is simplified example.

import rpy2.robjects as robjects
r = robjects.r
mylist = ['a', 'a', 'b', 'd', 'b']
myNumList = [1,2,3,4]

print robjects.IntVector(myNumList)

#>>> print robjects.IntVector(myNumList)
#[1] 1 2 3 4

print robjects.StrVector(mylist)

#>>> print robjects.StrVector(mylist)
#[1] "a" "a" "b" "d" "b"

print r.factor(robjects.StrVector(mylist))

#>>> print r.factor(robjects.StrVector(mylist))
#[1] a a b d b
#Levels: a b d

Both of the following produce a segmentation fault error.

r.table(robjects.StrVector(mylist))
r.table(r.factor(robjects.StrVector(mylist)))

I want to pass output of r.table into r.barplot.

r.barplot(r.table(robjects.StrVector(mylist)))

My environments are:
Python 2.4.1

R version 2.7.1 (2008-06-23)

Any advise on usage of r.table() and r.barplot() is much appreciated.

Thanks in advance,
Kylee

p.s. here are some corresponding R outputs.

mylist = c('a', 'a', 'b', 'd', 'b')
mylist
[1] "a" "a" "b" "d" "b"
table(mylist)
mylist
a b d
2 2 1
barplot(table(mylist))

@lgautier
Copy link
Member Author

Original comment by Laurent Gautier (Bitbucket: lgautier, GitHub: lgautier).


Please specify your rpy2 version.

I am running your code without segfault with
rpy2-2.04 (to be released shortly)
and
R-2.9.0/Python 2.4.6
R-2.9.0/Python 2.5.4
R-2.9.0/Python 2.6.2

Trying updating your Python version, then your R version.
There were reports of people seeing mysterious segfault disappear with version R-2.8

L.

@lgautier lgautier transferred this issue from another repository Dec 2, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant