Ask Your Question
1

Use R result

asked 2018-01-14 22:42:32 +0200

dg.aragones gravatar image

updated 2018-01-15 03:13:09 +0200

Hi!

I'm new in Sagemath, but I've some experience using R. For example, if I want to generate 100 random numbers from a Bernoulli distribution, I can use the code:

r.rbinom(n=100,size=1,prob=0.25)

But... Is there any way to use the result for another operation in Sagemath? And results related to a linear regression, a given test or a plot (done with R)? May it be more efficient to use Scipy in a general workflow?

Thanks for your answers!

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
1

answered 2018-01-15 00:27:13 +0200

tmonteil gravatar image

updated 2018-01-15 00:27:45 +0200

In this case, you can just call the sage method:

sage: a = r.rbinom(n=100,size=1,prob=0.25)
sage: a
  [1] 0 0 0 1 1 0 0 0 0 0 0 0 1 0 1 0 0 0 1 0 1 0 0 0 0 0 0 1 0 1 1 0 1 0 0 1 0 0 0 0 0 0 1 0 1 0 0
 [48] 0 0 0 0 0 0 0 0 1 1 1 0 1 0 0 0 1 0 0 0 0 0 0 0 0 0 0 1 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 0 1 0 1
 [95] 0 0 1 0 0 0
sage: L = a.sage()
sage: L
edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2018-01-14 22:42:32 +0200

Seen: 345 times

Last updated: Jan 15 '18