Re: [R] question

2015-07-01 Thread Calin Uioreanu
for (var_name in names(z)) { # assuming the prep function writes the content of z$var_name to the file var_name.csv prep(z, var_name) } On Wed, Jul 1, 2015 at 10:18 PM Lida Zeighami wrote: > I have 682 variables in a data frame , and a function that I should feed > 682 variables in this funct

Re: [R] How to specified contrasts in anova (lm)

2015-07-01 Thread Davide Risso
Update: I was able to fit the desired model by manually specifying the proper contrast for the second factor, i.e. (going on with my example). mat <- matrix(c(1, -1, 0, 0, 0, 0, 0, 1, 0, -1, 0, 0, 0, 1, -1), ncol=3) fit <- lm(y~a+b, contrasts = list(a=contr.sum, b=mat)) I guess that the proper w

Re: [R] question

2015-07-01 Thread jim holtman
I forgot that you also wanted to change the variable name; I would suggest that you don't use individual objects, but instead use a 'list'. Here is how it would change result <- lapply(name_file$names, function(.file){ result <- prep(z, .file) saveRDS(result, file = paste0(.file, '.RDS'))

Re: [R] question

2015-07-01 Thread jim holtman
You never said how you wanted to save the data, so I will choose to use 'saveRDS' which should handle most anything. for (i in name_file$names){ saveRDS(prep(z, i), file = paste0(i, '.RDS')) } Jim Holtman Data Munger Guru What is the problem that you are trying to solve? Tell me what you

Re: [R] Extracting data from a file containing data

2015-07-01 Thread jim holtman
Here is a way to do case I. It uses the 'tidyr' package and produces results like: > case1[[1]] YR JF-R_NINO1.2 MAM-R_NINO1.2 JJA-R_NINO1.2 OND-R_NINO1.2 1 1982 MLMLMESE 2 1983 SESESEME 3 1984

Re: [R] How to specified contrasts in anova (lm)

2015-07-01 Thread Bert Gunter
You do not set constraints in R you set contrasts. See the relevant sections of e.g. Venables and Ripley's MASS book. ?contrasts ## what else! ?C for details. Beyond this, I cannot help. -- Bert Bert Gunter "Data is not information. Information is not knowledge. And knowledge is certainly no

Re: [R] How to specified contrasts in anova (lm)

2015-07-01 Thread Davide Risso
Hi Bert, I apologize for the HTML. I will pay more attention in the future. I know that the lm() command of my toy example fits the wrong model with a singular design, maybe I shouldn't have included it. I believe that the model with the additional constraint(s) is not garbage. But I don't know

Re: [R] How to specified contrasts in anova (lm)

2015-07-01 Thread Bert Gunter
Note that the toy example you provided is garbage. It has nothing to do with contrasts (i.e. constraints) -- the DESIGN is singular: The (2) - (1) difference for factor A is exactly the same as the (3,4,5) average - (1,2)average for B. I suspect you need to use a mixed effects model treating batch

[R] question

2015-07-01 Thread Lida Zeighami
I have 682 variables in a data frame , and a function that I should feed 682 variables in this function one by one and each time save the file as a special name! for emaple: my data frame file includes 682 names : 1 aaa 2 bbb 3 dfdsfg 4 fghh . 682 fgfhg and a function like prep(Z, aaa, .)

[R] How to specified contrasts in anova (lm)

2015-07-01 Thread Davide Risso
Dear list, I have the following anova that I want to fit in R: y_{ijk} = \mu + \alpha_i + \beta_{j(i)} + \epsilon_{ijk} This is an application in biology, in which we are measuring a certain (continuous) characteristic of a group of cells. Hence y_{ijk} corresponds to the measurement on cell k o

Re: [R] checkConv and as.data.frame.default problems in R

2015-07-01 Thread John Fox
Dear Saudi Sadiq, If you want answers to most of your questions, you'll likely have to provide your data so that people can reproduce the errors. I can, however, answer part of your last question without the data: plot(allEffects(modelqaaf1)) fails because the data set is named q, and there is

Re: [R] ggmap warning

2015-07-01 Thread Thierry Onkelinx
All variables used in the plot must contain finite values. Without your code we can only speculate about your code. ir. Thierry Onkelinx Instituut voor natuur- en bosonderzoek / Research Institute for Nature and Forest team Biometrie & Kwaliteitszorg / team Biometrics & Quality Assurance Kliniekst

Re: [R] Extracting arrows from CCA plots

2015-07-01 Thread kirchman
Here's a partial answer to my own question. While I still don't know how to get the arrow information out of a CCA plot, it is possible to reproduce the arrows by first extracting the biplot data with scores (results.cca, display="bp") and then using the ordiArrowMul function in vegan to rescale th

Re: [R] ggmap warning

2015-07-01 Thread Chichi Shu
Thanks Thierry. Is it the longitude and latitude that need to have finite values? From: Thierry Onkelinx Sent: Wednesday, July 01, 2015 2:50 AM To: Chichi Shu Cc: r-help@r-project.org Subject: Re: [R] ggmap warning Your data contains 4945 rows with missing or infinite values. These cannot b

[R] checkConv and as.data.frame.default problems in R

2015-07-01 Thread Saudi Sadiq
Hi All, I have two datasets, vowels and qaaf, and both have 8 columns clarified as follows: 1. convergence: DV (whether participants succeeded to use CA (Cairene Arabic) or fail to do so; hence, they use MA (Minia Arabic) 2. speaker: 62 participants 3. lexical.item: as pronounced 4. style:

Re: [R] Academic studies over R-Help

2015-07-01 Thread Boris Steipe
Indeed, this is OT. :-) The way you have phrased your question, you are asking us for help to design your study. Certainly very OT. Once your study is designed, and it is of clear, potential benefit to the R community, posting a concise _announcement_ here would not offend me. Hope this helps

Re: [R] applying coda package effectiveSize function to a list

2015-07-01 Thread PIKAL Petr
Hi > -Original Message- > From: Debra Ragland [mailto:ragland.de...@yahoo.com] > Sent: Wednesday, July 01, 2015 4:53 PM > To: PIKAL Petr > Subject: Re: [R] applying coda package effectiveSize function to a list > > Hi Petr, > > How do I remove a post? AFAIK, no way. Why? Instead of remov

Re: [R] applying coda package effectiveSize function to a list

2015-07-01 Thread PIKAL Petr
Hi Please no HTML posting. It is almost unreadable. Do not post twice the same question, it is unnecessary. I do not know coda package but without further info you probably do not get sensible answer. Is your splits data mcmc or mcmc.list object? How does objects for which the function works

[R] package forecast is not working properly

2015-07-01 Thread Magda Joana Silva
Hello all, I just installed "forecast" package but I have the following error when I try to load the library: > library("forecast") Loading required package: zoo Attaching package: ‘zoo’ The following objects are masked from ‘package:base’: as.Date, as.Date.numeric Loading required packa

[R] applying coda package effectiveSize function to a list

2015-07-01 Thread debra ragland via R-help
Please help,I am spinning my wheels behind what should be a pretty simple solution. I found a solution by asking another question on here but it seems to not be effective on all my files of similar make up to the test case. I am simply trying to read data into R, group/order it by chain and atom

[R] Help with order.max in ar.yw.default

2015-07-01 Thread debra ragland via R-help
Hello,  I am trying to fit my data to the default autoregressive models in R. I'm trying to apply the effectiveSize function from the coda package to a list of data frames using;  sapply(splits, function(x) coda::effectiveSize(x["V5"]))  However when I do, I get the error;  Error in ar.yw.defa

Re: [R] mixtools? Fitting two-normal distributions to data where one of the two normal distributions (the one corresponding to lower values of x) is a left-truncated normal distribution.

2015-07-01 Thread Denis Chabot
Hi John, I don't know how well it will handle your truncated left distribution, but I use the function Mclust from package mclust to fit a mixture of normal distribution and it works very well. Denis > Le 2015-06-30 à 22:22, John Sorkin a écrit : > > I am trying to model the mixture of two n