[R] Quantmod - modify decimal places

2016-05-23 Thread David Menezes
Hi Apologies if this has already been asked and answered or if I've labelled the subject incorrectly but I can't find a solution using the search function for this group; the vignette documentation for quantmod or general google searches. I'm attempting to use quantmod to download foreign

Re: [R] heat color on age visible on ordination

2016-05-23 Thread Jim Lemon
Hi Jackson, I'll take a wild guess at "What is wrong?". You only got one end of the color vector, probably the purple end. As my recollection of principal components analysis is of a data reduction method, you probably have a lot fewer than 500 points on your plot. If you only have, say, 50 values

Re: [R] heat color on age visible on ordination

2016-05-23 Thread Jim Lemon
Hi Jackson, One way to assign colors to values is: library(plotrix) ages<-seq(1, 5, by = 100) agecol<-color.scale(ages,extremes=c("purple","red")) Then just use "agecol" for your point colors. Jim On Tue, May 24, 2016 at 11:57 AM, Jackson Rodrigues wrote: >

[R] heat color on age visible on ordination

2016-05-23 Thread Jackson Rodrigues
Hi everybody, I have a big matrix spread over a long time period. I would like to make a ordination plot (PCA, CA, DCA etc) of this matrix and look for patterns on time by exploring a color scheme (I have heat color in mind). The idea is to use a progressive color scheme ranging from red (the

Re: [R] Replicating the SPlus "twoway" function

2016-05-23 Thread Richard M. Heiberger
In the stats package ?medpolish On Mon, May 23, 2016 at 5:37 PM, Taylor, Z Todd wrote: > Is there a package somewhere that replicates the SPlus twoway() function? > That function models a 2-d data matrix, which may contain NAs, as > > x[i,j] = grand.effect +

[R] Replicating the SPlus "twoway" function

2016-05-23 Thread Taylor, Z Todd
Is there a package somewhere that replicates the SPlus twoway() function? That function models a 2-d data matrix, which may contain NAs, as x[i,j] = grand.effect + row.effect[i] + col.effect[j] + resid[i,j] I'm sort of resurrecting some ancient S code and it would be handy if a twoway()

[R] Defining contrasts within function

2016-05-23 Thread Axel Urbiz
Dear All, I'd like to change the options("contrasts") within a function, such that "identity" contrasts are created for unordered factors. I'm following the idea shown below, which works fine. However, when I include these functions in a package (with `contr` being exported, but `contr_identity`

Re: [R] need help to convert animal ID to a factor

2016-05-23 Thread Neny Sitorus
Thanks for your advise. Just wondering, since I have to analyse my data with "Mixed model analysis in R" and I'm not familiar at all with this software, just try to use it within a week and need to write my analysis result as soon as I can, could you please advise me of what does mixed model

Re: [R] WARNING: Method convertPointFromBase

2016-05-23 Thread peter dalgaard
> On 23 May 2016, at 23:51 , Jeff Newmiller wrote: > > This is almost certainly a message from a contributed package, not from R > itself. Please figure out which package you are using and read the > documentation for that package. Nope, it comes from OSX. AFAIR,

Re: [R] WARNING: Method convertPointFromBase

2016-05-23 Thread Jeff Newmiller
This is almost certainly a message from a contributed package, not from R itself. Please figure out which package you are using and read the documentation for that package. -- Sent from my phone. Please excuse my brevity. On May 23, 2016 1:37:22 PM PDT, Fabian Schalle

[R] WARNING: Method convertPointFromBase

2016-05-23 Thread Fabian Schalle
Hello, I’ve noticed a Warning, while working with both the R console and a document window in R: 2016-05-23 22:16:17.507 R[2985:466607] *** WARNING: Method convertPointFromBase: in class NSView is deprecated on 10.7 and later. It should not be used in new applications. I have Version R 3.3.0

Re: [R] print all variables inside function

2016-05-23 Thread William Dunlap via R-help
If you really want to return all the objects in a function, I think it is better to return as.list(environment()), perhaps adding the all.names=TRUE argument to capture names starting with a dot. I only have done this while debugging a function and then I find it is more convenient to return just

Re: [R] Can I use PhantomJS or assume a firefox instalattion for usage with RSelenium in CRAN Machines?

2016-05-23 Thread Marcelo Perlin
Thanks David, I figured out a way to get the data I want without RSelenium. Apreciate the help, though. Best, On Thu, May 19, 2016 at 8:51 PM, David Winsemius wrote: > > > On May 19, 2016, at 7:49 AM, Marcelo Perlin > wrote: > > > > Hi

Re: [R] print all variables inside function

2016-05-23 Thread Thierry Onkelinx
Dear Jan, This will return a list with all objects from within the function. test <- function(){ a <- 10 b <- 3 * a + 1 x <- -1 output <- paste(objects(), objects(), sep = "=") output <- paste(output, collapse = ",") output <- paste("list(", output, ")") return(eval(parse(text =

Re: [R] print all variables inside function

2016-05-23 Thread Duncan Murdoch
On 23/05/2016 3:26 PM, Jan Kacaba wrote: Hello dear R-help I would like to use some short and simple names multiple times inside one script without collisions. I need to wrap the variables inside some object. I know I can use class function or environment. For example as follows:

Re: [R] Filtering String Variables

2016-05-23 Thread Adams, Jean
George, You are very close. Try this ... # make Debitor a character variable in the data frame ds_example$Debitor <- as.character(ds_example$Debitor) duplicates <- duplicated(ds_example$Debitor) duplicated_debitors <- unique(ds_example$Debitor[duplicates]) ds_duplicates <-

[R] print all variables inside function

2016-05-23 Thread Jan Kacaba
Hello dear R-help I would like to use some short and simple names multiple times inside one script without collisions. I need to wrap the variables inside some object. I know I can use class function or environment. For example as follows: exmp1<-function(){ # knowns pa=0.35 pb=0.35

Re: [R-es] Ayuda con Subset

2016-05-23 Thread Carlos J. Gil Bellosta
Hola, ¿qué tal? Dos consejos. El primero, que no uses subset . Usa corchetes directamente. El segundo, que utilices el operador %in%: T[Tv2 %in% c(2,3),] Un saludo, Carlos J. Gil Bellosta http://www.datanalytics.com

[R-es] Ayuda con Subset

2016-05-23 Thread Rafael Saturno
Hola Comunidad, tengo este problema con una data La data es bastante grande, y necesito filtrarla por un campo en especifico segun lo que me interesa,con Subset puedo filtrar de la siguiente manera T <- rbind(data.frame(v1=rep("x",5),v2=sample(1:5)),data.frame(v1=rep("y",5),v2=sample(1:5))) ###

Re: [R] Merging 2 files with different timestamp

2016-05-23 Thread Jeff Newmiller
You have by now seen some other responses on the list. Keeping the list included will insure you continue to get mulitple eyes looking at the problem and will benefit others trying to use the answers. Two comments: 1) Your first format includes a specification for seconds. If that is nonzero

Re: [R] Choosing rows

2016-05-23 Thread oslo via R-help
Hi Rui; Thanks so much for this. It works perfectly. Regards,Oslo On Sunday, May 22, 2016 7:35 AM, "ruipbarra...@sapo.pt" wrote: Hello, First of all, it's better to post data using ?dput. Below, I give an example of that  in the lines structure(...). dat <-

[R] Linear Regressions with non-negativity constraint

2016-05-23 Thread Ravi Varadhan
Hi, Take a look at the package "ic.infer" by Ulrike Gromping. https://www.jstatsoft.org/article/view/v033i10 Best, Ravi Ravi Varadhan, Ph.D. (Biostatistics), Ph.D. (Environmental Engg) Associate Professor, Department of Oncology Division of Biostatistics & Bionformatics Sidney Kimmel

Re: [R] Vectors, Loops, Rnorm and KS-Testing

2016-05-23 Thread Dylan Keenan
Use 'replicate.' > replicate(n1, mean(rnorm(n2, mean, sd))) Will compute return a column vector of length n1, each entry of which is the mean of n2 random normal variables with mean and sd specified by the arguments of rnorm. On Mon, May 23, 2016 at 10:25 AM Nicoletta Sabov

Re: [R] promoting scalar arguments to vectors in a function

2016-05-23 Thread Marc Schwartz
On May 23, 2016, at 10:59 AM, jlu...@ria.buffalo.edu wrote: > > R users: > > Suppose I have a function that takes three numeric arguments x, y, and z, > any of which may be scalars or vectors. > Suppose further that the user takes one of the arguments, say y, as a > vector with the other two

Re: [R] promoting scalar arguments to vectors in a function

2016-05-23 Thread Jeff Newmiller
Scalar values in R are just vectors of length 1. The "promotion" you are thinking of is "recycling" that automatically occurs when vectors of different lengths are supplied to certain operations. One shortcut might be to put them all into a data frame using the data.frame() function.

Re: [R] promoting scalar arguments to vectors in a function

2016-05-23 Thread S Ellison
> -Original Message- > From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of > Suppose I have a function that takes three numeric arguments x, y, and z, any > of which may be scalars or vectors. > Suppose further that the user takes one of the arguments, say y, as a vector >

[R] promoting scalar arguments to vectors in a function

2016-05-23 Thread JLucke
R users: Suppose I have a function that takes three numeric arguments x, y, and z, any of which may be scalars or vectors. Suppose further that the user takes one of the arguments, say y, as a vector with the other two as scalars. Is there an existing R function that will promote the other

Re: [R] Programming Assignment 1: Quiz Air Pollution (Week 2: Programming with R)

2016-05-23 Thread S Ellison
You are probably using the wrong forum for this question and would save time by posting elsewhere rather than waiting for a reply here. The stock answer to this type of request on R-help is 'Please read the Posting Guide (https://www.r-project.org/posting-guide.html) with special attention to

Re: [R] meaning of lm( y~., data=mydat ), is it a language feature, is it documented, is it supported?

2016-05-23 Thread peter dalgaard
> On 23 May 2016, at 13:43 , Ivan Calandra wrote: > > Hi John, > > This is indeed documented, but you'll have to look at the function formula(): > ?formula > > Regarding the dot (.), here is the explanation from the help of formula(): > "There are two special

Re: [R] Vectors, Loops, Rnorm and KS-Testing

2016-05-23 Thread Ivan Calandra
Hi Nicoletta, You need to read more introductory material. One of the problems with your code is that you actually don't create any value, let alone any vector; you just display it with cat(). Then you try to create each value of your vector with an explicit for loop, but you don't need to;

[R] Ensembles for multi-class predictions

2016-05-23 Thread Jason Hendrix
I have trained two models using the caret library for R and would like to combine the two multi-class trained models into one ensemble. My first thought was to use caretEnsemble, but it does not yet support multi-class predictions. See https://github.com/zachmayer/caretEnsemble/issues/8 Is there

[R] Programming Assignment 1: Quiz Air Pollution (Week 2: Programming with R)

2016-05-23 Thread kashyap vora
Hello R-Programming Experts, I needed a help here in completing this *"Programming Assignment 1: Quiz on Air Pollution" (under Week 2: Programming with R / Course 2: R Programming)* that i am stuck on. I tried all possible variations in debugging my

Re: [R] Unexpected values obtained when reading in data using ncdf and ncdf4

2016-05-23 Thread Louise Mair
Hi Dave, Roy and R-users, Many thanks for your suggestions - in later correspondence Dave suggested that I ask the data provider to run a md5 checksum on the problem files, and compare their results against a md5 checksum on my copies of the files. Having done this, I found that the results

[R] Vectors, Loops, Rnorm and KS-Testing

2016-05-23 Thread Nicoletta Sabov
Hi there, I need a function, that calculates the mean of a desired amount of normally distributed numbers and repeats this process for a desired number of repetitions. The function should return only a single vector consisting solely of the calculated means. Also the user of this function must

Re: [R] WG: Filtering String Variables (SOLVED)

2016-05-23 Thread Jeff Newmiller
Perhaps ds_example <- ds_example[ with( ds_example, 1 < ave( Debitor, Debitor, FUN=length ) ), ] -- Sent from my phone. Please excuse my brevity. On May 23, 2016 6:57:04 AM PDT, g.maub...@weinwolf.de wrote: >Hi All, > >the solution for my question is as follows > >## Filter duplicates and

[R] WG: Filtering String Variables (SOLVED)

2016-05-23 Thread G . Maubach
Hi All, the solution for my question is as follows ## Filter duplicates and correpsonding non-duplicates ### To filter duplicates and their corresponding non-duplicates use the ### following code snippet: Debitor <- c("968691", "968691", "968691", "A04046", "A04046",

Re: [R] mgcv::gam(): NA parametric coefficient in a model with two categorical variables + model interpretation

2016-05-23 Thread Simon Wood
Q1: It looks like the model is not fully identifiably given the data and as a result igcCAT.ideo has been set to zero - there is no sensible test to conduct with such a term, hence the NAs in the test stat an p-value fields. Q2: A separate (centred) smooth is estimated for each level of igc.

[R] Filtering String Variables

2016-05-23 Thread G . Maubach
# Hi All, # # I have the following data frame (example): Debitor <- c("968691", "968691", "968691", "A04046", "A04046", "L0006", "L0006", "L0006", "L0023", "L0023", "L0056", "L0056", "L0094", "L0094", "L0094", "L0124",

Re: [R-es] Problemas con For

2016-05-23 Thread Javier Marcuzzi
Estimado Jesús Gracias por avisar, es bueno saber que el problema esté solucionado, por lo menos eso pensamos, no parece muy complicado, salvo que una función que se ejecuta dentro del bucle tenga un error en algún caso. Javier Rubén Marcuzzi De: Jesús Para Fernández Enviado: lunes, 23 de

Re: [R-es] Problemas con For

2016-05-23 Thread Jesús Para Fernández
Buenas Javier, Por lo que me coment� por correo privado, creo que ya lo solucion� con los ifelse encadenados... Un saludo Jes�s > To: rafael_satu...@hotmail.com; r-help-es@r-project.org > From: javier.ruben.marcu...@gmail.com > Date: Mon, 23 May 2016 09:02:37 -0300 > Subject: Re: [R-es]

Re: [R-es] Problemas con For

2016-05-23 Thread Javier Marcuzzi
Estimado Rafael Sturno ¿Puede preparar un ejemplo que sea reproducible en otra computadora? Con algunos datos en un data.frame, y el código comentado, que podamos ejecutar, sería una gran ayuda para entender el problema y poder solucionarlo. En la forma que usted lo expresa pueda haber

Re: [R] meaning of lm( y~., data=mydat ), is it a language feature, is it documented, is it supported?

2016-05-23 Thread Bert Gunter
It's about formula syntax, so ?formula documents it. Bert On Monday, May 23, 2016, John Sorkin wrote: > > The syntax > mydat <- data.frame( y,x ) > fit1 <- lm( y~., data=mydat ) > appears to perform a multivariable regression of y on every non-y variable > in the

Re: [R] meaning of lm( y~., data=mydat ), is it a language feature, is it documented, is it supported?

2016-05-23 Thread Kenneth Knoblauch
John Sorkin grecc.umaryland.edu> writes: > The syntax > mydat <- data.frame( y,x ) > fit1 <- lm( y~., data=mydat ) > appears to perform a multivariable regression of y on every non-y variable in the data frame mydat. I can not > find this syntax (y~.) in R documentation. Is y~. a supported

Re: [R] meaning of lm( y~., data=mydat ), is it a language feature, is it documented, is it supported?

2016-05-23 Thread Duncan Murdoch
On 23/05/2016 7:26 AM, John Sorkin wrote: The syntax mydat <- data.frame( y,x ) fit1 <- lm( y~., data=mydat ) appears to perform a multivariable regression of y on every non-y variable in the data frame mydat. I can not find this syntax (y~.) in R documentation. Is y~. a supported feature of

Re: [R] meaning of lm( y~., data=mydat ), is it a language feature, is it documented, is it supported?

2016-05-23 Thread Ivan Calandra
Hi John, This is indeed documented, but you'll have to look at the function formula(): ?formula Regarding the dot (.), here is the explanation from the help of formula(): "There are two special interpretations of . in a formula. The usual one is in the context of a data argument of model

[R] meaning of lm( y~., data=mydat ), is it a language feature, is it documented, is it supported?

2016-05-23 Thread John Sorkin
The syntax mydat <- data.frame( y,x ) fit1 <- lm( y~., data=mydat ) appears to perform a multivariable regression of y on every non-y variable in the data frame mydat. I can not find this syntax (y~.) in R documentation. Is y~. a supported feature of the R language? Where can I find it

Re: [R-es] Problemas con For

2016-05-23 Thread Jesús Para Fernández
Necesitas un bucle for? es decir, solo con hacer dos ifelse encdenados no te valdria?? Por la velocidad de computaci�n... > From: rafael_satu...@hotmail.com > To: r-help-es@r-project.org > Date: Sun, 22 May 2016 19:39:56 -0400 > Subject: [R-es] Problemas con For > > Hola comunidad XD, necesito

Re: [R] if else condition - help

2016-05-23 Thread Martin Maechler
> jim holtman > on Sun, 22 May 2016 16:47:06 -0400 writes: > if you want to use 'ifelse', here is a way: hmm, why should he want that ? The OP did mention that it's about somewhat large objects, so efficiency is one of the considerations : ifelse() is often

Re: [R] Element-by-element operation (adding)

2016-05-23 Thread peter dalgaard
> On 23 May 2016, at 07:44 , Peter Langfelder > wrote: > > or > > t(apply(v, 1, `+`, b)) Or, as you're messing with transposes anyways, use the fact that the column-wise counterpart is automagically handled by recycling: t(t(v)+b) Or, look Ma, no transposes v

[R] Linear Regressions with non-negativity constraint

2016-05-23 Thread Aleksandrovic, Aljosa (Pfaeffikon)
Hi all, I hope you are doing well? I'm currently using lm() to estimate a linear multi-factor (5 factors without intercept) model as follows ... factor.lm <- lm(y~x1+x2+x3+x4+x5-1, data = data.frame.rbind) Using nnls(A,b) I estimated the same model, extended by a non-negativity constraint on

Re: [R] need help to convert animal ID to a factor

2016-05-23 Thread Jeff Newmiller
I am not familiar with any function called "toFactor". It may be part of some contributed package that you need to re-load. However, one does not ordinarily need to use a package to convert one column of a data frame into a factor, since factors are supported by base R. Eg MyDF$ID <- factor(

Re: [R] need help to convert animal ID to a factor

2016-05-23 Thread David Winsemius
> On May 22, 2016, at 9:46 PM, Neny Sitorus wrote: > > Hi, > > I was trying to convert my animal ID experiment (ID) to factor to get the > ggboxplot, previously it was working well. > But since yesterday it displayed "Error" every time I tried to re-run it. > Could

[R] need help to convert animal ID to a factor

2016-05-23 Thread Neny Sitorus
Hi, I was trying to convert my animal ID experiment (ID) to factor to get the ggboxplot, previously it was working well. But since yesterday it displayed "Error" every time I tried to re-run it. Could you help me in this issue? # convert rat ID to factor Leak.df <- toFactor(Leak.df,