[R] Extract data from Array to Table

2015-02-11 Thread Karim Mezhoud
Dear All, I am facing the task to extract data from array to table. here an example of array. ##Get A list of Matrices with unequal rows Disease - NULL Diseases - NULL ListMatByGene - NULL for(i in 1:3){ Disease[[i]] -matrix(sample(-30:30,25+(5* i)),5+i) rownames(Disease[[i]]) -

Re: [R] How to solve this complex equation

2015-02-11 Thread Chel Hee Lee
A~ha~!! Thank you, Prof. Peter Dalgaard, so much for your wonderful lesson!!! Learning new things everyday from this R-help mailing list! Chel Hee Lee On 2/11/2015 10:37 AM, peter dalgaard wrote: On 11 Feb 2015, at 17:11 , Chel Hee Lee chl...@mail.usask.ca wrote: The functional form

[R] A portfolio return function?

2015-02-11 Thread Ernest Stokely
For finance applications, I'm surprised that I am unable to find a function to compute the portfolio return (sqrt(t(w) %*% V %*% w)) where w are portfolio weights and V is the cov(returns). The Performance Analytics portfolio return function seems to compute something else. Ernie

Re: [R] plotting this data

2015-02-11 Thread JS Huang
Hi, Here is an implementation. The image is uploaded as Rplot02.png. gen - read.table(geno.txt,header=TRUE) gen Genotype E1 E2E3 E4 E5 E6 E7 E8 E9 E10 E11 E12 E13 E14 E15 E16 E17 E18 1 G1 0.79 2.11 6.21 0.56 4.06 2.13 5.61 0.20 3.32 3.01 5.12 0.77 0.78

[R] Download internet videos

2015-02-11 Thread Raoni Rodrigues
Hello R-helpers, It is possible donwload youtube videos with R? I made a google search and find no options to do that. Thanks in advanced, Raoni [[alternative HTML version deleted]] __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and

Re: [R] How to solve this complex equation

2015-02-11 Thread peter dalgaard
On 11 Feb 2015, at 17:11 , Chel Hee Lee chl...@mail.usask.ca wrote: The functional form given in the post written by Ssuhanchen captures my eyes. It is the cumulative distribution function of Poisson when the number of counts is less than or equal to 2 with unknown parameter mu=x/2.

Re: [R] How to solve this complex equation

2015-02-11 Thread Chel Hee Lee
The functional form given in the post written by Ssuhanchen captures my eyes. It is the cumulative distribution function of Poisson when the number of counts is less than or equal to 2 with unknown parameter mu=x/2. Since it is a nonlinear function, there may be multiple solutions but the

Re: [R] Download internet videos

2015-02-11 Thread Jeff Newmiller
The set of things that R can do is not a subset of the set of things packages may have been written for. Have at it. --- Jeff NewmillerThe . . Go Live...

[R] prediction intervals for robust regression

2015-02-11 Thread Burns, Jonathan (NONUS)
I have created robust regression models using least trimmed squares and MM-regression (using the R package robustbase). I am now looking to create prediction intervals for the predicted results. While I have seen some discussion in the literature about confidence intervals on the estimates

Re: [R] prediction intervals for robust regression

2015-02-11 Thread Bert Gunter
Presumably you've checked out: http://cran.r-project.org/web/views/Robust.html If you can estimate the variance of parameter estimates, betahat, then you can estimate the variance of a predicted value, X betahat; add the estimated variance of individuals to this if that's what you're looking for

Re: [R] Package build help

2015-02-11 Thread Hadley Wickham
On Sun, Feb 8, 2015 at 5:15 PM, Duncan Murdoch murdoch.dun...@gmail.com wrote: On 08/02/2015 4:06 PM, Glenn Schultz wrote: Hello All, I am in the final stages of building my first package BondLab and the check throughs the following warning. I think this is namespace thing. I have not

Re: [R] sqldf() difference between R 3.1.2 and 3.0.1

2015-02-11 Thread Doran, Harold
That seems to have worked, both in the new and old version of R. I'll do more unit testing on other files. Thank you, Gabor. -Original Message- From: Gabor Grothendieck [mailto:ggrothendi...@gmail.com] Sent: Wednesday, February 11, 2015 10:22 AM To: Doran, Harold Cc:

Re: [R] sqldf() difference between R 3.1.2 and 3.0.1

2015-02-11 Thread Gabor Grothendieck
On Wed, Feb 11, 2015 at 9:45 AM, Doran, Harold hdo...@air.org wrote: I have a function written and tested using R 3.0.1 and sqldf_0.4-7.1 that works perfectly. However, using this same code with R 3.1.2 and sqldf_0.4-10 yields the error below that I am having a difficult time deciphering.

