Re: [R] Hide return values

2013-11-18 Thread Chris89
Awesome, thanks! -Chris -- View this message in context: http://r.789695.n4.nabble.com/Hide-return-values-tp4680611p4680666.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list

Re: [R] Extract values from vector and repeat by group

2013-11-18 Thread Benjamin Gillespie
Brilliant - thanks for all the really useful suggestions, problem = solved. Many thanks, Ben Gillespie, Research Postgraduate o---o School of Geography, University of Leeds, Leeds, LS2 9JT

[R] Anova split by factors

2013-11-18 Thread catalin roibu
Hello R-users, I have a problem with Anova in R and I don't know how to solve that. I want to compute Anova for each experiment (exp). I try this code: test-lapply(split(eg,eg$Exp),function(x) aov(masa.uscat.tr ~ Clona,data = x)) or test-by(eg,eg$Exp, function(x) aov(masa.uscat.tr~Clona,data=x))

Re: [R] Anova split by factors

2013-11-18 Thread ONKELINX, Thierry
Dear Catalin, Have a look at the plyr package. library(plyr) dlply( eg, .(Exp), function(x) { aov(masa.uscat.tr~Clona,data=x) } ) Best regards, ir. Thierry Onkelinx Instituut voor natuur- en bosonderzoek / Research Institute for Nature and

[R] Rotation of parallel lines

2013-11-18 Thread Tonio
Dear list, Consider these two parallel segments in a plot. plot(c(1, 6), c(2, 2), type=n, xlim=c(0, 7), ylim=c(-2, 6)) segments(1, 1, 6, 1) segments(1, 3, 6, 3) How can I rotate the two lines together by a defined angle? Thank you all in advance. Best, Antonio

[R] Sending a matrix in an email

2013-11-18 Thread Ira Fuchs
I have a matrix which has colnames and I would like to send this matrix using sendmailR. How can I convert this simple matrix to a format which can be used as the body variable in sendmailR? I see how I can create a file attachment using mime_part but I would like to send the matrix in the body

Re: [R] R Beginner - Need Perhaps 5 - 10 Minutes of R User Time to Learn Few Basics

2013-11-18 Thread PIKAL Petr
Hi -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-bounces@r- project.org] On Behalf Of Zach Feinstein Sent: Wednesday, November 13, 2013 2:57 PM To: r-help@r-project.org Subject: [R] R Beginner - Need Perhaps 5 - 10 Minutes of R User Time to Learn Few Basics

Re: [R] Sending a matrix in an email

2013-11-18 Thread ONKELINX, Thierry
Have you tried dput(your.matrix)? ir. Thierry Onkelinx Instituut voor natuur- en bosonderzoek / Research Institute for Nature and Forest team Biometrie Kwaliteitszorg / team Biometrics Quality Assurance Kliniekstraat 25 1070 Anderlecht Belgium + 32 2 525 02 51 + 32 54 43 61 85

Re: [R] Sending a matrix in an email

2013-11-18 Thread Sarah Goslee
What about dput()? On Mon, Nov 18, 2013 at 8:35 AM, Ira Fuchs irafu...@gmail.com wrote: I have a matrix which has colnames and I would like to send this matrix using sendmailR. How can I convert this simple matrix to a format which can be used as the body variable in sendmailR? I see how I

Re: [R] Extract values from vector and repeat by group

2013-11-18 Thread PIKAL Petr
Hi probably not most elegant and also not general but rep(df$var[df$time==4],rle(df$group)$lengths) or rep(df$var[df$time==4], sapply(split(df$var,df$group), length)) shall give you desired vector. Regards Petr -Original Message- From: r-help-boun...@r-project.org

Re: [R] R for a stats intro for undergrads in the US?

2013-11-18 Thread Liviu Andronic
Dear Spencer, In case you have similar questions you may want to ask them on r-sig-teaching, which deals specifically with such topics. Regards, Liviu On Sun, Nov 17, 2013 at 3:19 AM, Spencer Graves spencer.gra...@prodsyse.com wrote: Hello, All: Would anyone recommend R for an

Re: [R] Sending a matrix in an email

2013-11-18 Thread Suzen, Mehmet
On 18 November 2013 05:37, Ira Fuchs irafu...@gmail.com wrote: I have a matrix which has colnames and I would like to send this matrix using sendmailR. How can I convert this simple matrix My 1 cent; In case of large objects or full session, suitable for attachment; RData might be more

