Re: [R] transform table to matrix

2011-03-02 Thread Scott Chamberlain
Agreed Peter: weird. What is the purpose of your inquiry SK? And why is your inquiry so similar to the one at the hyperlink I provided? Scott On Wednesday, March 2, 2011 at 6:10 PM, P Ehlers wrote: > Scott Chamberlain wrote: > > This thread seems freakishly similar to what you are askingSco

[R] Non-conformable arrays

2011-03-02 Thread Gregory Ryslik
Hi Everyone, I'm running some simulations where eventually I need to table the results. The problem is, that while most simulations I have at least one predicted outcome for each of the six possible categories, sometimes the algorithm assigns all the outcomes and one category is left out. Thus

Re: [R] how to delete empty levels from lattice xyplot

2011-03-02 Thread Dennis Murphy
Hi: On Wed, Mar 2, 2011 at 1:52 PM, John Smith wrote: > Hello All, > > I try to use the attached code to produce a cross over plot. There are 13 > subjects, 7 of them in for/sal group, and 6 of them in sal/for group. But > in > xyplot, all the subjects are listed in both subgraphs. Could anyone

Re: [R] Non-conformable arrays

2011-03-02 Thread Bill.Venables
Here is one way. 1. make sure y.test is a factor 2. Use table(y.test, factor(PredictedTestCurrent, levels = levels(y.test)) 3. If PredictedTestCurrent is already a factor with the wrong levels, turn it back into a character string vector first. -Original Message- From: r-help-boun

[R] What am I doing wrong with this loop ?

2011-03-02 Thread eric
What is wrong with this loop ? I am getting an error saying incorrect number of dimensions y[i,2] x <- as.data.frame(runif(2000, 12, 38)) z <-numeric(length(x)) y <- as.data.frame(z) for(i in 1:length(x)) { y <- ifelse(i < 500, as.data.frame(lowess(x[1:i,1], f=1/9)) , as.data.frame(lowess(x[(i-

Re: [R] What am I doing wrong with this loop ?

2011-03-02 Thread Bill.Venables
Here is a start > x <- as.data.frame(runif(2000, 12, 38)) > length(x) [1] 1 > names(x) [1] "runif(2000, 12, 38)" > Why are you turning x and y into data frames? It also looks as if you should be using if(...) ... else ... rather than ifelse(.,.,), too. You need to sort out a few issues, it se

Re: [R] Non-conformable arrays

2011-03-02 Thread Gregory Ryslik
Perfect! Thank you! On Mar 2, 2011, at 10:55 PM, wrote: > Here is one way. > > 1. make sure y.test is a factor > > 2. Use > > table(y.test, > factor(PredictedTestCurrent, levels = levels(y.test)) > > 3. If PredictedTestCurrent is already a factor with the wrong levels, turn it > back in

Re: [R] how to delete empty levels from lattice xyplot

2011-03-02 Thread P Ehlers
Dennis Murphy wrote: Hi: On Wed, Mar 2, 2011 at 1:52 PM, John Smith wrote: Hello All, I try to use the attached code to produce a cross over plot. There are 13 subjects, 7 of them in for/sal group, and 6 of them in sal/for group. But in xyplot, all the subjects are listed in both subgraphs.

Re: [R] Creating a weighted sample - Help

2011-03-02 Thread P Ehlers
LouiseS wrote: Hi I'm new to R and most things I want to do I can do but I'm stuck on how to weight a sample. I have had a look through the post but I can't find anything that addresses my specific problem. I am wanting to scale up a sample which has been taken based on a single variable (perf

[R] read a text file with variable number of spaces

2011-03-02 Thread Gregory Ryslik
Hi, I seem to be having somewhat of an unusual data input problem with some of the data sets I'm working with and want to run a simulation on. in the first data set I'm looking at, I have a text file where the spacing between columns varies. I've attached a snippet. Is there a way to read this

<    1   2