Displaying 20 results from an estimated 3000 matches similar to: "Help creating the IBM Randu function"
2017 Aug 14
0
Help creating the IBM Randu function
Please look at ?datasets::randu
for David Donoho's translation of RANDU into R.
On Mon, Aug 14, 2017 at 12:49 PM, Martin M?ller Skarbiniks Pedersen
<traxplayer at gmail.com> wrote:
> Dear all,
>
> I am trying to learn functions in R and 3D plotting so I decided to try
> to plot
> the famous bad PRNG Randu from IBM(1).
> However something is not correct in the
2017 Aug 14
0
Help creating the IBM Randu function
Hi Martin,
The corrected function would be
RANDU <- function(num) { return ((65539*num)%%(2^31)) }
You forgot the brackets for the return function.
Hence, what was returned was always (65539 * num)
On Mon, Aug 14, 2017 at 12:49 PM, Martin M?ller Skarbiniks Pedersen
<traxplayer at gmail.com> wrote:
> Dear all,
>
> I am trying to learn functions in R and 3D plotting so I
2018 Jan 17
3
roxygen2 error - x$tag operator is invalid for atomic vectors
Hi,
I am trying to create my first R package.
I will later today put the files on Github.
However I gets this error and I can't find any reason for it:
R> roxygen2::roxygenise()
First time using roxygen2. Upgrading automatically...
Error in x$tag : $ operator is invalid for atomic vectors
R>
Any ideas?
Regards
Martin M. S. Pedersen
[[alternative HTML version deleted]]
2017 Dec 03
5
Rcpp, dyn.load and C++ problems
Hi,
I have written a small C++ function and compile it.
However in R I can't see the function I have defined in C++.
I have read some web-pages about Rcpp and C++ but it is a bit confusion
for me.
Anyway,
This is the C++-code:
#include <Rcpp.h>
using namespace Rcpp;
// [[Rcpp::export]]
List compute_values_cpp(int totalPoints = 1e5, double angle_increment =
0.01, int radius =
2017 Sep 08
5
Optimize code to read text-file with digits
Hi,
Every day I try to write some small R programs to improve my R-skills.
Yesterday I wrote a small program to read the digits from "A Million
Random Digits" from RAND.
My code works but it is very slow and I guess the code is not optimal.
The digits.txt file downloaded from
https://www.rand.org/pubs/monograph_reports/MR1418.html
contains 20000 lines which looks like this:
00000
2018 Jan 17
2
Help making first dataset R package
Hi,
I am trying to make my first R package containing only a single
data.frame and documentation.
All code can be found at:
https://github.com/MartinMSPedersen/folkeafstemninger
When I check the package I get four warnings.
I will list all warnings in this email because they migth be connected.
1.
* checking if this is a source package ... WARNING
Subdirectory ?src? contains:
2018 Jun 01
1
Unable to take correct Web-snapshot
Thanks for that information.
However how can I use R to directly get data from that API?
On Fri, Jun 1, 2018 at 8:36 PM Martin M?ller Skarbiniks Pedersen <
traxplayer at gmail.com> wrote:
> On 1 June 2018 at 15:08, Christofer Bogaso <bogaso.christofer at gmail.com>
> wrote:
> > Hi again,
> >
> > I use the *webshot* package to take snapshot from Webpage.
2018 Jan 03
2
Help with first S3-class
On 3 January 2018 at 00:52, Duncan Murdoch <murdoch.duncan at gmail.com> wrote:
> On 02/01/2018 6:38 PM, Martin M?ller Skarbiniks Pedersen wrote:
>>
>> Hi,
>>
>> I am trying to understand S3 classes. I have read several tutorials
>> about
>> the topics but I am still a bit confused. I guess it is because it is
>> so different from
>> Java
2018 Jan 19
0
reading lisp file in R
Here are the beginning of a R program.
I hope it can help you writing the rest of the program.
Regards
Martin M. S. Pedersen
----
filename <- "university.data"
lines <- readLines(filename)
first <- T
for (ALine in lines) {
ALine <- sub("^ +","",ALine)
ALine <- sub(")","",ALine, fixed = T)
if
2017 Dec 03
0
Rcpp, dyn.load and C++ problems
.Call("compute_values_cpp")
Also, if you were passing arguments to the C++ function you would need to
declare the function differently.
Do a search on "Rcpp calling C++ functions from R"
HTH,
Eric
On Sun, Dec 3, 2017 at 3:06 AM, Martin M?ller Skarbiniks Pedersen <
traxplayer at gmail.com> wrote:
> Hi,
>
> I have written a small C++ function and compile it.
2017 Sep 08
1
Optimize code to read text-file with digits
> On 8 Sep 2017, at 15:51 , Martin M?ller Skarbiniks Pedersen <traxplayer at gmail.com> wrote:
>
> On 8 September 2017 at 14:37, peter dalgaard <pdalgd at gmail.com> wrote:
>>
>>
>>> On 8 Sep 2017, at 14:03 , peter dalgaard <pdalgd at gmail.com> wrote:
>>>
>>> x <- scan("~/Downloads/digits.txt")
>>> x <-
2002 Oct 10
1
Documentation for randu() (PR#2141)
Full_Name: Andrew J. Baczkowski
Version: 1.1.1, 1.5.0
OS: NT, unix
Submission from: (NULL) (129.11.159.161)
Help documentation for randu() has incorrect R code in Example.
Should replace line 4
seed <<- ((2^16) + 3) * seed)
by
seed <<- ((2^16) + 3) * seed) %% (2^31)
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-devel mailing list -- Read
2017 Nov 30
2
Help avoiding setting column type two times
Hi,
I think and hope this a good place to ask for code review for a R
beginners?
I have made a R script which generates a dataset based on 2009 danish
referendum and it does work.
But I think the code could be better and I would any comments how the
code can be improved.
At least I would like to know how I avoid converting several of the
columns to factors in the end of the code?
2018 Jan 03
0
Help with first S3-class
Some mistake:
> I expect this output:
[1] 100
Martin
Saldo is: 100
but I get
[1] 0
Martn
Saldo is: 0
2018 Jun 01
0
Unable to take correct Web-snapshot
On 1 June 2018 at 15:08, Christofer Bogaso <bogaso.christofer at gmail.com> wrote:
> Hi again,
>
> I use the *webshot* package to take snapshot from Webpage. However, when I
> try to take snapshot from* https://www.coinbase.com/
> <https://www.coinbase.com/>*, this fails to take the full snapshot of that
> page.
Yes, that is a general problem with many webshot
2018 Jun 01
2
Unable to take correct Web-snapshot
Hi again,
I use the *webshot* package to take snapshot from Webpage. However, when I
try to take snapshot from* https://www.coinbase.com/
<https://www.coinbase.com/>*, this fails to take the full snapshot of that
page.
I tried following :
> library(webshot)
> webshot("https://www.coinbase.com/", 'aa.pdf')
However in the pdf page, I done see the quotes which are
2017 Sep 08
0
Optimize code to read text-file with digits
On 8 September 2017 at 14:37, peter dalgaard <pdalgd at gmail.com> wrote:
>
>
> > On 8 Sep 2017, at 14:03 , peter dalgaard <pdalgd at gmail.com> wrote:
> >
> > x <- scan("~/Downloads/digits.txt")
> > x <- x[-seq(1,220000,11)]
>
> ...and, come to think of it, if you really want the 1000000 random digits:
>
> xx <-
2017 Dec 03
2
Rcpp, dyn.load and C++ problems
On 3 December 2017 at 05:23, Eric Berger <ericjberger at gmail.com> wrote:
>
> Do a search on "Rcpp calling C++ functions from R"
>
Thanks. However search for "Rcpp calling C++ functions from R" gives a lot
of result but I think
some of them are outdated and others don't agree with each other.
Can you point to a specific good on-line guide for me?
Regards
2017 Sep 08
2
Optimize code to read text-file with digits
> On 8 Sep 2017, at 14:03 , peter dalgaard <pdalgd at gmail.com> wrote:
>
> x <- scan("~/Downloads/digits.txt")
> x <- x[-seq(1,220000,11)]
...and, come to think of it, if you really want the 1000000 random digits:
xx <- c(outer(x,10^(0:4), "%/%")) %% 10
--
Peter Dalgaard, Professor,
Center for Statistics, Copenhagen Business School
Solbjerg
2011 Feb 02
4
testing randomness of random number generators with student t-test?
Hi, subject more or less says it all.
I freely admit to not having bothered to find some of the online papers
about method of testing the quality of random number generators -- but
in an idle moment I wondered what to expect from something like the
following:
randa<-runif(1000)
randb<-runif(1000)
t.test(randa,randb)$p.value
var.test(randa,randb)$p.value
[repeat ad nauseum]
Is the