Re: [R] Sending a matrix in an email

2013-11-18 Thread Ira Fuchs
Thanks for the suggestion. I just tried dput and it did not produce what sendmailR requires for the body parameter. Here is a simplified version of what I need to do: x=matrix(c(1,2,3),1,3) x [,1] [,2] [,3] [1,]123 colnames(x)=c(a,b,c) x a b c [1,] 1 2 3 dput(x)

[R] Simulation study in R for categorical repeated measures data

2013-11-18 Thread Buddhini Gawarammana
Hi everyone, I am interested in doing a study to compare three analyzing methods namely, ANOVA, GEE and multilevel approach for *categorical repeated measures data using a simulation study in R*. I am not an expert in R but I know some preliminaries in R. Therefore I am desperately looking for

[R] Holt Winters for multiple customers and output with R

2013-11-18 Thread Martin, Nick
So I've been working through the HW work here http://a-little-book-of-r-for-time-series.readthedocs.org/en/latest/src/timeseries.html and have started testing with some live customer data. I have a dataset that looks like: CustomerID | Sales 123456 $5,000 123456 $3,455

Re: [R] Rotation of parallel lines

2013-11-18 Thread David Winsemius
On Nov 18, 2013, at 7:27 AM, Tonio wrote: Dear list, Consider these two parallel segments in a plot. plot(c(1, 6), c(2, 2), type=n, xlim=c(0, 7), ylim=c(-2, 6)) segments(1, 1, 6, 1) segments(1, 3, 6, 3) How can I rotate the two lines together by a defined angle? Base graphics do not

[R] Providing a Title for a Write.Table - Thinking of Titles in SPSS CTABLES

2013-11-18 Thread Zach Feinstein
I understand how I may use message() to provide some output on which run I will be looking at. However, I wish to automate it, and have it written out to a tab-delimited file. Below is the command to output my coefficients: write.table(zbetas, file = z_coeffs.csv, sep=\t, append = TRUE) I do

Re: [R] issues with calling predict.coxph.penal (survival) inside a function

2013-11-18 Thread julian.bothe
Hello, and thanks for the answer. 1) I found a work-around - in the end it is easier than thought before. The only thing you have to do is to have the same variable name with the new values. So if predict(coxph.penal.fit, newdata[subset,]) does not work inside a function, the following works:

Re: [R] Extract values from vector and repeat by group

2013-11-18 Thread arun
Hi, I would also add an index to make it work for groups that doesn't have time=4. df1 - df[-12,] fun1 - function(dat,n) {  indx - with(dat,tapply(time==n,group,FUN=any))  indx2 - with(dat,ave(time==n,group,FUN=any))  dat[indx2,new] - rep(dat$var[dat$time==n],rle(dat$group)$lengths[indx])

Re: [R] Sending a matrix in an email

2013-11-18 Thread David Winsemius
On Nov 18, 2013, at 8:30 AM, Ira Fuchs wrote: Thanks for the suggestion. I just tried dput and it did not produce what sendmailR requires for the body parameter. Here is a simplified version of what I need to do: x=matrix(c(1,2,3),1,3) x [,1] [,2] [,3] [1,]123

[R] Tukey test for anavo split by multiples factors

2013-11-18 Thread catalin roibu
Hello all! I have a problem with Anova in R and I don't know how to solve that. I want to compute Anova for each experiment (exp). I use this code: test-lapply(split(eg,eg$Exp),function(x) aov(masa.uscat.tr ~ Clona,data = x)) or test-by(eg,eg$Exp, function(x) aov(masa.uscat.tr~Clona,data=x)) I

Re: [R] Sending a matrix in an email

2013-11-18 Thread Ira Fuchs
That's the ticket! So many functions…so little time. Thanks to everyone. On Nov 18, 2013, at 9:47 AM, David Winsemius wrote: On Nov 18, 2013, at 8:30 AM, Ira Fuchs wrote: Thanks for the suggestion. I just tried dput and it did not produce what sendmailR requires for the body parameter.

Re: [R] Sending a matrix in an email