Re: [R] Rotate array by 90°

2015-02-11 Thread Karim Mezhoud
Thanks Lee and Huang. That is useful. Best On Fri, Feb 6, 2015 at 1:53 AM, Chel Hee Lee chl...@mail.usask.ca wrote: lapply(1:2, function(x) t(A[rev(1:3),,x])) [[1]] [,1] [,2] [,3] [1,] g d a [2,] h e b [3,] i f c [[2]] [,1] [,2] [,3] [1,] p m j [2,] q n k [3,]

Re: [R] factor levels numeric values

2015-02-11 Thread JS Huang
Hi, Suppose your data frame is called data and the name of the factor column is named tobeConverted. I have tried this and it worked. Hope this helps. as.numeric(as.character(data$tobeConverted)) -- View this message in context:

Re: [R] library(Rcmdr) sh: otool: command not found

2015-02-11 Thread varin sacha
Dear John, Dear Dan, Many thanks for your response. It works perfectly. Best, - Mail original - De : John Fox j...@mcmaster.ca À : 'varin sacha' varinsa...@yahoo.fr Cc : 'r-help@R-project.org' r-help@r-project.org Envoyé le : Mercredi 11 février 2015 3h12 Objet : RE: [R] library(Rcmdr)

[R] sqldf() difference between R 3.1.2 and 3.0.1

2015-02-11 Thread Doran, Harold
I have a function written and tested using R 3.0.1 and sqldf_0.4-7.1 that works perfectly. However, using this same code with R 3.1.2 and sqldf_0.4-10 yields the error below that I am having a difficult time deciphering. Hence, same code behaves differently on different versions of R and

Re: [R] MApply and SubStr

2015-02-11 Thread Brian Trautman
That's exactly what I wanted, thank you very much! My intent was to perform the SubStr operation first, and then apply the types to the columns. I wasn't expecting the two types in the same column. I appreciate your response! On Tue, Feb 10, 2015 at 5:03 PM, David Winsemius

Re: [R] How to read this Rpart decision tree?

2015-02-11 Thread Sarah Goslee
Hi Kim fancyRpartPlot is a front-end to prp, and you can pass it all of the prp options - it says this in the help for fancyRpartPlot, and that's about all it says. So you need to spend some time reading about prp options, and how to customize your plot to get what you want. There are lots of

Re: [R] help in anova

2015-02-11 Thread Marco Barbàra
I suspect that your treatment levels are perfectly nested inside the soilgroup levels. If this were the case you can either use one of the factor in your analysis or the other, depending on what you want to analyze. Il giorno Wed, 11 Feb 2015 14:47:18 + Mir Salam mir.sa...@uef.fi ha scritto:

[R] help in anova

2015-02-11 Thread Mir Salam
Dear all, I have follwing factors in my data set (G) names(G) relative ht, biomass, treatment, variety, soil group relative height biomass treatment (4 levels)- control+lime, control+ash, contaminated soil+lime, contaminated soil+ash variety (4 levels)- Salix swherinii, Salix mursinifolia,

Re: [R] Maxent does not work

2015-02-11 Thread Kenneth Z
Is there any package that can replace maxent for a large number of independent variables? Thanks, Ken Sent from my iPhone On Feb 2, 2015, at 6:07 PM, Kenneth Z kenneth...@gmail.com wrote: Yesterday I installed the most recent R and maxent package, but it stopped working. Even a simple

Re: [R] Mixed-effects model for pre-post randomization design

2015-02-11 Thread Ben Bolker
Marco Barbàra jabbba at gmail.com writes: DeaR userRs, I recently read this Liang-Zeger article: http://sankhya.isical.ac.in/search/62b1/fpaper7.html in which (among other things) they adopt a random intercept model for pre-post designed trials, using a conditional likelihood

[R] Nonlinear integer programming question

2015-02-11 Thread Zwick, Rebecca J
I am seeking an optimization routine that can deal with the following problem: Maximize g(x), where x is a vector and g is nonlinear, subject to linear constraints of the form h(x)0 and m(x)=0 and subject to the constraint that all values of x are 0 or 1. I can't find a nonlinear optimization

Re: [R] Impute time-series data, perhaps with a Kalman filter - do you know of any R code?

