Re: [R] Counting the loop-round of a "for"-loop

2012-02-13 Thread 538280
Consider using sapply instead of a for loop, if the code in the sapply call returns a vector, and every vector is the same length, then sapply will automatically form it into a matrix for you. On Sun, Feb 12, 2012 at 12:30 PM, jolo999 wrote: > It seems to work. Simple and effective! > > Thanks! >

Re: [R] apply pairs function to multiple columns in a data frame

2012-02-10 Thread 538280
You might find the pairs2 function in the TeachingDemos package useful. On Fri, Feb 10, 2012 at 1:13 PM, jarvisma wrote: > I am very new to R and programming and thank you in advance for your patience > and help with a complete novice! > > I am working with a large multivariate data set that has

Re: [R] Split dataframe into new dataframes

2012-02-10 Thread 538280
I think one of your problems (the others have been addressed by others) is that you want the expression x$y to represent a column of x whose name is stored in y (not the name y itself). The problem here is that the $ notation is a magical shortcut and like any other magic if used incorrectly is li

Re: [R] How indices calculated in package "boot"

2012-02-10 Thread 538280
In your second example the boot function will still generate its random indicies before your internal function calls sample, so the seed will be different when you call sample from what you originally set it to. If you really want to know what the boot function does, look at its code (it does some

Re: [R] How to stop a loop for?

2012-02-10 Thread 538280
If you want to pause for the person to look at a plot before going on to the next plot then just do: > par(ask=TRUE) This will actually allow your loop to continue with calculations while the user looks at the plot but will pause before drawing the next plot (hitting enter in the command window o

Re: [R] How to have columns lined up?

2012-02-10 Thread 538280
A little more on topic is that there are tools for R to nicely format output. The simplest is probably the R2wd package which will transfer objects and text to word, you can send a matrix or data frame to word as a nicely formatted table or wdVerbatim will send output to word but make sure that th

Re: [R] Fitting polynomial (power greater than 2)

2012-02-09 Thread 538280
This looks like homework, which is generally discouraged here. You should at the least admit that it is homework and tell what resources your teacher has OK'd you to use. Since you did show what you have done so far and are not just asking for a handout, here is a hint: ?poly On Tue, Feb 7, 201

Re: [R] Positioning text in top left corner of plot

2012-02-07 Thread 538280
You might want to look at the grconvertX and grconvertY functions. You can use them to convert a coordinate relative to the plotting device (screen, paper) or plotting region to user coordinates to use with text or mtext. On Tue, Feb 7, 2012 at 4:06 AM, Manta wrote: > Dear all, > > another questi

Re: [R] text command - how to get a white background to cover grid lines

2012-02-06 Thread 538280
An alternative is the shadowtext function in the TeachingDemos package. On Mon, Feb 6, 2012 at 1:19 AM, Jim Lemon wrote: > On 02/06/2012 08:23 AM, Henry wrote: >> >> New to R - rookie question. >> I'm a mechanical engineer and enjoying using R to make high quality >> graphs. >> >> I've searched.

Re: [R] Clear last x entries of R console

2012-02-03 Thread 538280
You may want to look at functions like: txtProgressBar, winProgressBar (windows onnly), or tkProgressBar (tcltk package), rather than reinventing the wheel. On Fri, Feb 3, 2012 at 7:00 AM, angliski_jigit wrote: > Hi All, > > I am trying to build in a progress-tracker into my loops that let me hav

Re: [R] an unusual use for R

2012-02-03 Thread 538280
Nice, Last year I found that my office needed some decoration and my wife has some fancy sewing machines that can be programmed to do embroidery and cross-stitch. So I designed some cross stitches (using R and the program for the machines) that show distribution functions and equations for the Ce

Re: [R] Vertical string with horizontal letters

2012-02-02 Thread 538280
There are only a few graphics devices that honor the 'crt' setting to rotate characters differently from the string rotation (postscript is the only one I know of, and then not always). For your specific case you could do something like: > text(1,1, paste( unlist(strsplit('output','')), collapse=