Re: [R] Read 2 rows in 1 dataframe for diff - longitudinal data

2013-06-03 Thread arun
If it is grouped by "subid" (that would be the difference in the number of changes) subset(ddply(df1,.(subid),mutate,delta=c(FALSE,var[-1]!=var[-length(var)])),delta)[,-4] #   subid year var #3 36 2003   3 #7 47 2001   3 #9 47 2005   1 #10    47 2007   3 A.K. - Original Message

[R] Multiple selection and normalization

2013-06-03 Thread Robert Lynch
Hi-- I am trying to normalize course grades for each instance of a course, e.g. Stats 1 Fall2009 J. Smith. I have a frame for all instances of a course, e.g. stats 1 in the last 5 years, that looks like SIDN TERM GRADE INST where SIDN is a Student ID Number, TERM is a factor that gives the q

Re: [R] error about MCA

2013-06-03 Thread meng
Yes,I DO select all of the variables as quanti.sup and quali.sup. >From your words,it seems that the quanti.sup and quali.sup. are not parts of >the original variables,but are "estimated" from the other variables? Many thanks. At 2013-06-03 21:54:59,"David Carlson" wrote: >Probably bec

Re: [R] Read 2 rows in 1 dataframe for diff - longitudinal data

2013-06-03 Thread David Winsemius
On Jun 3, 2013, at 7:10 PM, arun wrote: > Hi, > May be this helps: > res1<-df1[with(df1,unlist(tapply(var,list(subid),FUN=function(x) > c(FALSE,diff(x)!=0)),use.names=FALSE)),] > res1 > # subid year var > #3 36 2003 3 > #7 47 2001 3 > #9 47 2005 1 > #1047 2007 3 > #or

Re: [R] Read 2 rows in 1 dataframe for diff - longitudinal data

2013-06-03 Thread arun
Hi, May be this helps: res1<-df1[with(df1,unlist(tapply(var,list(subid),FUN=function(x) c(FALSE,diff(x)!=0)),use.names=FALSE)),]  res1 #   subid year var #3 36 2003   3 #7 47 2001   3 #9 47 2005   1 #10    47 2007   3 #or library(plyr)  subset(ddply(df1,.(subid),mutate,delta=c(FALSE,di

Re: [R] wilcox_test function in coin package

2013-06-03 Thread Janh Anni
Hello Henric, Thank you so much for the detailed responses and helpful information. Much appreciated. Regards Janh On Mon, Jun 3, 2013 at 6:15 AM, Henric Winell wrote: > Janh, > > Janh Anni skrev 2013-06-01 19:47: > > Hello All, >> Thanks a lot for the helpful suggestions. I wonder how tie

Re: [R] delete active dataset

2013-06-03 Thread David Winsemius
This may not help if the OP is using Mac or Windows since these hidden by default. Seek out OS info on how to show dot-files. -- David Sent from my iPhone On Jun 3, 2013, at 8:33 AM, John Kane wrote: > It sounds like you inadvertently saved a workspace file. Have a look in your > current

[R] read.csv and write.csv filtering for very big data ?

2013-06-03 Thread ivo welch
dear R wizards--- I presume this is a common problem, so I thought I would ask whether this solution already exists and if not, suggest it. say, a user has a data set of x GB, where x is very big---say, greater than RAM. fortunately, data often come sequentially in groups, and there is a need to

Re: [R] Regularized Discriminant Analysis scores, anyone?

2013-06-03 Thread Uwe Ligges
On 02.06.2013 17:57, Matthew Fagan wrote: Thank you Dr. Ligges, i very much appreciate the quick reply. i wondered if that was the case, based on the math as I (poorly) understood it. However i remain confused. page 107 from the "rrcov" package PDF makes me think I can derive LDA-style discri

Re: [R] Optim seems not to work properly in foreach

2013-06-03 Thread ilai
On Mon, Jun 3, 2013 at 11:37 AM, Simon Zehnder ... [Some not minimal, self contained, reproducible code]... > Data simulation and thecreation of startpar works fine, but the parameters > in res$par are always the start parameters. If I run the same commands > directly on the shell I get in res$

Re: [R] Why do tabs disappear when pasted into the R console?

2013-06-03 Thread David Winsemius
On Jun 3, 2013, at 12:46 PM, Tal Galili wrote: > Very interesting, thank you. > However, after disabling the tab completion, the RGUI still can't > distinguish pasted tabs. e.g: > > # Running: > > Sys.setenv(R_COMPLETION=FALSE) > Sys.getenv("R_COMPLETION") > > a = read.table( text= > " > 1 2