2015-02-11 Thread Olivier Crouzet
Hi, searching for kalman filter R gives this paper that was published in JSS. It may help. @article{Tusell:2010:JSSOBK:v39i02, author = Fernando Tusell, title = Kalman Filtering in R, journal = Journal of Statistical Software, volume = 39, number = 2, pages =

Re: [R] AR1 covariance structure for lme object and R/SAS differences in model output

2015-02-11 Thread peter dalgaard
On 11 Feb 2015, at 16:57 , anord andreas.n...@biol.lu.se wrote: Dear R users, We are working on a data set in which we have measured repeatedly a physiological response variable (y) every 20 min for 12 h (time variable; 'x') in subjects ('id') beloning to one of five groups ('group';

[R] Problem Solved: optim fails when using arima

2015-02-11 Thread Albert Shuxiang Li
I am using arima(x, order=c(p,0,q)) function for my project, which deals with a set of large differenced time series data, data size varies from 8000 to 7. I checked their stationarity before applying arima. Occasionally, arima(x, order=c(p,0,q)) gives me error like following (which stops

[R] Impute time-series data, perhaps with a Kalman filter - do you know of any R code?

2015-02-11 Thread John Sorkin
Does anyone have code that uses a Kalman filter to impute time-series data? If not, do you know of any software that can be used to impute time-series data? Thank you, John John David Sorkin M.D., Ph.D. Professor of Medicine Chief, Biostatistics and Informatics University of Maryland School of

Re: [R] read.table with missing data and consecutive delimiters

2015-02-11 Thread Rui Barradas
Hello, You're missing a dollar sign: 2$$$5, not 2$$5. Hope this helps, Rui Barradas Em 11-02-2015 14:53, Tim Victor escreveu: All, Assume we have data in an ASCII file that looks like Var1$Var2$Var3$Var4 1$2$3$4 2$$5 $$$6 When I execute read.table( 'test.dat', header=TRUE, sep='$' ) I,

Re: [R] prediction intervals for robust regression

2015-02-11 Thread Prof Brian Ripley
On 11/02/2015 19:38, Bert Gunter wrote: Presumably you've checked out: http://cran.r-project.org/web/views/Robust.html If you can estimate the variance of parameter estimates, betahat, then you can estimate the variance of a predicted value, X betahat; add the estimated variance of individuals

[R] read.table with missing data and consecutive delimiters

2015-02-11 Thread Tim Victor
All, Assume we have data in an ASCII file that looks like Var1$Var2$Var3$Var4 1$2$3$4 2$$5 $$$6 When I execute read.table( 'test.dat', header=TRUE, sep='$' ) I, of course, receive the following error: Error in scan(file, what, nmax, sep, dec, quote, skip, nlines, na.strings, : line 2 did

Re: [R] $ operator is invalid for atomic vectors

2015-02-11 Thread JS Huang
Hi, If x is a data frame, then x$getmean will try to get the vector named getmean in x. You put () after x$getmean. I think r is confused about it. It appears that you want to call a function named getmean(). -- View this message in context:

[R] AR1 covariance structure for lme object and R/SAS differences in model output

2015-02-11 Thread anord
Dear R users, We are working on a data set in which we have measured repeatedly a physiological response variable (y) every 20 min for 12 h (time variable; 'x') in subjects ('id') beloning to one of five groups ('group'; 'A' to 'E'). Data are located at:

Re: [R] Download internet videos

2015-02-11 Thread MacQueen, Don
Hmmm. Well, a youtube video is a file. Therefore search for R download file and you will find the download.file() function. -- Don MacQueen Lawrence Livermore National Laboratory 7000 East Ave., L-627 Livermore, CA 94550 925-423-1062 On 2/11/15, 8:17 AM, Raoni Rodrigues

Re: [R] suggestion for optimal plotting to show significant differences

2015-02-11 Thread Richard M. Heiberger
Petr, My first attempt is to use the simple=TRUE argument to interaction2wt. Then the bwplots in the item|item panel show the behavior of value over day for each item. You get a plot similar to this panel with the growth curve plots from nlme, for example, bwplot(value ~ day | item,

Re: [R] Nonlinear integer programming question

2015-02-11 Thread JS Huang
Hi Rebecca, It will be very helpful if you can provide a set of specific functions g(x), h(x) and m(x). -- View this message in context: http://r.789695.n4.nabble.com/Nonlinear-integer-programming-question-tp4703122p4703128.html Sent from the R help mailing list archive at Nabble.com.

[R] piecewise regression and lm() question

2015-02-11 Thread Goldschneider, Jill
I was playing with some examples of piecewise regression using lm() and have come across a behavior I'm uncertain about. Below is simple 3-segment dataset. I compare predicted output of a model created by one call to lm() to that of 3 models created by 3 calls to lm(). In case A and B, the

Re: [R] AR1 covariance structure for lme object and R/SAS differences in model output

2015-02-11 Thread Ben Bolker
anord andreas.nord at biol.lu.se writes: [snip snip] We are working on a data set in which we have measured repeatedly a physiological response variable (y) every 20 min for 12 h (time variable; 'x') in subjects ('id') beloning to one of five groups ('group'; 'A' to 'E'). Data are

Re: [R] piecewise regression and lm() question

2015-02-11 Thread Duncan Murdoch
On 11/02/2015 4:30 PM, Goldschneider, Jill wrote: I was playing with some examples of piecewise regression using lm() and have come across a behavior I'm uncertain about. Below is simple 3-segment dataset. I compare predicted output of a model created by one call to lm() to that of 3 models

[R] simple question - mean of a row of a data.frame

2015-02-11 Thread Matthew Keller
Hi all, Simple question I should know: I'm unclear on the logic of why the sum of a row of a data.frame returns a valid sum but the mean of a row of a data.frame returns NA: sum(rock[2,]) [1] 10901.05 mean(rock[2,],trim=0) [1] NA Warning message: In mean.default(rock[2, ], trim = 0) :

Re: [R] simple question - mean of a row of a data.frame

2015-02-11 Thread Kehl Dániel
Hi, rock[2,] is a data frame and you should not use sum() on a data frame, first google hit for the error message gives http://stackoverflow.com/questions/19697498/r-beginner-argument-is-not-numeric-or-logical-returning-na Otherwise I think you should use ?rowSums and ?rowMeans if you have

[R] Subsetting data with svyglm

2015-02-11 Thread Brennan O'Banion
I am aware that it is possible to specify a subset with a single logical operator when constructing a model, such as: svyglm(formula, design=data, subset=variable==value). What I can't figure out is how to specify a subset with two or more logical operators: svyglm(formula, design=data,

[R] grofit issues with replicates - probit or logit or glmm

2015-02-11 Thread Marcelo Laia
Hello I tried use grofit package in our data set. We provide a subset of our data with X iso, and 4 doses, and insect died was count each day for long 5 days. We started with Y insects per dishes. When one is dead, it was counted and removed. Died insect is cumulative in the next days. i.e. day 1

[R] How to read this Rpart decision tree?

2015-02-11 Thread Kim C.
Hi all, In the attachment or this link (http://oi58.tinypic.com/35ic9qc.jpg) you'll find the decision tree I made. I used the Rpart package to make the tree and the rattle package using the fancyRpartPlot to plot it. The data in the tree looks different than about every example I have seen

[R] Mixed-effects model for pre-post randomization design

2015-02-11 Thread Marco Barbàra
DeaR userRs, I recently read this Liang-Zeger article: http://sankhya.isical.ac.in/search/62b1/fpaper7.html in which (among other things) they adopt a random intercept model for pre-post designed trials, using a conditional likelihood approach (I didn't think it possible with only two

Re: [R] How to read this Rpart decision tree

2015-02-11 Thread Therneau, Terry M., Ph.D.
First: summary(ss.rpart1) or summary(ss.rpart, file=whatever) The printout will be quite long since your tree is so large, so the second form may be best followed by a perusal of the file with your favorite text editor. The file name of whatever above should be something you choose, of

[R] upgrading issues with Rcpp

2015-02-11 Thread arnaud gaboury
gabx@hortensia [R] sessionInfo() R version 3.1.2 (2014-10-31) Platform: x86_64-unknown-linux-gnu (64-bit) locale: [1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C LC_TIME=en_US.UTF-8LC_COLLATE=en_US.UTF-8 LC_MONETARY=en_US.UTF-8 [6] LC_MESSAGES=en_US.UTF-8LC_PAPER=en_US.UTF-8

Re: [R] upgrading issues with Rcpp

2015-02-11 Thread Dirk Eddelbuettel
arnaud gaboury arnaud.gaboury at gmail.com writes: Now when trying to update Rcpp: gabx at hortensia [R] install.packages(Rcpp) . Error in unloadNamespace(pkg_name) : namespace ‘Rcpp’ is imported by ‘reshape2’, ‘plyr’, ‘dplyr’ so cannot be unloaded ..

Re: [R] Subsetting data with svyglm

2015-02-11 Thread Anthony Damico
hi brennan, survey design objects can be subsetted with the same subset() syntax as data.frame objects, so following jeff's advice maybe you want svyglm( formula , design = subset( surveydesign , variable %in% c( 'value a' , 'value b' ) ) ) for some examples of how to construct a survey design

Re: [R] Subsetting data with svyglm

2015-02-11 Thread Jeff Newmiller
This seems like a fundamental misunderstanding on your part of how operators, and in particular logical expressions, work in computer languages. Consider some examples: 1+2 has a numeric answer because 1 and 2 are both numeric. 1+a has at the very least not a numeric answer because the values