2013-11-18 Thread Carl Witthoft
I think it'd be easier and safer to save the matrix, either as an .Rdata binary or as a text file, zip that file, and use the sendmailR tools to attach the file to your message. Fuchs Ira-3 wrote I have a matrix which has colnames and I would like to send this matrix using sendmailR. How can I

Re: [R] Sending a matrix in an email

2013-11-18 Thread Jeff Newmiller
You have not provided the minimal reproducible code that the footer of this email asks for, so we are playing 20 questions. Perhaps you should convert the matrix to a data frame? Or is this an example of FAQ 7.16? --- Jeff

Re: [R] creating upper triangular matrix

2013-11-18 Thread Carl Witthoft
OK, I'm pre-coffee, but what's wrong with using upper.tri to create a new matrix and then multiplying that matrix by the original dat matrix (direct multiplication, not matrix multiply) to get the desired answer? Bert Gunter wrote I believe matrix indexing makes Arun's complex code wholly

Re: [R] Sending a matrix in an email

2013-11-18 Thread Ira Fuchs
I thought that I had provided an example of what I wanted to do but in any case, capture.output seems to work, as in sendmailR(to,from, capture.output(matrix_to_send)) I'm sure that there are myriad other ways (I tried print, which is mentioned in FAQ 7.16 but it doesn't work in this context)

Re: [R] Rotation of parallel lines

2013-11-18 Thread Carl Witthoft
See my answer at Stack Overflow -- repeated here for anyone else who wants a trivial function. # coordinate transform: cartesian plane rotation xyrot-function(pairs,ang){ # pairs must be Nx2 matrix w/ x in first column and y in second xrot - pairs[,1]*cos(ang) - pairs[,2]*sin(ang)

Re: [R] Sending a matrix in an email

2013-11-18 Thread Jeff Newmiller
You provided examples of what you wanted, but not examples where the same code in a different context failed to provide the result you wanted. Reproducible means reproduces the problem. --- Jeff Newmiller

Re: [R] Sending a matrix in an email

2013-11-18 Thread Ira Fuchs
I understand what you are saying. I just didn't think that showing a sendmailR with a matrix as the body of the message would have been very helpful since it is the fact that the received email has no content that is the problem and that would not have shown up in the R console output. On Nov

Re: [R] quotation marks and scan

2013-11-18 Thread MacQueen, Don
I know you have a solution, but I would have suggested using print() with quote=FALSE as a better way to illuminate what is going on, as in this example: foo - 'bahbah' foo [1] bah\bah print(foo) [1] bah\bah print(foo, quote=FALSE) [1] bahbah As others said, the backslash isn't really there.

[R] multilevel sampling weight