Re: [R] Mixed effects model with a phylogenetic tree/ distance matrix as a random effect

2013-06-03 Thread Ben Bolker
Bert Gunter gene.com> writes: > > Recommendation: Post this to the R-sig-mixed-models list, not here. > > Cheers, > Bert Seconded. Alternatively you could try the r-sig-ph...@r-project.org mailing list, although I think I would try R-s-m-m first. > > On Mon, Jun 3, 2013 at 9:27 AM, Roey

Re: [R] Why do tabs disappear when pasted into the R console?

2013-06-03 Thread Tal Galili
Very interesting, thank you. However, after disabling the tab completion, the RGUI still can't distinguish pasted tabs. e.g: # Running: Sys.setenv(R_COMPLETION=FALSE) Sys.getenv("R_COMPLETION") a = read.table( text= " 1 2 3 4 ") a # will result in: (instead of two columns) V1 1 12 2 34

[R] installing package 'rqpd' (Regression quantiles for panel data)

2013-06-03 Thread Manish K. Srivastava
Hello R community members, I'm trying to install the 'rqpd' package which is developed by Roger Koenker and Stefan Bache. When I try to install the package using the command 'install.packages("rqpd",repos="http://R-Forge.R-project.org";)' I'm getting the following two messages: i) package ‘r

Re: [R] Strange behaviour of R graphics copied to PowerPoint

2013-06-03 Thread Steve Simon, P.Mean Consulting
As I understand it, there are multiple competing standards for the Windows Metafile (WMF) format. See --> http://en.wikipedia.org/wiki/Windows_Metafile I like WMF because it is vector based and thus scales nicely. But eventually I gave up on it because the WMF format was unpredictable when exporte

[R] interpretation of flexsurvreg output from flexsurv package

