Re: [R] Suggestions for vectorizing/double loop

2017-01-23 Thread PIKAL Petr
Well, your second post is rather confusing too, as is your not reproducible code. If I understand correctly, you just want to change names of files in a directory according to some rules, which you did not clerly specify. First I am not sure if R is the best tool for it. Nevertheless, you do

Re: [R] separate mixture of gamma and normal (with mixtools or ??)

2017-01-23 Thread Thomas Petzoldt
Dear Bert, thank you very much for your suggestion. You are right, ill-conditioning was sometimes a problem for 3 components, but not in the two-component case. The modes are well separated, and the sample size is high. My main problem is (1) the shape of the distributions and (2) the

Re: [R] Extracting first number after * in a character vector

2017-01-23 Thread Michael Hannon
Elegant I don't know, but I think the appended does the trick. -- Mike > foo <- c(" 1 X[0,SMITH] * 0 0 1 ", + " 2 X[0,JOHNSON] * 0 0 1 ", + " 3 X[0,WILLIAMS] * 1 0 1 ",

Re: [R-es] Eliminación de filas en data frame según versión del fichero de origen

2017-01-23 Thread Freddy Omar López Quintero
​Hola.​ 2017-01-23 14:27 GMT-03:00 Rubén Coca : > El caso es que para un mismo id y date debo quedarme con la observación que > tenga la versión más alta (descartando el resto). > Si es válido apoyarse en SQL, yo usaría algo como: > library(sqldf) > sqldf("select rowid,

Re: [R] Can R markdown do beamer palo alto theme?

2017-01-23 Thread C W
Actually, I figured out that you can, but the syntax is different. You don't declare using \usedocument{beamer} \usetheme{PaloAlto}, instead, title and output are the correct syntax. Is there a full conversion list from Latex Beamer to Markdown Beamer? Thanks! On Mon, Jan 23, 2017 at 7:20 PM,

[R] Can R markdown do beamer palo alto theme?

2017-01-23 Thread C W
Hi R list, Is it possible to use R markdown with beamer palo alto theme? Are they compatible? I copy pasted my LaTex code over to R, I get the following error message: ! LaTeX Error: Can be used only in preamble. See the LaTeX manual or LaTeX Companion for explanation. Type H for immediate

Re: [R] separate mixture of gamma and normal (with mixtools or ??)

2017-01-23 Thread Bert Gunter
Fitting multicomponent mixtures distributions -- and 3 is already a lot of components -- is inherently ill-conditioned. You may need to reassess your strategy. You might wish to post on stackexchange instead to discuss such statistical issues. Cheers, Bert Bert Gunter "The trouble with having an

[R] separate mixture of gamma and normal (with mixtools or ??)

2017-01-23 Thread Thomas Petzoldt
Dear friends, I am trying to separate bi- (and sometimes tri-) modal univariate mixtures of biological data, where the first component is left bounded (e.g. exponential or gamma) and the other(s) approximately Gaussian. After checking several packages, I'm not really clear what to do. Here

Re: [R] removing dropouts from survival analysis

2017-01-23 Thread Bert Gunter
Sorry. You may get private replies, but this *is* way OT on this list. Try stats.stackexchange.com instead for statistical queries. Or, better yet, find local consulting help. Non-random dropouts are a difficult issue. Cheers, Bert Bert Gunter "The trouble with having an open mind is that people

Re: [R] [FORGED] Fitting arima Models with Exogenous Variables

2017-01-23 Thread Rolf Turner
This should have been sent to the R-help mailing list, not to me personally. I am not an expert on this sort of time series modelling and cannot thereby provide any useful advice. My reply to you was of a "generic" nature --- when making an enquiry, provide a reproducible example!!! I am

Re: [R] Extracting first number after * in a character vector

2017-01-23 Thread Jim Lemon
Hi Abhinaba, I'm sure that someone will post a terrifyingly elegant regular expression that does this, but: ardat<- c([1] " 1 X[0,SMITH] * 0 0 1 ", ... numpoststar<-function(x) { xsplit<-unlist(strsplit(x,"")) starpos<-which(xsplit=="*") # watch

Re: [R] R Graphics: Device 2 (Active)

2017-01-23 Thread Greg Snow
What is the result of running: getOption("device") ? It should be something like: "RStudioGD". It sounds like this has been changed to something else, if that is the case it is a matter of either changing it back, or figuring out where the change is being made and fixing that. On Mon, Jan 23,

[R] removing dropouts from survival analysis

2017-01-23 Thread Damjan Krstajic
Dear All. Apologies for posting a question regarding survival analysis, and not R, to the R-help list. In the past I received the best advices from the R community. The random censorship model (the censoring times independent of the failure times and vice versa) is one of the fundamental

Re: [R] Replicate Christensen, Dib (2008) using BMR package

2017-01-23 Thread Jeff Newmiller
Only your pdf attachment made it through. You would need to follow the Posting Guide regarding file types to achieve successful transmission. I will say that open-ended debugging of your code does not fit the Posting Guide recommendations either... this is an R language mailing list, not a

Re: [R] R Graphics: Device 2 (Active)

2017-01-23 Thread Bert Gunter
This sounds like an RStudio issue to me (just a not-so-informed guess, though). Did you reinstall that, too? Did you look/post on RStudio's site? Cheers, Bert Bert Gunter "The trouble with having an open mind is that people keep coming along and sticking things into it." -- Opus (aka Berkeley

[R] [R-pkgs] Announcing caesar

2017-01-23 Thread Jacob Kaplan
Dear R users, I am happy to announce that the package caesar is now on CRAN ( https://cran.r-project.org/web/packages/caesar/index.html). The caesar package lets you encrypt and decrypt strings using the common Caesar cipher or a more secure pseudorandom number generator method. If you would

Re: [R] R Graphics: Device 2 (Active)

2017-01-23 Thread Jeff Newmiller
You need to be clear in your own mind about the distinction between RStudio and R before you can communicate clearly about it. Specifically, we don't know how to debug problems with RStudio here, and what you describe sounds completely normal for the R Gui program that ships with R. It sounds

Re: [R] R Graphics: Device 2 (Active)

2017-01-23 Thread Rui Barradas
Hello, That's a question for R Studio, ask here: https://support.rstudio.com Hope this helps, Rui Barradas Em 23-01-2017 18:19, Jackson Rodrigues escreveu: Hi, after updating R and RStudio I am no longer able to see my plots in the plot pane. Instead a new window opens called: R Graphics:

[R] R Graphics: Device 2 (Active)

2017-01-23 Thread Jackson Rodrigues
Hi, after updating R and RStudio I am no longer able to see my plots in the plot pane. Instead a new window opens called: R Graphics: Device 2 (Active). I tried to use dev.off(), reinstalling, update again and etc but it does not help. I've checked this discussion list but I could not find any

Re: [R] spatial analysis using quickPCNM

2017-01-23 Thread Jeff Newmiller
I don't know if I will be able to help solve your problem, but failure to follow the recommendations in the Posting Guide was probably getting you off in the wrong foot when you posted on the other (more appropriate?) mailing list, as it is here. A) Code is garbled. Post using plain text

Re: [R] Suggestions for vectorizing/double loop

2017-01-23 Thread Luanna Dixson
Hi all, Thanks very much for your help! You are correct in thinking the list is the same as before, actually, my question was more about how to do the next steps, where I needed to match the filenames of the files in my directory with old (i.e current) and new file name prefixes in my list. For

Re: [R] Granger-causality test using vars package

2017-01-23 Thread Pfaff, Bernhard Dr.
Dear T.Riedle, it is a 'combined' test, see ?causality for a formal description of the test statistic. If you would like results on an 'equation' by equation' approach, you could employ anova() on restricted and unrestricted lm-objects. Best wishes, Bernhard -Ursprüngliche

[R] Can mice() handle crr()? Fine-Gray model

2017-01-23 Thread Therneau, Terry M., Ph.D.
Look at the finegray command within the survival package; the competing risks vignette has coverage of it. The command creates an expanded data set with case weights, such that coxph() on the new data set = the Fine Gray model for the original data. Anything that works with coxph is valid on

[R] spatial analysis using quickPCNM

2017-01-23 Thread Andrew Halford
Hi Listers, I posted this message to the R-sig-ecology group last Friday but have not had a response hence my post here. I have been trying to run spatial analyses on a fish community dataset. My fish dataset has 114 species(variables) x 45 sites My spatial dataset has the Lat and Long values

Re: [R] Suggestions for vectorizing/double loop

2017-01-23 Thread PIKAL Petr
Hi In your case if you want to rename abot 600 items and your doble loop works it is not worth to vectorize it. However if you want to repeat such task often and you expect much bigger number of files vectorizing can speed things up and make them cleaner. Although I must admit that I do not

Re: [R] Suggestions for vectorizing/double loop

2017-01-23 Thread Michael Dewey
Dear Luanna It is not compulsory to avoid for loops but see below On 23/01/2017 12:28, Luanna Dixson wrote: I need to rename a bunch of files, by searching for string matches in a list. Each list element containings a character with the old filename that I want to match to, and the new file

Re: [R] Suggestions for vectorizing/double loop

2017-01-23 Thread Thierry Onkelinx
Dear Luanna, Assuming that oldnames and newnames are character (and not factor), the just use stringsAsFactors = FALSE. That will save you from having to convert the factors back to character. data.frame(oldnames, newnames, stringsAsFactor = FALSE) Best regards, ir. Thierry Onkelinx Instituut

Re: [R] Chi-square test

2017-01-23 Thread Sergio Ferreira Cardoso
Dear David and John, Thank you for your replies. Indeed I'm using ape and nlme packages. Here it is: > fit<-gls(fcl~mass+activity+agility,correlation=corBrownian(phy=tree),data=df,method="ML",weights=varFixed(~vf)) > Anova(fit) Analysis of Deviance Table (Type II tests) Response: fcl

[R] Suggestions for vectorizing/double loop

2017-01-23 Thread Luanna Dixson
I need to rename a bunch of files, by searching for string matches in a list. Each list element containings a character with the old filename that I want to match to, and the new file name that I want to rename by. For instance, here filename '1001.xls' should match to list[[1]]$oldname and I

Re: [R] Extracting first number after * in a character vector

2017-01-23 Thread Uwe Ligges
On 23.01.2017 13:29, Abhinaba Roy wrote: Hi, How do I extract the first number after '*' in a vector? The vector is given below dput(out[1:10]) c(" 1 X[0,SMITH] * 0 0 1 ", " 2 X[0,JOHNSON] * 0 0 1 ", "

[R] Extracting first number after * in a character vector

2017-01-23 Thread Abhinaba Roy
Hi, How do I extract the first number after '*' in a vector? The vector is given below > dput(out[1:10]) c(" 1 X[0,SMITH] * 0 0 1 ", " 2 X[0,JOHNSON] * 0 0 1 ", " 3 X[0,WILLIAMS]", "*

Re: [R] Granger-causality test using vars package

2017-01-23 Thread T.Riedle
Thank you for your reply. The code follows the example in the vignette and I changed it only a little as shown below. library(vars) data(Canada) summary(Canada) stat.desc(Canada,basic=FALSE) plot(Canada, nc=2, xlab="") # Testing for unit roots using ADF adf1<-adf.test(Canada[,"prod"]) adf1

Re: [R] Granger-causality test using vars package

2017-01-23 Thread Pfaff, Bernhard Dr.
Dear T.Riedle, you cannot assign *all* variables as a cause at once. Incidentally, in your example, you missed a 'data(Canada)'. Having said this, you can loop over the variables names and extract the statistic/p-values. These are contained as named list elements 'statistic' and 'p.value' in

Re: [R] runmed {stat}

2017-01-23 Thread Martin Maechler
> on Sun, 22 Jan 2017 10:26:24 -0600 writes: > Dear Dr Mächler, I am using runmed from R's stat > package. I understand that you are the author of this package. not of the package - but of function runmed(). I'm reply to R-help, so this answer maybe available to future web