[R] Cannot convert from unsigned int to double

2016-09-07 Thread Amina Shahzadi Shahzadi
Hi Dear I am very new to use RcppArmadillo. I am trying to execute the following code. But I got the error cannot convert 'arma::enable_if2, arma::Col, arma::eglue_plus>, arma::eop_exp> >::result {aka const arma::eOp, arma::Col, arma::eglue_plus>, arma::eop_exp>}' to 'double' in return r

Re: [R] Resample with replacement to produce many rarefaction curves with same number of samples

2016-09-07 Thread Nick Pardikes
Hey Luisfo, This looks great, however I still get the same plot as before (seen below). The output looks the same. Here is the figure that was generated from this code: rrarefy.custom <- function (x, sample, rep.param=F) { if (!identical(all.equal(x, round(x)), TRUE)) stop("function is mean

Re: [R] Using apply on a three dimensional matrix and passing multiple arguments to user defined function

2016-09-07 Thread Justin Peter
Dear Liusfo and Jean, Thank you both for your help and suggestions, which both work. As Jean mentioned, there is no real speed up using the apply family, which I thought there would be, so I will stick with the for loop for clarity. Liusfo, the reason I used c(1,2) in the apply function (i.e. m

Re: [R] Fitting Mixture distributions

2016-09-07 Thread Aanchal Sharma
Hi Simon I am facing same problem as described above. i am trying to fit gaussian mixture model to my data using normalmixEM. I am running a Rscript which has this function running as part of it for about 17000 datasets (in loop). The script runs fine for some datasets, but it terminates when i

[R] hello i have a question on music analysis and mathematical synthesis related to r code

2016-09-07 Thread darth brando
Apologies for the long title but it is semi specific a topic and yes I am a noobs user to the system. I have read the guide and will attempt to adhere to the guide in this process and I do apologize in advance if I fail to do so, this is my first time here. To the point; firstly version: I hav

Re: [R] building R from source on gnu version >=5.4

2016-09-07 Thread Chinmay Borwankar
I believe building the source is not really "R-devel question" since I am not really developing anything for R. On the other hand, many people may want to build the R-code with their specific installation requirements. Anyways, if it was wrong place I will post it at right place. On 7 September 2

Re: [R] how to transform db query result into a set of timeseries ?

2016-09-07 Thread Joshua Ulrich
There's no reason to create multiple xts objects if you intend to merge them all into one object. You say the user can select timeseries, so I assume you have column names in a vector. If so, you can do something like this: series <- c("M", "G", "N") ... zonnen <- xts(df[,series], as.POSIXct(df$

Re: [R] fPortfolio dont work in R 3.3.1

2016-09-07 Thread David Winsemius
> On Sep 7, 2016, at 2:35 PM, Andre Barbosa Oliveira > wrote: > > David, > > I think the problem isn't the operacional system. I use the package > fPortfolio without problems in R 3.2.3. But when I try use fPortfolio, in the > same computer, but on R3.3.1 it don't work. I don't think you a

Re: [R] fPortfolio dont work in R 3.3.1

2016-09-07 Thread David Winsemius
> On Sep 7, 2016, at 12:57 AM, Bannert Matthias wrote: > > Andre, > > you need to make sure you got a C/C++ compiler as well as a Fortran compiler > to compile a package from source that makes use of these language. Many R > packages use one of those languages under the hood to speed things

[R] Dynamic forecast

2016-09-07 Thread Edimeire Alexandra Pinto via R-help
Good afternoon. We have two typesof forecast using time series: statistical forecast and dynamic forecast. I would like to make dynamic forecastsimilar to what uses Eviews software. Does anyone know any package in R? Please. [[alternative HTML version deleted]] __

Re: [R] R-specific Software Requirement Specification

2016-09-07 Thread Doran, Harold
This is in fact a *very* good suggestion, Duncan. One could easily rewrite any existing R function by looking at the help page I believe. So, I could in fact begin by writing the help page which we know details the function inputs, details about each argument, what the function is expected to ou

Re: [R] R-specific Software Requirement Specification

2016-09-07 Thread Duncan Murdoch
On 07/09/2016 11:35 AM, Doran, Harold wrote: I'm building a large program with many different people contributing to the coding in R and so it needs a well-articulated design spec. The program will have many different functions that must interact with each other, but the individual functions w

Re: [R] R-specific Software Requirement Specification

2016-09-07 Thread Bert Gunter
Yes! ... and you might consider writing your specifications along with example R code using rmarkdown. The Rstudio GUI has a nice interface and support tools (e.g. for compiling and previewing the doc) for writing rmarkdown, but you can also load and use the package through whatever R interface yo

Re: [R] R-specific Software Requirement Specification

2016-09-07 Thread Doran, Harold
I use Mercurial for this. -Original Message- From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of Rich Shepard Sent: Wednesday, September 07, 2016 11:56 AM To: r-help@r-project.org Subject: Re: [R] R-specific Software Requirement Specification On Wed, 7 Sep 2016, Doran, Harold

Re: [R] R-specific Software Requirement Specification

2016-09-07 Thread Rich Shepard
On Wed, 7 Sep 2016, Doran, Harold wrote: I'm building a large program with many different people contributing to the coding in R and so it needs a well-articulated design spec. The program will have many different functions that must interact with each other, but the individual functions will be

Re: [R] Help with a code in R

2016-09-07 Thread Mark Sharp
Erika, The code you sent is missing some matching braces. For example, see this pair of lines: forecast_nal <- rbind.data.frame(forecast_nal, fct) } I do not see a left brace anywhere before this right brace. Without the content of the data structures datos, calendar and espejo from the thr

[R] R-specific Software Requirement Specification

2016-09-07 Thread Doran, Harold
I'm building a large program with many different people contributing to the coding in R and so it needs a well-articulated design spec. The program will have many different functions that must interact with each other, but the individual functions will be written by different people. I'm curiou

Re: [R] Resample with replacement to produce many rarefaction curves with same number of samples

2016-09-07 Thread Luisfo via R-help
Hi Nick, If you use the following raredata <- rarecurve(rrarefy(netdata, sample=100), label=F, col=rgb(0, 0, 1, 0.1)) should work for any sample size, e.g. sample=100. However, you will have a 'warning' if you don't have samples enough, because it has not replacement. If you type 'rrarefy'

Re: [R] how to manage missing values correctly when importing a data frame

2016-09-07 Thread Ivan Calandra
Hi Stefano, I agree that this behavior of R can be somewhat counter-intuitive, but this can be seen as a safety procedure, so that no assumptions are made and problems can be easily identified. I would think that in this case, the input data is in the wrong format. Half the columns are for R

Re: [R] Help with a code in R

2016-09-07 Thread Erika Rocío Espinosa Balbuena
Hi, Sorry, how can I review on line, but here is the complete code: ##Librerias library(stats) library(base) library(dplyr) library(timeDate) library(zoo) library(forecast) #library(parallel) library(foreach) library(iterators) #library(doParallel) #library(snow) #library(doSNOW) library(reshape

Re: [R] Books on R

2016-09-07 Thread Partners
Hi Preetam, I was just wondering if you could get back to me regarding the book feature on r-project.org/doc/bib/R-books.html Awaiting your reply. Thanks & Regards Eesha Eesha Harish Key Partner Executive - Original Message - From: "Partners" To: "Preetam Pal" Sent: W

Re: [R] element wise pattern recognition and string substitution

2016-09-07 Thread Ista Zahn
On Mon, Sep 5, 2016 at 12:56 PM, Jun Shen wrote: > Thanks for the reply, Bert. > > Your solution solves the example. I actually have a more general situation > where I have this dot concatenated string from multiple variables. The > problem is those variables may have values with dots in there. I

Re: [R] Resample with replacement to produce many rarefaction curves with same number of samples

2016-09-07 Thread Jim Lemon
Hi Nick, This is pretty rough, but it may help: pdf("rd.pdf") raredata<-rarecurve(cbind(netdata,netdata,netdata),label=FALSE, col=rgb(0,0,1,0.1),xlim=c(0,100),ylim=c(0,80)) rect(100,0,104,80,col="white",border=NA) dev.off() Jim On Wed, Sep 7, 2016 at 8:05 AM, Nick Pardikes wrote: > I am curren

Re: [R] how to manage missing values correctly when importing a data frame

2016-09-07 Thread Sarah Goslee
On Wed, Sep 7, 2016 at 10:26 AM, Stefano Sofia wrote: > Thank you for your explanations, and your patience. > With all the humbleness that I can have, I am not a beginner in R. Said that > I am really sorry if my question shows a big lack in understanding some basic > object types and their dist

Re: [R] how to manage missing values correctly when importing a data frame

2016-09-07 Thread Stefano Sofia
Thank you for your explanations, and your patience. With all the humbleness that I can have, I am not a beginner in R. Said that I am really sorry if my question shows a big lack in understanding some basic object types and their distinctions. I still find difficult to understand your comments (

Re: [R] Using apply on a three dimensional matrix and passing multiple arguments to user defined function

2016-09-07 Thread Luisfo via R-help
Hi, Jean's example with lapply works fine. However, if you still want to use apply, I think this works. One observation first. You were passing c(1,2) as second argument to apply, in your code. And that is what makes you have lots of NAs as a result, since your function is being applied twice,

Re: [R] Help with a code in R

2016-09-07 Thread PIKAL Petr
Hi see in line From: Erika Rocío Espinosa Balbuena [mailto:erika...@gmail.com] Sent: Tuesday, September 6, 2016 10:52 PM To: PIKAL Petr Cc: r-help@r-project.org Subject: Re: [R] Help with a code in R Hi Erika Yes the objetcs have the same structure, and forecast_nal is the variable where I a

Re: [R] how to manage missing values correctly when importing a data frame

2016-09-07 Thread PIKAL Petr
Hi Although you did not present your data in suitable format I do not see any problem. See in line > -Original Message- > From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of Stefano > Sofia > Sent: Wednesday, September 7, 2016 1:09 PM > To: r-help@r-project.org > Subject: [R

Re: [R] element wise pattern recognition and string substitution

2016-09-07 Thread Ista Zahn
On Tue, Sep 6, 2016 at 11:59 PM, Jun Shen wrote: > Hi Ista, > > Thanks for the suggestion. I didn't know mapply can be used this way! Let me > take one more step. Instead of defining a pattern for each string, I would > like to define a set of patterns from all the possible combination of the > un

Re: [R] Using apply on a three dimensional matrix and passing multiple arguments to user defined function

2016-09-07 Thread Jeff Newmiller
Should be working, so the devil is in the details you are not showing. Please provide a reproducible (self-contained) example [1] and post in plain text rather than HTML formatted email to avoid code corruption. [1] http://adv-r.had.co.nz/Reproducibility.html -- Sent from my phone. Please excu

Re: [R] how to manage missing values correctly when importing a data frame

2016-09-07 Thread Sarah Goslee
R is refusing to make unwarranted assumptions about your data. See inline. # it's nicer to use dput() instead of pasting raw data Storia_RM_RT <- structure(list(Station_RM = c(1400L, 1460L, 1500L, 1520L), Sensor_RM = 2701:2704, Place_RM = c("Novafeltria", "Carpegna", "Pesaro", "Fano"),

Re: [R] building R from source on gnu version >=5.4

2016-09-07 Thread Jeff Newmiller
Many things are possible, especially if you read the Posting Guide which tells you you that questions involving compiling R belong on R-devel, not R-help. -- Sent from my phone. Please excuse my brevity. On September 7, 2016 1:17:10 AM PDT, Chinmay Borwankar wrote: >Hi, >I want to integrat

Re: [R] Using apply on a three dimensional matrix and passing multiple arguments to user defined function

2016-09-07 Thread Adams, Jean
Justin, I don't think you can get the apply() function to return an array. You could use lapply() instead, and then use simplify2array() to convert the list of matrices to an array. Also, in your mask() function you don't need the which() and you should return the x. See my example with toy dat

Re: [R] finegray function in the survival package

2016-09-07 Thread Therneau, Terry M., Ph.D.
On 09/07/2016 05:00 AM, r-help-requ...@r-project.org wrote: Dear R-Team, I have been trying to use the finegray routine that creates a special data so that Fine and Gray model can be fit. However, it does not seem to work. Could you please help me with this issue? Thanks, Ahalya. You have

[R] how to manage missing values correctly when importing a data frame

2016-09-07 Thread Stefano Sofia
Dear R users, I have a data frame with 22 columns, called Storia_RM_RT. Here the first 4 rows: Station_RM Sensor_RM Place_RM Y_init_RM M_init_RM D_init_RM Long_cent_RM Lat_cent_RM Height_RM Continues Station_RT Sensor_RT Place_RT Name1_RT Name2_RT Long_cent_RT Lat_cent_RT Height_RT Actual_net No

[R] Resolution parameter in Louvain community detection

2016-09-07 Thread Lietz, Haiko
Hi all, igraph doesn't have a resolution parameter for Louvain community detection. Does anybody know of another package that has it? Best Haiko [[alternative HTML version deleted]] __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and

Re: [R] Pass an optional argument from Fortran subroutine to a R wrapper

2016-09-07 Thread Erin Hodgess
Hello! You can't really pass the matrix as a matrix. Send it as a vector, re-construct it in the Fortran program. Actually, if it's a covariance matrix and symmetric, you may be able to get away with just sending part of the matrix. For example, if you have the following: covmat<- matrix(c(1,0.

[R] [R-pkgs] Lahman package v. 5.0.0 released to CRAN

2016-09-07 Thread Michael Friendly
## Lahman package v. 5.0.0 released to CRAN Team Lahman is pleased to announce that v. 5.0.0 of the Lahamn package is now on CRAN. It contains the data from Sean Lahman's Baseball Database, http://www.seanlahman.com/baseball-archive/statistics/ as a collection of data frames covering nearly al

[R] [R-pkgs] statquotes package released to CRAN

2016-09-07 Thread Michael Friendly
## statquotes package released to CRAN The statquotes package v. 0.2 has recently been released to CRAN. In a spirit similar to fortunes and gaussfacts, the function `statquote()` displays a randomly chosen quotation from a data base consisting of quotes about topics related to statistics, data

[R] building R from source on gnu version >=5.4

2016-09-07 Thread Chinmay Borwankar
Hi, I want to integrate R with ROOTv6.06, which requires that, R be built with gcc compiler option "_GLIBCXX_USE_CXX11_ABI=0" . I am hoping that if I build R from source then there will be a way to do this. Is there ? Regards. -- Regards. Chinmay Borwankar [[alte

Re: [R] fPortfolio dont work in R 3.3.1

2016-09-07 Thread Bannert Matthias
Andre, you need to make sure you got a C/C++ compiler as well as a Fortran compiler to compile a package from source that makes use of these language. Many R packages use one of those languages under the hood to speed things up. gcc / gfortran are common and free choices for such compilers. D

Re: [R] Run an external software in R

2016-09-07 Thread Rainer M Krug
Bert Gunter writes: > ?system > > But this begs the question: WHY would you want to do this? More > specifically, what should R communicate to your other software, and > what should the other software communicate to R? I am not the OP, buty I can give you an answer why I did this (OK - I user rg

Re: [R] element wise pattern recognition and string substitution

2016-09-07 Thread Bert Gunter
Jeff: Not sure what you meant by this: "There is no other reason to put parentheses in the pattern... they are not grouping symbols." ... but in fact, from ?regexp "Repetition takes precedence over concatenation, which in turn takes precedence over alternation. A whole subexpression may be encl

[R] Using apply on a three dimensional matrix and passing multiple arguments to user defined function

2016-09-07 Thread Justin Peter
Dear R-user, I have a three-dimensional matrix of atmospheric data. The first two dimensions are spatial (lon and lat) and the third is time, such that dim(data) <- c(nlon,nlat,ntime) I wish to apply a land sea mask data which is a matrix of "0" and "1" if dim(nlon,nlat) dim(lsmask) <- c(nlon

Re: [R] element wise pattern recognition and string substitution

2016-09-07 Thread Ista Zahn
If you want to mach each element of 'strings' to a different regex, do it. Here are three ways, using your original example. pattern1 <- "([^.]*)\\.([^.]*\\.[^.]*)\\.(.*)" pattern2 <- "([^.]*)\\.([^.]*)\\.(.*)" patterns <- c(pattern1,pattern2) strings <- c('TX.WT.CUT.mean','mg.tx.cv') for(i in s

Re: [R] element wise pattern recognition and string substitution

2016-09-07 Thread Bert Gunter
Jun: 1. Tell us your desired result from your test vector and maybe someone will help. 2. As we played this game once already (you couldn't do it; I showed you how), this seems to be a function of your limitations with regular expressions. I'm probably not much better, but in any case, I don't in

[R] Resample with replacement to produce many rarefaction curves with same number of samples

2016-09-07 Thread Nick Pardikes
I am currently having difficulty producing a graph using rarecurve in the vegan package. I have produced rarefaction curves (seen below) using the following code. library(vegan) myMat <- round(matrix(rlnorm(2000), 50)) #creates distribution of communities netdata <- as.data.frame(myMat) #genera

Re: [R] how to transform db query result into a set of timeseries

2016-09-07 Thread Stef Mientki
Thanks Paul, I'm just a beginner with R, so I tried your simplest solution ( zonnen <- xts( cbind( ... ) and it seems to work fine. cheers, Stef On 06-Sep-16 22:12, Paul Gilbert wrote: There is a utility function TSquery() in package TSsql that attempts to do this. Most of the functions in t

[R] Resample with replacement to produce many rarefaction curves with same number of samples

2016-09-07 Thread Nick Pardikes
I am currently having difficulty producing a graph using rarecurve in the vegan package. I have produced rarefaction curves (seen below) using the following code. library(vegan) myMat <- round(matrix(rlnorm(2000), 50)) #creates distribution of communities netdata <- as.data.frame(myMat) #genera

Re: [R] Help with a code in R

2016-09-07 Thread Erika Rocío Espinosa Balbuena
Hi, Yes the objetcs have the same structure, and forecast_nal is the variable where I a trying to keep all the results of the forecast but I get the error that it is only allowed the replacement. 2016-09-06 1:31 GMT-05:00 PIKAL Petr : > Hi > > Well, it seems to me that it is coded in different l

[R] Resample with replacement to produce many rarefaction curves with same number of samples

2016-09-07 Thread Nick Pardikes
Greetings, I am currently having difficulty producing a graph using rarecurve in the vegan package. I have produced rarefaction curves (seen below) using the following code. library(vegan) myMat <- round(matrix(rlnorm(2000), 50)) #creates distribution of communities netdata <- as.data.frame(myM

[R] Pass an optional argument from Fortran subroutine to a R wrapper

2016-09-07 Thread Kodalore Vijayan, Vineetha W
Hello, I have a Fortran subroutine which uses an optional argument in the call. subroutine data (n,ns,alpha,covmat,x,y) integer, intent(in):: n,ns double precision, intent(in) :: alpha double precision, intent(in), optional ::covmat(n,ns) double precision, intent(out) :: x(n

Re: [R] how to transform db query result into a set of timeseries

2016-09-07 Thread Paul Gilbert
There is a utility function TSquery() in package TSsql that attempts to do this. Most of the functions in that package are for databases with a specific layout intended for storing time series, but TSquery() attempts to build a series from a somewhat arbitrary database. It is hard to be complet

Re: [R] Error while running Vegas function in cpvSNP package

2016-09-07 Thread caitlin mchugh via R-help
Hello, Please find attached a script where I tried to replicate the issue. I was unable to reproduce the error. Perhaps you can send me more details? Also, it appears the LD matrix you are using is not symmetric nor does it have 1's on the diagonal. Both of these things should be satisfied for th

Re: [R] Run an external software in R

2016-09-07 Thread David Remotti
I use the opposite approach ... run R from another software (usually a GUI developed in VB), using Rscript from dos command line. Maybe you can get the level of communication you need. David Remotti Il 07/09/2016 03:13, Marino David ha scritto: Hi all R users: Does anybody have the experien

Re: [R] element wise pattern recognition and string substitution

2016-09-07 Thread Jeff Newmiller
My error. However, Jun has been severely abusing them... such use is unusual, and the "(?:" non-capturing group marker was invented because the capture side effect is so central to the use of the regular parenthesis. On Tue, 6 Sep 2016, Bert Gunter wrote: Jeff: Not sure what you meant by this

Re: [R] element wise pattern recognition and string substitution

2016-09-07 Thread Jeff Newmiller
Here are some suggestions: test.string <- c( '240.m.g.>110.kg.geo.mean' , '3.mg.kg.>110.kg.P05' , '240.m.g.>50-70.kg.geo.mean' ) # based on your literal idea suggested.pattern1 <- "(240\\.m\\.g|3\\.mg\\.kg)\\.(>50-70\\.kg|>70-90\\.kg|>90-110\\.kg