2013-06-03 Thread Sara Carvalho
Dear all, I am fitting a parametric regression model to survival data using the flexsurvreg function from the flexsurv package. I am using a Gompertz distribution (a 2-parameter distribution) to describe the hazard function and I want to compare two groups. The model is very simple: flexsurvreg(f

Re: [R] Mixed effects model with a phylogenetic tree/ distance matrix as a random effect

2013-06-03 Thread Bert Gunter
Recommendation: Post this to the R-sig-mixed-models list, not here. Cheers, Bert On Mon, Jun 3, 2013 at 9:27 AM, Roey Angel wrote: > Hi, > I'm trying to build a mixed-effects model in which I'd like to include > either a distance matrix or a phylogenetic tree as a random effect. > The troubles

Re: [R] Robust GAM that covers Gaussian Distributions

2013-06-03 Thread Ilaria Prosdocimi
Christos Giannoulis gmail.com> writes: > > Dear All, > > I was looking the r-archives and crantastic...for a package that has a > robust approach to generalized additive models. I found two packages > "robustgam" and "rgam" but their implemented functions > cover only binomial and poisson distr

[R] Mixed effects model with a phylogenetic tree/ distance matrix as a random effect

2013-06-03 Thread Roey Angel
Hi, I'm trying to build a mixed-effects model in which I'd like to include either a distance matrix or a phylogenetic tree as a random effect. The troubles I've had are that: 1. Function lmer() in package lme4 only accepts a data frame column as a random factor and not a distance matrix. 2. Fun

Re: [R] wilcox_test function in coin package

2013-06-03 Thread Henric Winell
Janh, Janh Anni skrev 2013-06-01 19:47: Hello All, Thanks a lot for the helpful suggestions. I wonder how ties are handled for the rank sum test by wilcox_test and wilcox.exact? For instance, Ties handling was mainly a problem back in the day when recursion formulas were used for the comput

Re: [R] Y-lim minimum overrun in barplot

2013-06-03 Thread David Carlson
I believe you are looking for the offset= parameter. Consider the following: barplot(c(2, 3), ylim=c(1, 3)) barplot(c(2, 3), ylim=c(1, 3), offset=1) - David L Carlson Associate Professor of Anthropology Texas A&M University College Station, TX 77840-4352 -

Re: [R] Y-lim minimum overrun in barplot

2013-06-03 Thread Nicole Prause
Thank you for the three (!) solutions suggested. I found that the base subtraction trick worked well, but I investigated all three: offset, I found, referred to moving bars on the x-axis. Great for line plot jitter when they're overlapping, but not the problem I was trying to solve here. Sorry

[R] Optim seems not to work properly in foreach

2013-06-03 Thread Simon Zehnder
Hi guys, I am working now for several years in R and I would say I manage things pretty easily, but with the foreach loop I have my problems. I call for a simulation a double foreach loop and this works fine. Inside the second loop (which I plan to parallelize later on) I call Rs optim-function

Re: [R] Error code from optim - "NEW_X" what does it mean?

2013-06-03 Thread Adler, Avraham
Hello, Jeff. Thank you for your quick response. Unfortunately, a reproducible example will be difficult, if not impossible, as it depends on a particular compilation of both 'R' and 'Rblas.dll' as described in . I therefore was hopin

Re: [R] Error code from optim - "NEW_X" what does it mean?

2013-06-03 Thread Jeff Newmiller
Your email Is missing a reproducible example... very sub-optimal, likely to be ignored. --- Jeff NewmillerThe . . Go Live... DCN:Basics: ##.#. ##.#. Live Go...

Re: [R] Strange behaviour of R graphics copied to PowerPoint

2013-06-03 Thread Duncan Murdoch
On 02/06/2013 1:15 PM, Erling Johan Frøysa wrote: Hello, I am using R to create graphics, especially to plot time series charts. These charts are then copied as metafiles (for best quality) to a PowerPoint presentation and then saved to PDF (via the "Save As" dialog"). Attached is two pictures.

[R] Error code from optim - "NEW_X" what does it mean?

2013-06-03 Thread Adler, Avraham
Hello. Does anyone know what the error code "NEW_X" means in optim? Here is what the return looks like: $counts function gradient 302 302 $convergence [1] 1 $message [1

Re: [R] delete active dataset

2013-06-03 Thread John Kane
It sounds like you inadvertently saved a workspace file. Have a look in your current directory and see if there is an .RDATA file there that you don't recognize. If so, delete it. John Kane Kingston ON Canada > -Original Message- > From: ye...@lbl.gov > Sent: Mon, 3 Jun 2013 08:25:59

[R] delete active dataset

2013-06-03 Thread Ye Lin
Hi All, whenever I open R using the shortcut on desktop, there are 2 active datasets in the workspace, I tried to start the program from Start menu, same thing!! How can I delete these two active datasets and make sure whenever I restart the program, they wont appear? Thanks! [[alternativ

Re: [R] split and common variables

2013-06-03 Thread David Carlson
It may be easier if you convert the list you provided to a data.frame: > dta.df <- data.frame(place=dta$place, name=dta$name, value=dta$value) > dta.df Note that the last line is blank so you probably want to remove that and remove the blank factor levels: > dta.df <- dta.df[-nrow(dta.df),] > dt

Re: [R] split and common variables

2013-06-03 Thread arun
Hi, It is not clear. dta1<-do.call(data.frame,dta) dta2<-dta1[complete.cases(dta1),] dta2[,-3]<-lapply(dta2[,-3],as.character) lstdta2<-split(dta2,dta2$place) library(plyr) join_all(lapply(lstdta2,`[`,-1),by="name",type="inner") #none of them are common #[1] name  value value value value value #<0

Re: [R] split and common variables

2013-06-03 Thread Adams, Jean
Nico, It is unclear to me what sort of result you are looking for. Can you give an example of what the output would look like using the example data you provided? You can look at the occurrence of names and places using the table() function, table(a$name, a$place) or you could look at the me

Re: [R] Y-lim minimum overrun in barplot

2013-06-03 Thread Adams, Jean
Nikky, It is helpful if you provide a simplified version of your question with data. For example: # simplified example y <- c(2.2, 2.4, 2.35, 2.45) upper <- 0.17 lower <- upper # current plot, with default base of 0 b <- barplot(y, ylim=c(2, 3)) arrows(b, y+upper, b, y-lower, angle=90, code=3)

Re: [R] Strange behaviour of R graphics copied to PowerPoint

2013-06-03 Thread Marc Schwartz
In addition to the manner in which the PDF files are generated, you might want to consider the possibility that the lines are artifacts created by your PDF viewer. See: http://cran.r-project.org/doc/FAQ/R-FAQ.html#Why-are-there-unwanted-borders Regards, Marc Schwartz On Jun 3, 2013, at 9

Re: [R] Why do tabs disappear when pasted into the R console?

2013-06-03 Thread Prof Brian Ripley
On 03/06/2013 14:48, peter dalgaard wrote: On Jun 3, 2013, at 15:22 , Sarah Goslee wrote: Pasting tabs into the console works for me on linux, which suggests that you need to provide more information about your OS and all the other usual things. Which console and which Linux? Anyways, the t

Re: [R] Strange behaviour of R graphics copied to PowerPoint

2013-06-03 Thread Viechtbauer Wolfgang (STAT)
I have come across this issue many times. I have yet to find a pattern in what causes this. At least I can offer a workaround. Instead of using "Save As" to create the pdf, what I do is "Print" with "Adobe PDF" as the printer. This gets rid of those lines and the resulting pdf looks just as nic

Re: [R] error about MCA

2013-06-03 Thread David Carlson
Probably because you have defined all of the variables as supplemental. These will then be estimated from the other variables, but there are no other variables. --- David L Carlson Associate Professor of Anthropology Texas A&M University College Station, TX 77840-43

Re: [R] Why do tabs disappear when pasted into the R console?

2013-06-03 Thread peter dalgaard
On Jun 3, 2013, at 15:22 , Sarah Goslee wrote: > Pasting tabs into the console works for me on linux, which suggests > that you need to provide more information about your OS and all the > other usual things. Which console and which Linux? Anyways, the thing that usually gets in the way is tab-

[R] split and common variables

2013-06-03 Thread Nico Met
Dear all, I would like to split the data based on the "place" and then would like to see how many "names" were common in place with corresponding "value" . Please find a demo file. Thanks for your expert comment best Nico > dput(dta) structure(list(place = structure(c(3L, 2L, 5L, 6L, 4L, 3L,

Re: [R] Why do tabs disappear when pasted into the R console?

2013-06-03 Thread Gabor Grothendieck
On Mon, Jun 3, 2013 at 9:24 AM, Tal Galili wrote: > My apologies Sarah, you are right, here: > > > sessionInfo() > R version 3.0.0 (2013-04-03) > Platform: i386-w64-mingw32/i386 (32-bit) > > locale: > [1] LC_COLLATE=Hebrew_Israel.1255 LC_CTYPE=Hebrew_Israel.1255 > LC_MONETARY=Hebrew_Israel.1255

Re: [R] Calculating Mean

2013-06-03 Thread Rui Barradas
Hello, Try aggregate(latency ~ state + conditionNo + subject, data = dat, FUN = mean) Rui Barradas Em 03-06-2013 12:29, Laura Thomas escreveu: Hi, Thanks all for the help. I have used the dput function which I have posted below. What I am trying to do is calculate the mean latency for each

Re: [R] Calculating Mean

2013-06-03 Thread Ivan Calandra
Hi again Laura, Let's say your data.frame is called df, just run this: aggregate(latency~subject+conditionNo+state, data=df, FUN=mean) I think this is what you're looking for. For help, check ?aggregate and ?formula. HTH, Ivan -- Ivan CALANDRA Université de Bourgogne UMR CNRS/uB 6282 Biogéosci

Re: [R] Why do tabs disappear when pasted into the R console?

2013-06-03 Thread Tal Galili
My apologies Sarah, you are right, here: sessionInfo() R version 3.0.0 (2013-04-03) Platform: i386-w64-mingw32/i386 (32-bit) locale: [1] LC_COLLATE=Hebrew_Israel.1255 LC_CTYPE=Hebrew_Israel.1255 LC_MONETARY=Hebrew_Israel.1255 [4] LC_NUMERIC=C LC_TIME=Hebrew_Israel.1255 atta

Re: [R] Why do tabs disappear when pasted into the R console?

2013-06-03 Thread Sarah Goslee
Pasting tabs into the console works for me on linux, which suggests that you need to provide more information about your OS and all the other usual things. Sarah On Mon, Jun 3, 2013 at 9:15 AM, Tal Galili wrote: > Hello Dear R-help Members, > > I have noticed that when pasting text with "tab" in

[R] Why do tabs disappear when pasted into the R console?

2013-06-03 Thread Tal Galili
Hello Dear R-help Members, I have noticed that when pasting text with "tab" in it to the R console it eliminates the tab. Whereas, when pasted into the R Editor, the tab is preserved. For example, pasting this: "1997 7680" In the R Console will result in: "19977680" Is there a way to preserve the

Re: [R] Scale package change comma defaults?

2013-06-03 Thread John Kane
Thanks Ben, I did just that after getting Duncan's reply. I should have seen it myself but for some reason thought I could treat it as an option. Myopia at its best. John Kane Kingston ON Canada > -Original Message- > From: bbol...@gmail.com > Sent: Sun, 2 Jun 2013 20:57:58 + > To:

Re: [R] How to compute a P-value for a complex mixture of chi-squared distributions in R

2013-06-03 Thread Terry Therneau
You need to be more explicit about what you are doing. For this problem: y = (x1 + x2)/2 where x1 and x2 are chi-square random variables, you want to use the pchisqsum() routine found in the survey package. This is not a trivial computation. For the alternate problem where y is a random ch

Re: [R] Strange behaviour of R graphics copied to PowerPoint

2013-06-03 Thread Jeff Newmiller
I have not seen this particular problem, but I have seen other problems and I tend to export bitmaps or pdf files as a result. Note that a reproducible example is usually required to to obtain help on this list, and posting in HTML format is bad because it mutilates example code, so fix your em

Re: [R] Strange behaviour of R graphics copied to PowerPoint

2013-06-03 Thread Kevin Wright
I've had something similar and have had better luck using the PrimoPDF software to "Print" a PowerPoint to a PDF device instead of saving from PowerPoint to PDF. Best, Kevin On Sun, Jun 2, 2013 at 12:15 PM, Erling Johan Frøysa < erling.fro...@gmail.com> wrote: > Hello, > > I am using R to cre

Re: [R] Calculating Mean

2013-06-03 Thread arun
Hi, May be this is what you wanted: dat2: dataset library(plyr) res1<-ddply(dat2,.(subject,conditionNo,state),summarize,MLat=mean(latency)) res1  #subject conditionNo state MLat #1    1   1 1 674.8947 #2    1   1 2 649.5000 #3    1   1 3 662.63

Re: [R] Calculating Mean

2013-06-03 Thread Laura Thomas
Hi, Thanks all for the help. I have used the dput function which I have posted below. What I am trying to do is calculate the mean latency for each state(1-8), in each condition (1-10), for each participant (n=13). I know for this to be most efficient I would need some form of loop, but this is

Re: [R] Calculating Mean

2013-06-03 Thread arun
HI,You could also try: set.seed(24) dat1<- data.frame(Reaction_time=sample(24:60,80,replace=TRUE),Categ=rep(1:8,each=10)) with(dat1,tapply(Reaction_time,list(Categ),FUN=mean)) #   1    2    3    4    5    6    7    8 #43.7 39.8 37.5 42.7 33.9 42.3 43.2 40.0 #or library(plyr)  ddply(dat1,.(Categ

Re: [R] Calculating Mean

2013-06-03 Thread Rui Barradas
Hello, Like Ivan said, you should give us a data example, the best way is to do it is to paste the output of ?dput in a post. If your data frame is named 'dat' use the following. dput(head(dat, 50)) # paste the output of this in a post As for the question, here is an example using ?aggregat

Re: [R] Calculating Mean

2013-06-03 Thread Ivan Calandra
Hi Laura, I think you're looking for aggregate() See ?aggregate If you had posted a reproducible example, I could have given you a more detailed answer. Learn to use the dput() function to do so. If you're very new to R, maybe this could help you get started: http://www.burns-stat.com/document

[R] Calculating Mean

2013-06-03 Thread Laura Thomas
Hi All, Sorry about this quite basic, but I am very new to R. I have a data file which has a dependent variable (reaction time) and a couple of independent variables, one of which is coded 1-8; I want to calculate the reaction time for each of the 8 codes of the independent variable. Thanks fo

Re: [R] 3.0.1 update and compiler package

2013-06-03 Thread Pascal Oettli
My mistake, Regards, Pascal On 06/03/2013 04:37 PM, Uwe Ligges wrote: On 03.06.2013 07:19, Pascal Oettli wrote: Hi, How did you upgraded your version of R? From source or from a Linux package? Actually the new R installation is just broken. It simply has to be reinstalled carefully (watch

Re: [R] 3.0.1 update and compiler package

2013-06-03 Thread Uwe Ligges
On 03.06.2013 07:19, Pascal Oettli wrote: Hi, How did you upgraded your version of R? From source or from a Linux package? Actually the new R installation is just broken. It simply has to be reinstalled carefully (watch for errors). Best, Uwe Ligges Regards, Pascal On 05/31/2013