[R] Uploading Google Spreadsheet data into R

2013-11-07 Thread Luca Meyer
Hello, I am trying to upload data I have on a Google Spreadsheet within R to perform some analysis. I regularly update such data and need to perform data analysis in the quickiest possible way - i.e. without need to publish the data, so I was wondering how to make work this piece of code (source h

Re: [R] deSolve, unresolved namespace error -- solved

2013-11-07 Thread Thomas Petzoldt
We have been able to reproduce the reported issue on another Linux system: Fedora 19, and the solution was quite simple: The deSolve package must always to be loaded *before* loading the shared library of the compiled model. Thomas __ R-help@r-project

Re: [R] Underdispersion and count data

2013-11-07 Thread Achim Zeileis
On Thu, 7 Nov 2013, sv.j...@yahoo.ca wrote: Hello, I have count data for 4 groups, 2 of which have a large number of zeroes and are overdispersed, and the other 2 underdispersed with no zeroes. Are you sure that it's really underdispersion in addition to the lack of zeros? It could also be

[R] help plotting two-dimensional ADMIXTURE data in R

2013-11-07 Thread Ella Bowles
Hello, I am trying to plot ADMIXTURE output in R. My output is two-dimensional (two columns, 190 rows). These rows represent individuals, and groups of them (e.g., 1-12) represent populations. What I'm hoping for is a plot with eleven different colours, basically like a STRUCTURE plot. #This code

[R] Underdispersion and count data

2013-11-07 Thread sv.j...@yahoo.ca
Hello, I have count data for 4 groups, 2 of which have a large number of zeroes and are overdispersed, and the other 2 underdispersed with no zeroes. I have two questions about model fitting, which I am quite new to, and have been using mostly the pscl package. 1 - How do I deal with underdisp

Re: [R] Finding absolute viewport location in grid / lattice

2013-11-07 Thread Paul Murrell
Hi Take a look at current.transform() (the grid.locator() function shows an example use) Paul On 11/06/13 13:35, James Price wrote: I'm trying to do some post-plot manipulation of some lattice graphics, in which I need to get the absolute viewport locations on the plotting device. So for exa

[R] Loglogistic 4-parameter model, fitting multiple curves specific estimates give NaNS, when fit alone all parameters estimated

2013-11-07 Thread Breanne Tidemann
Hello, I am fitting curves in drc to a Log-logistic 4-parameter model. My experiment is looking at fall and spring applications of a herbicide on wild oat at 5 different locations. A preliminary mixed model ANOVA showed that timing was significant. I am running a dose response curve for each app

Re: [R] Sorting Data Frames in R by multiple columns with a custom order

2013-11-07 Thread arun
If you already have the order stored in a list or so: For example: dat1 <- as.data.frame(mat,stringsAsFactors=FALSE) lst1 <- list(c("OF","ON"), c("US","UK", "WW","BO","BR","CA"), c("P2","P3","P1"),c("S2","S1","S3"))  dat1[] <- lapply(seq_along(lst1),function(i) factor(dat1[,i],levels=lst1[[i]]))

[R] Earth (MARS) package with categorical predictors

2013-11-07 Thread Chris Wilkinson
It appears to be legitimate to include multi-level categorical and continuous variables in defining the model for earth (e.g. y ~ cat + cont1 + cont2) but is it also then possible use categoricals in the predict method using the earth result? I tried but it returns an error which is not very inf

Re: [R] Sorting Data Frames in R by multiple columns with a custom order

2013-11-07 Thread arun
Hi, Not sure whether this helps: dat1 <- as.data.frame(mat,stringsAsFactors=FALSE) dat1$c4 <- factor(dat1$c4,levels=c("OF","ON"))  dat1$c1 <- factor(dat1$c1,levels=c("US","UK","WW","BO","BR","CA"))  dat1$c2 <- factor(dat1$c2, levels=c("P2","P3","P1"))  dat1$c3 <- factor(dat1$c3, levels=c("S2","S1"

Re: [R] Merging two dataframes with a condition involving variables of both dataframes

2013-11-07 Thread Collin Lynch
You might need to implement it as a nested pair of for loops using rbind. In essence iterate over the rows in df1 and each time find the matching row in df2. If none is found then add the df1 row by itself to the result. If one is then remove it from df2 and rbind both of them. Once done just me

Re: [R] Problems loading xlsx

2013-11-07 Thread David Winsemius
On Nov 7, 2013, at 12:55 PM, Barrett Gady wrote: > does anyone know how to resolve Error: .onLoad failed in loadNamespace() for > ‘xlsxjars’ > > I can’t seem to get this package to load on my windows 7 install of R3.02 It appears that you did not install all the depndencies for package xls

Re: [R] prod and F90 product

2013-11-07 Thread Duncan Murdoch
On 13-11-07 6:39 PM, Filippo wrote: Hi, I'm having strange differences between the R function prod ad the F90 function product. Processing the same vector C (see attachment). I get 2 different results: prod(C) = 1.069678e-307 testProduct(C) = 0 where testProd is the following wrapping function:

Re: [R] prod and F90 product

2013-11-07 Thread Bert Gunter
Fortune ! Bert Sent from my iPhone -- please excuse typos. > On Nov 7, 2013, at 3:48 PM, Rolf Turner wrote: > >> On 11/08/13 12:39, Filippo wrote: >> Hi, >> I'm having strange differences between the R function prod ad the F90 >> function product. >> Processing the same vector C (see attachme

[R] Merging two dataframes with a condition involving variables of both dataframes

2013-11-07 Thread Marc Marí Dell'Olmo
Dear all, I would like to merge two dataframes using two conditions. For example, if I have the dataframes df1 and df2: > (df1 <- data.frame(var1=c("a","b","d","e","g"), var2=c(25,14,53,26,84), infodf1=c(1,1,1,1,1))) var1 var2 infodf1 1a 25 1 2b 14 1 3d 53 1

Re: [R] prod and F90 product

2013-11-07 Thread Rolf Turner
On 11/08/13 12:39, Filippo wrote: Hi, I'm having strange differences between the R function prod ad the F90 function product. Processing the same vector C (see attachment). I get 2 different results: prod(C) = 1.069678e-307 testProduct(C) = 0 If you are worried about the difference between

[R] prod and F90 product

2013-11-07 Thread Filippo
Hi, I'm having strange differences between the R function prod ad the F90 function product. Processing the same vector C (see attachment). I get 2 different results: prod(C) = 1.069678e-307 testProduct(C) = 0 where testProd is the following wrapping function: testProd <- function(x) { retu

Re: [R] Error running MuMIn dredge function using glmer models

2013-11-07 Thread Ben Bolker
Martin Turcotte gmail.com> writes: > Dear list, > I am trying to use MuMIn to compare all possible mixed models > using the dredge function on binomial data but I > am getting an error message that I cannot decode. This error > only occurs when I use glmer. When I use an lmer > analysis on a d

[R] Problems loading xlsx

2013-11-07 Thread Barrett Gady
does anyone know how to resolve Error: .onLoad failed in loadNamespace() for ‘xlsxjars’ I can’t seem to get this package to load on my windows 7 install of R3.02 Sent from Windows Mail [[alternative HTML version deleted]] __ R-help

Re: [R] R newbie - loop questions

2013-11-07 Thread Karl Schelhammer
Yep, that solves the problem and is much cleaner than what I was trying to do. KWS On Nov 7, 2013, at 10:01 AM, arun wrote: > Hi, > > May be this is what you wanted: > mat1 <- matrix(1:4,2,2) > results.norm <- mat1/rowSums(mat1) > > A.K. > > > > > On Thursday, November 7, 2013 12:27 PM, K

Re: [R] Checking datetime value

2013-11-07 Thread arun
Hi, You can check the dataset for any patterns that are unique for the datetime values. For example: vec1 <-  c(as.character(Sys.time()), format(Sys.time(), "%a %b %d %X %Y %Z"),4324343,format(Sys.time(),"%m-%d-%Y %H:%M:%S"),"aZZCRDDS")  vec1[grepl(":",vec1)] #[1] "2013-11-07 15:04:27"

Re: [R] Nonnormal Residuals and GAMs

2013-11-07 Thread Simon Wood
If you use GCV smoothness selection then, in the Gaussian case, the key assumptions are constant variance and independence. As with linear modelling, the normality assumption only comes in when you want to find confidence intervals or p-values. (The GM Thm does not require normality btw. but I do

Re: [R] Same code - error in one PC but not in other

2013-11-07 Thread Carl Witthoft
In the absence of any description of the computers themselves, it's hard to say, but there's a good chance that there is some object in your working environment that's being accessed by your function -- and that object exists on only one of the machines. I would suggest you use debug() or browser

Re: [R] strange behaviour when subsetting a data.frame

2013-11-07 Thread Simon Hayward
So is there a way to make the subsetting behave as expected? -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of Doran, Harold Sent: 07 November 2013 16:52 To: 'Eckstädt, Elisabeth'; r-help@R-project.org Subject: Re: [R] strange behav

[R] Error running MuMIn dredge function using glmer models

2013-11-07 Thread Martin Turcotte
Dear list, I am trying to use MuMIn to compare all possible mixed models using the dredge function on binomial data but I am getting an error message that I cannot decode. This error only occurs when I use glmer. When I use an lmer analysis on a different response variable every works great.

Re: [R] all combinations with replacement not ordered

2013-11-07 Thread Bert Gunter
... and actually, since u can be assumed to be of the form shown, v <-do.call(expand.grid, split(rep(u,len),rep(u,e=len))) should do. -- Bert On Thu, Nov 7, 2013 at 10:06 AM, Bert Gunter wrote: > Well, you can create the expand.grid data frame programmatically via: > > u <- 1:3 > len <- lengt

Re: [R] AER ivreg diagnostics: question on DF of Sargan test

2013-11-07 Thread Achim Zeileis
Hélène, thanks for spotting this! This is a bug in "AER". I had just tested the new diagnostics for regressions with 1 endogenous variable and hence never noticed the problem. But if there are > 1 endogenous variables, the df used in ivreg() (and hence the associated p-values) are too large.

Re: [R] all combinations with replacement not ordered

2013-11-07 Thread Bert Gunter
Well, you can create the expand.grid data frame programmatically via: u <- 1:3 len <- length(u) v <-do.call(expand.grid, split(rep(u,len),rep(seq_len(len),e=len))) And then you can use unique.array to get the unique rows after the sort: unique(t(apply(v,1,sort))) However, I agree with your sent

Re: [R] variable standardization in manova() call

2013-11-07 Thread Sergio Fonda
2013/11/6 Michael Friendly : > On 11/4/2013 10:45 AM, Sergio Fonda wrote: >> >> Hi, >> I'm not able to get information about the following question: >> >> is the variables standardization a default option in manova() (stats >> package)? >> Or if you want to compare variables with different units or

Re: [R] Adding the complementary log-link to binomial() and make.link()

2013-11-07 Thread Ben Bolker
Ken Knoblauch inserm.fr> writes: > > Roland Deutsch tuwien.ac.at> writes: > > in my research I frequently work with binomial > response models, which > > are of course part of the generalized linear > models. While I do use > > common link functions such as the logit, probit > and cloglog,

Re: [R] all combinations with replacement not ordered

2013-11-07 Thread Ted Harding
On 07-Nov-2013 13:38:29 Konstantin Tretiakov wrote: > Hello! > > I need to obtain all possible combinations with replacement when > order is not important. > E.g. I have a population x{1,2,3}. > So I can get (choose(3+3-1,3)=) 10 combinations from this population > with 'size=3'. > How can I get a

Re: [R] strange behaviour when subsetting a data.frame

2013-11-07 Thread Doran, Harold
Yes, what I would do is write a function around the all.equal() comparisons on the data to see which values are "nearly" identical to the ones desired I the subset. If TRUE, I would retain those values and discard the others. -Original Message- From: Simon Hayward [mailto:simon.hayw...@

Re: [R] strange behaviour when subsetting a data.frame

2013-11-07 Thread Doran, Harold
Yes, but notice that man2[3,] == .3 [1] FALSE This is because of issues of machine precision when dealing with floating points, not a problem in R. Comparisons for nearly equivalent numbers are done using all.equal() as shown below. > all.equal(man2[3,], .3) [1] TRUE -Original Message

Re: [R] all combinations with replacement not ordered

2013-11-07 Thread William Dunlap
Is this what you want? f <- function (x, m) combn(x + m - 1, m) - seq_len(m) + 1 Bill Dunlap Spotfire, TIBCO Software wdunlap tibco.com > -Original Message- > From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On > Behalf > Of Konstantin Tretiakov > Sent: Thurs

[R] Same code - error in one PC but not in other

2013-11-07 Thread Juan Antonio Balbuena
Hello I am running exactly the same code on two different computers. In PC1 of the the code is working fine, whereas in PC2 I get this error Error in HP.LUT[, 1] : incorrect number of dimensions HP.LUT is an object within a function computed as HP.LUT <- which(HP ==1, arr.in=TRUE

Re: [R] Adding the complementary log-link to binomial() and make.link()

2013-11-07 Thread Ken Knoblauch
Roland Deutsch tuwien.ac.at> writes: > in my research I frequently work with binomial response models, which > are of course part of the generalized linear models. While I do use > common link functions such as the logit, probit and cloglog, I often > have the need of invoking the lesser-kno

Re: [R] reading in stata file with read.dta works in R x64 3.0.1 and crashes R x64 3.0.2

2013-11-07 Thread Anthony Damico
sorry i missed that. install.packages('foreign') solved the problem, thank you!! :) On Thu, Nov 7, 2013 at 10:41 AM, Prof Brian Ripley wrote: > See the posting guide: your version of 'foreign' is not current: > http://cran.r-project.org/web/packages/foreign/index.html . > > Please update yo

Re: [R] reading in stata file with read.dta works in R x64 3.0.1 and crashes R x64 3.0.2

2013-11-07 Thread Prof Brian Ripley
See the posting guide: your version of 'foreign' is not current: http://cran.r-project.org/web/packages/foreign/index.html . Please update your packages and try again. (This looks very like a bug in recently contributed code that has already been fixed.) On 07/11/2013 13:40, Anthony Damico w

Re: [R] strange behaviour when subsetting a data.frame

2013-11-07 Thread Sarah Goslee
R FAQ 7.31. http://cran.r-project.org/doc/FAQ/R-FAQ.html#Why-doesn_0027t-R-think-these-numbers-are-equal_003f On Thu, Nov 7, 2013 at 8:36 AM, Eckstädt, Elisabeth wrote: > Hello everyone, > I am experiencing a unfathomable benaviour of "subset" on a data.frame. This > is a minimal reproducable e

[R] Checking datetime value

2013-11-07 Thread vikrant
Hi , I would like to check if a column contains datetime values. (column may contain any datetime format or just numbers or string). Request your help -- View this message in context: http://r.789695.n4.nabble.com/Checking-datetime-value-tp4679963.html Sent from the R help mailing list archiv

[R] strange behaviour when subsetting a data.frame

2013-11-07 Thread Eckstädt , Elisabeth
Hello everyone, I am experiencing a unfathomable benaviour of "subset" on a data.frame. This is a minimal reproducable example. The data.frame cosists only of one column, which contains 10 ascending values (from 0.1 to 1). Subsetting for 0.1 is working (gives me one row), subsetting for 0.3 give

[R] all combinations with replacement not ordered

2013-11-07 Thread Konstantin Tretiakov
Hello! I need to obtain all possible combinations with replacement when order is not important. E.g. I have a population x{1,2,3}. So I can get (choose(3+3-1,3)=) 10 combinations from this population with 'size=3'. How can I get a list of all that combinations? I have tried 'expand.grid()' and ma

[R] AER ivreg diagnostics: question on DF of Sargan test

2013-11-07 Thread Hélène Huber-Yahi
Hello, I'm new to R and I'm currently learning to use package AER, which is extremely comprehensive and useful. I have one question related to the diagnostics after ivreg: if I understood well, the Sargan test provided states that the statistic should follow a Chi squared of degrees of freedom equa

[R] Adding the complementary log-link to binomial() and make.link()

2013-11-07 Thread Roland Deutsch
Dear R Help, in my research I frequently work with binomial response models, which are of course part of the generalized linear models. While I do use common link functions such as the logit, probit and cloglog, I often have the need of invoking the lesser-known Complementary Log link (Walter

[R] loop for backtesting

2013-11-07 Thread wintwin111
First of all sorry for my bad english but its not my native language. I am working on a paper on Portfolio Optimization with Markowitz and Lower Partial Moments. I want to compare the returns of the minimum variance portfolios from booth methods. First of all i have an in-sample multivariate tim

Re: [R] FW: Nadaraya-Watson kernel

2013-11-07 Thread Liaw, Andy
Use KernSmooth (one of the recommended packages that are included in R distribution). E.g., > library(KernSmooth) KernSmooth 2.23 loaded Copyright M. P. Wand 1997-2009 > x <- seq(0, 1, length=201) > y <- 4 * cos(2*pi*x) + rnorm(x) > f <- locpoly(x, y, degree=0, kernel="epan", bandwidth=.1) > plo

Re: [R] problem with interaction in lmer even after creating an "interaction variable"

2013-11-07 Thread Ben Bolker
a_lampei uni-tuebingen.de> writes: > > Dear all, > I have a problem with interactions in lmer. I have 2 factors (garden and > gebiet) which interact, plus one other variable (home), > dataframe arr. When > I put: > / > lmer (biomass ~ home + garden:gebiet + ( 1|Block), data = arr)/ > > it wri

[R] reading in stata file with read.dta works in R x64 3.0.1 and crashes R x64 3.0.2

2013-11-07 Thread Anthony Damico
this file http://www.electionstudies.org/studypages/data/anes_mergedfile_1992to1997/anes_mergedfile_1992to1997_dta.zip can be downloaded after free registration on this page http://electionstudies.org/studypages/download/registration_form.php imports properly in windows R x64 3.0.1 but ca

Re: [R] Multiple String word replacements: Performance Issue

2013-11-07 Thread jim holtman
Here is a start. I was wondering how long it would take to at least substitute 800 different patterns into 4M vectors. Here is my test. It took longer (99 sec) to create the test data than to do the substitutes (52 secs). Now some variations on this can provide the other information that you are

Re: [R] Fitting multiple horizontal lines to data

2013-11-07 Thread Carl Witthoft
You already asked this on StackOverflow. The answer remains the same, pretty much what David W. wrote: this is not a question about fitting lines to data. You need to step back and think about what message you want to deliver to those who will view your graph, and what the meaning of your data

[R] problem with interaction in lmer even after creating an "interaction variable"

2013-11-07 Thread a_lampei
Dear all, I have a problem with interactions in lmer. I have 2 factors (garden and gebiet) which interact, plus one other variable (home), dataframe arr. When I put: / lmer (biomass ~ home + garden:gebiet + ( 1|Block), data = arr)/ it writes: /Error in lme4::lFormula(formula = biomass ~ home + ga

[R] R: resdiuals of random model estimated by plm function

2013-11-07 Thread Millo Giovanni
Dear Alfonso, in a RE model you do not explicitly estimate every single individual effect, but only the variance of the distribution they have been "drawn from". Hence the only (pointwise) residual you can estimate ex-post is the composite one: i.e., the sum. Best, Giovanni Giovanni Millo, P