Re: [R] Spreadsheets data

2024-12-05 Thread Martin Møller Skarbiniks Pedersen
On Thu, 5 Dec 2024 at 23:16, Figueiredo, Carlos via R-help wrote: > > Hi there > > > I want to create a script in Rstudio and load in the reagent dataset ensuring > that the different data types in there (dates, text, etc) come through > correctly. What have you tried? How good do you know R? R

Re: [R] Help

2024-02-04 Thread Martin Møller Skarbiniks Pedersen
On Sun, 4 Feb 2024 at 17:26, Jibrin Alhassan wrote: > > Here is the script I used to plot the graph indicating the text I wanted to > insert. The line in the script that I have issues with is: text(-8,-8, > "R^2= 0.62", r = 0.79, N = 161", cex = 2 > R^2= 0.62 is not producing R squared = 0.62.

Re: [R] List of Words in BioWordVec

2024-02-03 Thread Martin Møller Skarbiniks Pedersen
On Fri, Feb 2, 2024, 01:37 TJUN KIAT TEO wrote: > Is there a way to extract list of words in BioWordVec in R > library(text) word_vectors <- textEmbed(texts = NULL, model = 'bioWordVecModel', model_type = 'wordvectors') word_list <- rownames(word_vectors$wordvectors) [[alternative

[R] Suggestion for list - change reply-to

2023-12-14 Thread Martin Møller Skarbiniks Pedersen
Hi, I suggest that reply-to is changed to r-help@r-project.org and not the original sender. The reason for my suggestion: I just made a mistake when replying to a message. I forgot to change the reply address from the sender to the r-help and I think that happens quite often for others al

Re: [R] Sorting based a custom sorting function

2023-12-14 Thread Martin Møller Skarbiniks Pedersen
On Thu, 14 Dec 2023 at 12:02, Duncan Murdoch wrote: > > class(df$value) <- "sizeclass" > > `>.sizeclass` <- function(left, right) custom_sort(unclass(left), > unclass(right)) == 1 > > `==.sizeclass` <- function(left, right) custom_sort(unclass(left), > unclass(right)) == 0 > > `[.sizeclass` <- fu

Re: [R] Sorting based a custom sorting function

2023-12-14 Thread Martin Møller Skarbiniks Pedersen
> This sounds suspiciously like homework (which is off-topic... see the Posting > Guide) It is not homework. Currently I am trying to solve this: https://adventofcode.com/2023/day/7 But it is something that has puzzled me for a long time. In many programming languages, you can give a "less" func

[R] Sorting based a custom sorting function

2023-12-14 Thread Martin Møller Skarbiniks Pedersen
Hi, I need to sort a data.frame based on a custom sorting function. It is easy in many languages but I can't find a way to do it in R. In many cases I could just use an ordered factor but my data.frame contains poker hands and I need to rank these hands. I already got a function that compar

Re: [R] Confirming MySQL Alive

2023-10-08 Thread Martin Møller Skarbiniks Pedersen
You don't need sudo to run: systemctl status On Sat, Oct 7, 2023, 17:09 Stephen H. Dawson, DSL via R-help < r-help@r-project.org> wrote: > Hi, > > > Getting some data from an older MySQL box. I had an event recently where > the MySQL box went off-line for maintenance without a prior announcement

Re: [R] Help with plotting and date-times for climate data

2023-09-15 Thread Martin Møller Skarbiniks Pedersen
Change geom_point(aes(y = tmax_mean, color = "blue")) to geom_point(aes(y = tmax_mean), color = "blue") if you want blue points. aes(color = ) does not set the color of the points. aes(color = ) takes a column (best if it is a factor) and uses that for different colors. /Martin On Tue, Sep

Re: [R] Book Recommendation

2023-08-28 Thread Martin Møller Skarbiniks Pedersen
The SQLite is a good database to use. https://cran.r-project.org/web/packages/RSQLite/vignettes/RSQLite.html On Mon, Aug 28, 2023, 22:12 Stephen H. Dawson, DSL via R-help < r-help@r-project.org> wrote: > > This is an academic course. The effort now is to nail down the former. I > am pushing agai

Re: [R] Fwd: alternative way to define a function

2021-12-02 Thread Martin Møller Skarbiniks Pedersen
On Thu, 2 Dec 2021 at 12:40, Ivan Krylov wrote: > > > The \(arguments) syntax has been introduced in R 4.1.0: > https://cran.r-project.org/doc/manuals/r-release/NEWS.html (search for > "\(x)"). It is the same as function(arguments). > > The only benefit is slightly less typing; could be useful if

[R] Fwd: alternative way to define a function

2021-12-02 Thread Martin Møller Skarbiniks Pedersen
By reading some code today I have just discovered an alternative way to define a function: f <- \(x, y) x * y Is that exactly the same as: f <- function(x,y) x * y ? Is there any benefit to the first or second way to define a function? Regards Martin [[alternative HTML version deleted]]

Re: [R] Is there a hash data structure for R

2021-11-02 Thread Martin Møller Skarbiniks Pedersen
On Tue, 2 Nov 2021 at 10:48, Yonghua Peng wrote: > > I know this is a newbie question. But how do I implement the hash structure > which is available in other languages (in python it's dict)? > As other posters wrote then environments are the solution. data.frames, vectors and lists are much slow

Re: [R] docker containers and R

2021-10-27 Thread Martin Møller Skarbiniks Pedersen
On Wed, 27 Oct 2021 at 20:53, Bogdan Tanasa wrote: > Dear all, would you please advise : > > shall I have a container that runs R (below), and install specifically a > package called UMI4Cats, obviously, a lot of other libraries are > installed.How can I save the docker container that contains th

Re: [R] Still puzzled about different graph

2021-04-24 Thread Martin Møller Skarbiniks Pedersen
> > I don't know where it says this in the docs, but generally speaking > ggplot2 graphs don't evaluate everything until you print them. So I'd > expect p3's two geom_path components to be identical, even though you > changed idx. > > I think you can force evaluation before printing (using ggplot_

Re: [R] ggplot2::geom_path() in a loop problems.

2021-04-24 Thread Martin Møller Skarbiniks Pedersen
On Fri, 23 Apr 2021 at 20:51, Chris Evans wrote: > > I may be quite wrong but isn't the for loop in the second example simply overwriting/replacing the first p2 with the second whereas the p1 version is adding the paths to p1. > > (If you see what I mean, I don't think I have expressed that very w

[R] Still puzzled about different graph

2021-04-24 Thread Martin Møller Skarbiniks Pedersen
Hi, Any ideas why I don't get the same graph out of p1 and p3? I have also posted it in the rstudio community without luck. https://community.rstudio.com/t/ggplot2-geom-path-in-a-loop/102716/2 library(ggplot2) df <- data.frame(x = c(0,25,0,-25,0), y = c(25,0,-25,0,25)) p1 <- ggplot() p1 <- p

Re: [R] ggplot2::geom_path() in a loop problems.

2021-04-23 Thread Martin Møller Skarbiniks Pedersen
On Fri, 23 Apr 2021 at 20:11, Martin Møller Skarbiniks Pedersen < traxpla...@gmail.com> wrote: > > Hi, > > I have some problems understanding how to use geom_path() inside a loop. > I know the code below is a bit silly but it is just a MRE > ( https://stackoverflow.com/h

[R] ggplot2::geom_path() in a loop problems.

2021-04-23 Thread Martin Møller Skarbiniks Pedersen
Hi, I have some problems understanding how to use geom_path() inside a loop. I know the code below is a bit silly but it is just a MRE ( https://stackoverflow.com/help/minimal-reproducible-example ) p1 looks like I expect however p2 only contains the last square. I expected p2 to be the same as p

Re: [R] updating OpenMx failed

2021-04-12 Thread Martin Møller Skarbiniks Pedersen
btw. I installed without problems OpenMx on a xubuntu 20.10 running R 4.0.5. Are your gcc toolchain up to date? On Mon, Apr 12, 2021, 00:31 Rich Shepard wrote: > On Sun, 11 Apr 2021, Martin Møller Skarbiniks Pedersen wrote: > > > You should contact the maintainers of

Re: [R] updating OpenMx failed

2021-04-11 Thread Martin Møller Skarbiniks Pedersen
On Sun, 11 Apr 2021 at 18:10, Rich Shepard wrote: > > I'm running Slackware-14.2/x86_64 and R-4.0.2-x86_64-1_SBo. > > Updating OpenMx failed: > omxState.cpp:1230:82: required from here > omxState.cpp:1229:17: error: cannot call member function ‘void ConstraintVec::eval(FitContext*, double*, doub

Re: [R] "global parameter" warning using data.table in package.

2021-03-05 Thread Martin Møller Skarbiniks Pedersen
Please ignore my previous email. I just found the R-package-devel mailing list. On Fri, 5 Mar 2021 at 14:25, Martin Møller Skarbiniks Pedersen < traxpla...@gmail.com> wrote: > Hi, > > I am converting a couple of functions into a R-package. Many of the > functions use data.tab

[R] "global parameter" warning using data.table in package.

2021-03-05 Thread Martin Møller Skarbiniks Pedersen
Hi, I am converting a couple of functions into a R-package. Many of the functions use data.table. I have two questions using data.table in my own package. Normally I would put each question in separate emails but I think they might be connected. First question is short and I think the answe

[R] How to calculate area and volume of an image with R

2021-02-28 Thread Martin Møller Skarbiniks Pedersen
On Sun, Feb 28, 2021, 17:49 Paul Bernal wrote: > Hello everyone, > > Is there a way to calculate volume and area of an image with R? How can an image have a volume or an area? I think you need to be more specific. Regards Martin [[alternative HTML version deleted]] __

[R] union of two sets are smaller than one set?

2021-01-31 Thread Martin Møller Skarbiniks Pedersen
This is really puzzling me and when I try to make a small example everything works like expected. The problem: I got these two large vectors of strings. > str(s1) chr [1:766608] "0.dk" ... > str(s2) chr [1:59387] "043.dk" "0606.dk" "0618.dk" "0888.dk" "0iq.dk" "0it.dk" ... And I need to creat

Re: [R] Converting "day of year" to "year", "month" and "day"

2021-01-15 Thread Martin Møller Skarbiniks Pedersen
On Fri, 15 Jan 2021 at 18:55, Jibrin Alhassan wrote: > > Dear R users, > I am very new to R software. I have solar wind speed data needed for my > work. How do I convert day in the year to year, month, and day with R > software? I have used this code > as.Date(0, origin = "1998-01-01") Look at th

Re: [R] log of small values in R

2021-01-13 Thread Martin Møller Skarbiniks Pedersen
On Mon, 11 Jan 2021 at 08:22, Shaami wrote: > > Dear FriendsI am facing the problem of log values in R. The > log(1-0.9) is giving -Inf while log(1e-18) gives finite > answer. Any suggestion to deal with this problem? Thank you This vignette has a lot of good information

Re: [R] ggplot2::coord_fixed() margin problem

2020-12-20 Thread Martin Møller Skarbiniks Pedersen
On Sun, 20 Dec 2020 at 17:43, Rui Barradas wrote: Thank you for trying to answer my question. > I am not sure I understand the problem. > With coord_fixed() both axis have the same length and the plot is a > square. When resizing the plot window the white areas can be on > top/bottom if the wind

Re: [R] Problem in cluster sampling: 'mixed with negative subscripts'

2020-12-20 Thread Martin Møller Skarbiniks Pedersen
On Sun, 20 Dec 2020 at 06:22, Richard O'Keefe wrote: > More accurately, in x[i] where x and i are simple vectors, > i may be a mix of positive integers and zeros > where the zeros contribute nothing to the result > Yes, index 0 doesn't get an error or a warning. I think it should. Eg. (v <- 1

[R] ggplot2::coord_fixed() margin problem

2020-12-20 Thread Martin Møller Skarbiniks Pedersen
Hi, I posted this on the Google Group for ggplot2 but got no response. https://groups.google.com/g/ggplot2/c/441srnt6RZU So I hope someone can help me here instead?! - If I don't use the coord_fixed() then all the background is yellow as expected. But I need to coord_fixed() and then it adds a

Re: [R] RGB -> CYMK, with consistent colors

2020-11-30 Thread Martin Møller Skarbiniks Pedersen
On Sun, 29 Nov 2020 at 20:55, Derek M Jones wrote: [...] > > library("colorspace") > > two_c=rainbow(2) > x=runif(20) > y=runif(20) > plot(x, y, col=two_c[2]) > pdf(file="cmyk.pdf", colormodel="cmyk") > plot(x, y, col=two_c[2]) > dev.off() rainbow(2) gives two RGB-colours: #FF (=pure red) and

Re: [R] RGB -> CYMK, with consistent colors

2020-11-29 Thread Martin Møller Skarbiniks Pedersen
On Sun, 29 Nov 2020 at 14:26, Derek Jones wrote: [...] > I can regenerate the images, and explicitly specify cmyk. But using: > > pdf.options(colormodel="cymk") > > does not change anything. The colors look remarkably similar to > those produced via the ghostview route. [...] > Does anybody

Re: [R] analyzing results from Tuesday's US elections

2020-11-11 Thread Martin Møller Skarbiniks Pedersen
Please watch this video if you wrongly believe that Benford's law easily can be applied to elections results. https://youtu.be/etx0k1nLn78 On Sun, Nov 1, 2020, 21:17 Spencer Graves < spencer.gra...@effectivedefense.org> wrote: > Hello: > > >What can you tell me about plans to analyze d

Re: [R] Help in R code

2020-10-18 Thread Martin Møller Skarbiniks Pedersen
I think you first should read and understand this: https://stackoverflow.com/help/minimal-reproducible-example and https://stackoverflow.com/help/how-to-ask On Sun, Oct 18, 2020, 11:57 Faheem Jan via R-help wrote: > Good morning, Please help me to code this code in R. > I working in the multiva

Re: [R] ggplot to visualize data

2020-06-08 Thread Martin Møller Skarbiniks Pedersen
On Mon, 8 Jun 2020 at 18:25, Neha gupta wrote: > I am still waiting for someone to respond. > > Please read this guide about asking questions and try again on the correct mailing-list. https://www.r-project.org/posting-guide.html Regards Martin [[alternative HTML version deleted]]

[R] bug or just me

2020-05-30 Thread Martin Møller Skarbiniks Pedersen
Hi, Is this a bug or just me doing something stupid? solve(m) never returns and eats 100% CPU. > sessionInfo() R version 3.6.3 (2020-02-29) Platform: x86_64-pc-linux-gnu (64-bit) Running under: Ubuntu 20.04 LTS Matrix products: default BLAS: /usr/lib/x86_64-linux-gnu/openblas-pthread/libbla

Re: [R] Package installation problem

2020-05-29 Thread Martin Møller Skarbiniks Pedersen
On Fri, 29 May 2020 at 07:03, John via R-help wrote: > I'm not certain just what this problem is. Trying to install the > "curl" package, which "tseries" wants results in the following error: > > > Package libcurl was not found in the pkg-config search path. > Perhaps you should add the dir

Re: [R] extremely long installation of devtools

2020-03-09 Thread Martin Møller Skarbiniks Pedersen
On Mon, 9 Mar 2020 at 09:57, Christopher C. Lanz via R-help wrote: > Help! I followed the instructions I found to install ggbiplot, and entered > "install_packages("devtools")" about 25 minutes ago, and the installation > procedure is continuing as I write this. Hi, This is a lot of guess-w

Re: [R] Executing an R script and show the plots.

2020-01-29 Thread Martin Møller Skarbiniks Pedersen
On Sun, 26 Jan 2020 at 16:30, Felix Blind wrote: > > But when I put the same code in a file script.r and run it with R -f > script.r or if I source it in the REPL with source("script.r") I do not > get any plots shown. > > Can you guys tell me what I do wrong. (Apart from either using RStudio > o

Re: [R] [FORGED] Re: Executing an R script and show the plots.

2020-01-29 Thread Martin Møller Skarbiniks Pedersen
On Tue, 28 Jan 2020 at 13:03, Felix Blind wrote: > > I am using Linux and device X11 worked for me in the past. I will check > your script later and tell you if it works. [...] I am using R version 3.6.2 on ubuntu 18.04.3 LTS and the X11-device when I make plot in the terminal works without prob

Re: [R] How to store something not simple in a vector?

2020-01-26 Thread Martin Møller Skarbiniks Pedersen
> I am trying to create a vector to store objects create with gmp::as.bigq(). [...] > library(gmp) > V <- vector(typeof(as.bigq(1)), 100) # typeof(as.bigq(1)) is raw > V[[100]] <- as.bigq(1,2) I got a solution now. If I use a list instead then everything works. Regards Martin M. S. Pedersen ___

[R] How to store something not simple in a vector?

2020-01-26 Thread Martin Møller Skarbiniks Pedersen
Hi, Sorry for the HTML version in the buttom of this email. I don't think it is possible to post using gmail without a html-version in the end. Anyway to my problem: I am trying to create a vector to store objects create with gmp::as.bigq(). My first attempt: library(gmp) V <- vector("bigq",

[R] Conversion from python to R - log-problem

2019-10-27 Thread Martin Møller Skarbiniks Pedersen
Hi, I am trying to convert a small python computation to R but my R version gets the wrong result. The python code: import math import log x = log(2) for i in range(3,7): x = log(i)**x print(x) 3.14157738716919 My R-version: x <- log10(2) for (i in 3:6) { x <- log10(i)**x } print(x) [1]

Re: [R] static vs. lexical scope

2019-09-26 Thread Martin Møller Skarbiniks Pedersen
On Wed, 25 Sep 2019 at 11:03, Francesco Ariis wrote: > > Dear R users/developers, > while ploughing through "An Introduction to R" [1], I found the > expression "static scope" (in contraposition to "lexical scope"). > > I was a bit puzzled by the difference (since e.g. Wikipedia conflates the > tw

[R] R wrong, Python rigth in calcution

2019-09-17 Thread Martin Møller Skarbiniks Pedersen
Hi, I don't understand why R computes this wrong. I know I can use gmp and R will do it correctly. $ echo '569936821221962380720^3 + (-569936821113563493509)^3 + (-472715493453327032)^3' | Rscript - [1] -4.373553e+46 Correct answer is 3 and Python can do it: $ echo 'pow(569936821221962380720,3)

Re: [R] Moving 2nd column into 1st column using R

2019-09-11 Thread Martin Møller Skarbiniks Pedersen
On Tue, 10 Sep 2019 at 04:20, smart hendsome via R-help < r-help@r-project.org> wrote: > > Hi R-user, > I have a problem regarding R. How can I move my 2nd column into 1st column. For example I have data as below: > mydf <- data.frame(matrix(1:6, ncol = 2)) > mydf > X1 X2 1 4 2 5 3

Re: [R] Reading large files with R

2019-09-01 Thread Martin Møller Skarbiniks Pedersen
On Sun, 1 Sep 2019 at 21:53, Duncan Murdoch wrote: > On 01/09/2019 3:06 p.m., Martin Møller Skarbiniks Pedersen wrote: > > Hi, > > > >I am trying to read yaml-file which is not so large (7 GB) and I have > > plenty of memory. > > > Individual elements in

[R] Reading large files with R

2019-09-01 Thread Martin Møller Skarbiniks Pedersen
Hi, I am trying to read yaml-file which is not so large (7 GB) and I have plenty of memory. However I get this error: $ R --version R version 3.6.1 (2019-07-05) -- "Action of the Toes" Copyright (C) 2019 The R Foundation for Statistical Computing Platform: x86_64-pc-linux-gnu (64-bit) library

[R] GMP help - converting rosetta RSA-code to R

2019-08-17 Thread Martin Møller Skarbiniks Pedersen
Hi, I am trying to make a R version a RosettaCode task involving big number. More precise, I am trying to convert the c-solution http://rosettacode.org/wiki/RSA_code#C to R. These two lines in C gives me problems: const char *plaintext = "Rossetta Code"; mpz_import(pt, strlen(plaintext)

[R] gmp coredump - where to report?

2019-08-16 Thread Martin Møller Skarbiniks Pedersen
Hi, I has trying to convert some raw values into a big number with the library gmp. However the library makes R crash. Two questions: 1. Should I report the problem and if yes, where can I report the problem? 2. Is the source code for the R version of GMP somewhere on eg. github, so I can post

Re: [R] Remove cases with -Inf from a data frame

2019-02-16 Thread Martin Møller Skarbiniks Pedersen
On Sat, 16 Feb 2019 at 16:07, AbouEl-Makarim Aboueissa < abouelmakarim1...@gmail.com> wrote: > > I have a log-transformed data frame with some *-Inf* data values. > > *my question: *how to remove all rows with *-Inf* data value from that data > frame? Hi, Here is a solution which uses apply. F

Re: [R] Newbie Question on R versus Matlab/Octave versus C

2019-01-30 Thread Martin Møller Skarbiniks Pedersen
On Mon, 28 Jan 2019 at 22:58, Alan Feuerbacher wrote: [...] > These all have advantages and > disadvantages for certain tasks, but as I'm new to R I hardly know how > to evaluate them. Any suggestions? If you have one-hour left, you can download pdf file (8 pages total) "Getting started in R"

Re: [R] Diff'ing 2 strings

2019-01-10 Thread Martin Møller Skarbiniks Pedersen
On Thu, 10 Jan 2019 at 09:23, Gerrit Eichner < gerrit.eich...@math.uni-giessen.de> wrote: > Don't you mean ?Rdiff ? > > Oh yes. The unix/linux command diff uses the rdiff-algorithme and it seems that Rdiff in R uses the exactly same algorithme. Regards Martin [[alternative HTML version d

Re: [R] Diff'ing 2 strings

2019-01-09 Thread Martin Møller Skarbiniks Pedersen
On Sat, Jan 5, 2019, 14:58 Sebastien Bihorel < sebastien.biho...@cognigencorp.com wrote: > Hi, > > Does R include an equivalent of the linux diff command? > yes. ?rdiff /martin [[alternative HTML version deleted]] __ R-help@r-project.org mail

[R] very slow "memoise"

2018-11-15 Thread Martin Møller Skarbiniks Pedersen
Hi, I want to compute a lot of values and I have tried to use memoise::memoise to speed-up the computation. However it is much slower using the memoised version. I guess I have misunderstood how to use the package memoise or the purpose of the package. The code takes more than 2 minutes to f

[R] prod(NaN, NA) vs. prod(NA, NaN)

2018-07-03 Thread Martin Møller Skarbiniks Pedersen
Hi, I am currently using R v3.4.4 and I just discovered this: > prod(NA, NaN) ; prod(NaN, NA) [1] NA [1] NaN ?prod says: If ‘na.rm’ is ‘FALSE’ an ‘NA’ value in any of the arguments will cause a value of ‘NA’ to be returned, otherwise ‘NA’ values are ignored. So according to the m

[R] Regexp bug or misunderstanding

2018-07-02 Thread Martin Møller Skarbiniks Pedersen
Hi, Have I found a bug in R? Or misunderstood something about grep() ? Case 1 gives the expected output Case 2 does not gives the expected output. I expected integer(0) also for this case. case 1: grep("[:digit:]", "**ABAAbabaabackabaloneaban") integer(0) case 2: grep("[:digit:]", "

Re: [R] Unable to take correct Web-snapshot

2018-06-01 Thread Martin Møller Skarbiniks Pedersen
On 1 June 2018 at 15:08, Christofer Bogaso 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/ > *, this fails to take the full snapshot of that > page. Yes, that is a g

Re: [R] rJava garbage collect

2018-02-06 Thread Martin Møller Skarbiniks Pedersen
On 6 February 2018 at 04:34, Benjamin Tyner wrote: > Hi > > Does rJava offer a way to instruct the JVM to perform a garbage collection? Do you really, really need to run the garbage collector? Consider reading: https://stackoverflow.com/questions/5086800/java-garbage-collection Regards Martin

Re: [R] reading lisp file in R

2018-01-18 Thread Martin Møller Skarbiniks Pedersen
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

[R] Help making first dataset R package

2018-01-17 Thread Martin Møller Skarbiniks Pedersen
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 connect

Re: [R] roxygen2 error - x$tag operator is invalid for atomic vectors

2018-01-17 Thread Martin Møller Skarbiniks Pedersen
On 17 January 2018 at 14:30, Eric Berger wrote: > This is an error message from R. > For example, if you give the following R commands > > a <- 5 > > a$foo > This will generate the error message: > Error in a$foo : $ operator is invalid for atomic vectors > > So you can search for the string 'x$

[R] roxygen2 error - x$tag operator is invalid for atomic vectors

2018-01-17 Thread Martin Møller Skarbiniks Pedersen
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

Re: [R] Help with first S3-class

2018-01-03 Thread Martin Møller Skarbiniks Pedersen
On 3 January 2018 at 08:36, Jeff Newmiller wrote: > Function arguments are not pass-by-reference... they are pass-by-value. You > need to return the altered object to the caller when you are done messing > with it. Thanks. Of course. Now it is working. > Note that R is a data processing langu

Re: [R] Help with first S3-class

2018-01-02 Thread Martin Møller Skarbiniks Pedersen
Some mistake: > I expect this output: [1] 100 Martin Saldo is: 100 but I get [1] 0 Martn Saldo is: 0 __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide ht

Re: [R] Help with first S3-class

2018-01-02 Thread Martin Møller Skarbiniks Pedersen
On 3 January 2018 at 00:52, Duncan Murdoch 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 conf

Re: [R] Help with first S3-class

2018-01-02 Thread Martin Møller Skarbiniks Pedersen
On 3 January 2018 at 00:52, Duncan Murdoch 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 conf

[R] Help with first S3-class

2018-01-02 Thread Martin Møller Skarbiniks Pedersen
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 OOP. I have pasted my attempt at creating a bank-account class below and my problems are: 1. What should be added some pl

Re: [R] Rcpp, dyn.load and C++ problems

2017-12-03 Thread Martin Møller Skarbiniks Pedersen
> > > edd@bud:~$ r -lRcpp -e'sourceCpp("/tmp/mmsp.cpp")' ??? What is r in this case ? A alias for something ? Regards Martin [[alternative HTML version deleted]] __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://st

Re: [R] Rcpp, dyn.load and C++ problems

2017-12-03 Thread Martin Møller Skarbiniks Pedersen
On 3 December 2017 at 20:19, Dirk Eddelbuettel wrote: Hi Dirk, Thanks for your answers. I got a few more questions. > > 0) Wrong list. Rcpp has its down, rcpp-devel, and I basically do not read > this and would have missed this were it not for luck. OK. I did found the rcpp-devel mailing-list

Re: [R] Rcpp, dyn.load and C++ problems

2017-12-03 Thread Martin Møller Skarbiniks Pedersen
On 3 December 2017 at 05:23, Eric Berger 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

Re: [R] Rcpp, dyn.load and C++ problems

2017-12-03 Thread Martin Møller Skarbiniks Pedersen
9 _Z18compute_values_cppidid $ R R> dyn.load("logistic_map.so") R> .Call("compute_values_cpp") Error in .Call("compute_values_cpp") : C symbol name "compute_values_cpp" not in load table Hmm. > HTH, > Eric > > > On Sun, Dec 3, 2017 at

[R] Rcpp, dyn.load and C++ problems

2017-12-02 Thread Martin Møller Skarbiniks Pedersen
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 using namespace Rcpp; // [[Rcpp::export]] List com

Re: [R] pls in r

2017-12-01 Thread Martin Møller Skarbiniks Pedersen
Hi, On 1 December 2017 at 13:17, Margarida Soares wrote: > I am a beginner in R, and I wonder if anyone could help me with a partial least square regression in R. > I have looked up the instructions and the manual from Bjorn Mevi and Ron Wehrens. So you have read the vignette also ? https://cra

[R] Help avoiding setting column type two times

2017-11-30 Thread Martin Møller Skarbiniks Pedersen
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

Re: [R] ggplot2 and tikzDevice : problems with accents

2017-10-22 Thread Martin Møller Skarbiniks Pedersen
On 22 October 2017 at 17:56, Jacques Ropers wrote: > > Hi all, > > I can't fathom why the accented "é" in the following ggplot2 graph makes > R hangs when using tikzdevice, whereas it works using simple pdf device. > [...] I just tried your code and my R doesn't hang but it does give an TeX-erro

Re: [R] [FORGED] can't print ggplot with Chinese characters to pdf files

2017-10-20 Thread Martin Møller Skarbiniks Pedersen
On 20 October 2017 at 04:21, John wrote: > > Hi, > >Following Paul's instruction, I have installed the Cairo. I tried to run > the program, and there is no error message at all. I did see the Chinese > title in the plot if I ask my RStudio to show the plot (if I type "p1"), > but the pdf file

Re: [R] How to add make option to package compilation?

2017-09-15 Thread Martin Møller Skarbiniks Pedersen
On 15 September 2017 at 14:13, Duncan Murdoch wrote: > On 15/09/2017 8:11 AM, Martin Møller Skarbiniks Pedersen wrote: > >> Hi, >> >>I am installing a lot of packages to a new R installation and it takes >> a >> long time. >>However the machi

[R] How to add make option to package compilation?

2017-09-15 Thread Martin Møller Skarbiniks Pedersen
Hi, I am installing a lot of packages to a new R installation and it takes a long time. However the machine got 4 cpus and most of the packages are written in C/C++. So is it possible to add a -j4 flag to the make command when I use the install.packages() function? That will probably spee

Re: [R] Optimize code to read text-file with digits

2017-09-08 Thread Martin Møller Skarbiniks Pedersen
On 8 September 2017 at 14:37, peter dalgaard wrote: > > > > On 8 Sep 2017, at 14:03 , peter dalgaard wrote: > > > > x <- scan("~/Downloads/digits.txt") > > x <- x[-seq(1,22,11)] > > ...and, come to think of it, if you really want the 100 random digits: > > xx <- c(outer(x,10^(0:4), "%/%")

Re: [R] Optimize code to read text-file with digits

2017-09-08 Thread Martin Møller Skarbiniks Pedersen
On 8 September 2017 at 11:25, PIKAL Petr wrote: > > Moller Skarbiniks Pedersen > My program which is slow looks like this: > > > > filename <- "digits.txt" > > lines <- readLines(filename) > > why you do not read a file as a whole e.g. by > > lines<-read.table("digits.txt") > Good idea. > > An

[R] Optimize code to read text-file with digits

2017-09-08 Thread Martin Møller Skarbiniks Pedersen
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.ra

Re: [R] Error in .jnew(“java/io/FileOutputStream”, jFile)

2017-08-22 Thread Martin Møller Skarbiniks Pedersen
On 22 August 2017 at 17:51, Александр Мащенко wrote: > > > I don't know R absolutely, but I have to do this work for my diploma. So I'm sorry for strange message below. Please, help me anybody decides this issue. [...] > > write.xlsx(ab_ret, "C:\\Users\\Sapl\\Desktop\\NATA\\code\\Results\\Create

[R] Help creating the IBM Randu function

2017-08-14 Thread Martin Møller Skarbiniks Pedersen
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 function I have created. First I define the function RANDU like this: > RANDU <- function(num) { return (65539*num)%%(2