2013-11-18 Thread Pablo Menese Camargo
Anyone is working with the upgrade of any multilevel package for apply sampling weights? Thanks [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting

Re: [R] Sending a matrix in an email

2013-11-18 Thread Jeff Newmiller
No, sorry to flog a dead horse, but you do not appear to get it yet and you really should understand this concept. The minimal reproducible example would have been R code that we could run that generated an email that you think should have the matrix in it, but does not. In practically all

[R] Setting axis scale for a boxplot

2013-11-18 Thread David Arnold
Hi, I have this code: par(mfrow=c(3,1)) x1=rnorm(10,60,1) x2=rnorm(10,65,1) x3=rnorm(10,70,1) boxplot(x1,x2,x3,horizontal=TRUE,main=Example 1) x1=rnorm(10,60,4) x2=rnorm(10,65,4) x3=rnorm(10,70,4) boxplot(x1,x2,x3,horizontal=TRUE,main=Example 2) x1=rnorm(10,60,9) x2=rnorm(10,65,9)

Re: [R] Setting axis scale for a boxplot

2013-11-18 Thread William Dunlap
How can I set the horizontal axis limits on all three images to be the same for sake of comparison? Add ylim=c(dataMin, dataMax) to each call to boxplot(), where you specify values for dataMin and dataMax so their range is likely to cover all your data. ('ylim', not 'xlim' - the

Re: [R] Setting axis scale for a boxplot

2013-11-18 Thread Jim Lemon
On 11/19/2013 05:57 AM, David Arnold wrote: Hi, I have this code: par(mfrow=c(3,1)) x1=rnorm(10,60,1) x2=rnorm(10,65,1) x3=rnorm(10,70,1) boxplot(x1,x2,x3,horizontal=TRUE,main=Example 1) x1=rnorm(10,60,4) x2=rnorm(10,65,4) x3=rnorm(10,70,4) boxplot(x1,x2,x3,horizontal=TRUE,main=Example 2)

[R] Reading in csv data with ff package

2013-11-18 Thread Nick McClure
I've spent some time trying to wrap my head around reading in large csv files with the ff-package. I think I know how to do it, but am bumping into some problems. I've tried to recreate the issues as best as I can with a smaller example and maybe someone can help explain the problems. The

[R] Passing parameters in a user defined function to another function using ...

2013-11-18 Thread Lopez, Dan
Hi R Experts, How do you get the ... to work in a user-defined function such as the one I have below? For example if I want to pass replace=TRUE to the sample function. # This is a sample function that generates x rows of z numbers out of y. Basically a lottery style data set.

[R] How can I get seasonal variation table from generalized additive mixed models in R?

2013-11-18 Thread kmmoon100
Hello everyone, I used a function called gamm in mgcv in R program to investigate seasonal variation of wind speed based on 13 years of measurement dataset. I would like to use this variation in my formula for my study but as I am new in R, it's extremely hard to find values on y-axis.. too many

Re: [R] Passing parameters in a user defined function to another function using ...

2013-11-18 Thread Lopez, Dan
Thanks Ben. I feel really dumb. I did enter '...' in my sample function in another version of this function. But I just realized I had only done it for the second occurrence of the sample function and not the first. Dan -Original Message- From: Ben Tupper [mailto:btup...@bigelow.org]

[R] 3D Plot of Convex hull

2013-11-18 Thread wwreith
I have a data set in which I am trying to plot a convex hull in 3 dim. Below is a subset of the points I would use. Columns 2,3,4 are my x,y,z coordinates. I found some ways to plot 2D convext hulls or find a convex hull for higher dimensions, but not how to plot the data. I have have attached

Re: [R] Passing parameters in a user defined function to another function using ...

2013-11-18 Thread Richard M. Heiberger
numbs - rbind(numbs, sort(sample(y, z, ... ))) See ?Reserved which sends you to 'Introduction to R' Rich On Mon, Nov 18, 2013 at 8:52 PM, Lopez, Dan lopez...@llnl.gov wrote: Hi R Experts, How do you get the ... to work in a user-defined function such as the one I have below? For example

[R] find variation of a binary matrix

2013-11-18 Thread email
Hi: I want to calculate how much the values in a binary matrix varies, and for that I apply the sd() method. mat - matrix(c(1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1), nrow=4, ncol=3) stddev - sd(dist(mat, method=binary)) And i get the following answer: stddev [1] 0.3442652 Is this correct? Or

[R] How to convert a 3 dimensional List to make a table with tables tabular()?

2013-11-18 Thread Beckstrand, Janis, NCOD
I have information in a 3 dimensional list that I want to use to create a table for a written report. The 3d list was created by applying the epiR function epitest to a list of 8 2x2 tables using lapply. The resulting list gives the 12 statistics with CIs, that generated by epitest,

Re: [R] reshape data frame

2013-11-18 Thread tsippel
Thanks, that seems to work. On Fri, Nov 15, 2013 at 10:26 PM, arun kirshna [via R] ml-node+s789695n4680556...@n4.nabble.com wrote: Hi, Try: var1 - load(reshape_data.frame.RData) ##It is better not to name the objects with function names. dat1 - data reshape1 - reshape

Re: [R] Passing parameters in a user defined function to another function using ...

2013-11-18 Thread Ben Tupper
Hi, It's easy, just carry the arguments in '…' forward to where you expect to pass them along. mynumbs-function(x,y,z=5,...){ numbs-sort(sample(y,z, ...)) for (i in 1:(x-1)) numbs-rbind(numbs,sort(sample(y,z, ...))) print(numbs) } Cheers, Ben On Nov 18, 2013, at 8:52 PM, Lopez, Dan

[R] equal horizontal and vertical proportions in graphics

2013-11-18 Thread Mercutio Florid
I use several different versions of R, including RGui on Windows and rstudio on Linux.  In all cases, I use graphical commands, such as image().  image() displays rectangles, but I want to be able to guarantee that the heights of those rectangles will always equal the widths.  Typically, the