[R] Weka on command line c.f. using RWeka

2012-11-11 Thread Patrick Connolly
Running Weka's command line with calls to system(), like this > system("java weka.classifiers.bayes.NaiveBayes -K -t HWlrTrain.arff -o") === Confusion Matrix === ab <-- classified as 3518 597 |a = NoSpray 644 926 |b = Spray === Stratified cross-validation === === Confus

Re: [R] Looking for a test of standard normality

2012-11-11 Thread Rolf Turner
This is making less and less sense to me as time goes on. (1) The ranks of the small sample within the combined sample have *integer* values and will not be distributed (under the null hypothesis or otherwise) according to a *continuous* uniform distribution. Hence applying qnorm() makes no se

Re: [R] arrange data

2012-11-11 Thread arun
HI, I think it would be better to store this as a list. For example: list1<- list(kuantan.dt[kuantan.dt[,2]==11,],kuantan.dt[kuantan.dt[,2]==12,]) If you wanted to delete 31 December and do column bind: res<-cbind(kuantan.dt[kuantan.dt[,2]==11,], kuantan.dt[kuantan.dt[,2]==12 & kuantan.dt[,3]

Re: [R] Looking for a test of standard normality

2012-11-11 Thread creativityofnat...@gmail.com
--- Original Message --- From: Bert Gunter Sent: November 12, 2012 11/12/12 To: Herschtal Alan Cc: r-help@r-project.org Subject: Re: [R] Looking for a test of standard normality Well... On Sun, Nov 11, 2012 at 6:12 PM, Herschtal Alan wrote: > Thanks for your response. The background is that

Re: [R] R Premanently Occupy Server Memory

2012-11-11 Thread Jeff Newmiller
R uses memory. That may lead to large virtual memory allocation, with a consequently large paging file. Managing paging files is an operating-system-specific system administration skill, not an R issue. Depending on the algorithms you are using in R, you may be able to pick more memory efficien

Re: [R] FW: Two-line title in R legend

2012-11-11 Thread David L Carlson
The top line is not outside the box in this example, but the bottom text line is too close to the bottom. You can turn off drawing the box in legend(). Store the return value of legend() which indicates where the box would have been drawn and use rect() to add it after increasing the dimension you

Re: [R] Looking for a test of standard normality

2012-11-11 Thread Bert Gunter
Well... On Sun, Nov 11, 2012 at 6:12 PM, Herschtal Alan wrote: > Thanks for your response. The background is that I am trying to test > whether a small sample and a much larger sample actually came from the > same distribution. As this is logically impossible, I suggest you go back to basic stat

[R] Question about MICE and Amelia II

2012-11-11 Thread Kamontip Srihaset
Dear all, I am Ph.D student at Chulalongkorn University in Thailand, I use package 'MICE' and 'Amelia II' to impute missing data assump MAR and MNAR. I don't have problem to impute under MAR, but I don't know how to impute MNAR. My MNAR data generate under IRT model(3-PL); n<-500 ## number of

Re: [R] arrange data

2012-11-11 Thread Felipe Carrillo
Something like this...untested I think cbind recicles the last value(31) since nov and dec are of different length nov <- kuantan.dt[(kuantan.dt$Bulan >=11);nov dec <- kuantan.dt[(kuantan.dt$Bulan >=12);dec both <- cbind(nov,dec) # get the first 30 records both <- head(both,30);both Felipe D. Ca

[R] R Premanently Occupy Server Memory

2012-11-11 Thread Suphajak Ngamlak
Could anyone please point me to the location of the temp memory that R occupy in Window Server 2008 R2? After we finished running many R codes, our server memory (C: drive) become full and currently our only solution is to restart server. We would really appreciate if anyone can suggest how we

Re: [R] Looking for a test of standard normality

2012-11-11 Thread Herschtal Alan
Thanks for your response, however it seems to me that the Anderson-Darling Test and the Shapiro-Wilk test are both tests of composite normality, at least as implemented in R. I.e. they test whether it is reasonable to assume that the data came from any normal distribution, not specifically the stan

[R] FW: Two-line title in R legend

2012-11-11 Thread Gabriel Toro
Hi, I am trying to use a legend title that is a bit too long for one line. To try to break the title in two lines, I am using legend (title="Top of Title\nbottom of title", etc. ) R prints the title as two lines, but the top line is outside the legend box. How can I trick the R legend func

[R] ~

2012-11-11 Thread shihyu
HI all, In my design, I have factors A and B, and dependent variable DV, and the covariate variable is CV. It's a within-subject design so the subject variable is Sub. When I ran ANOVA, I used: anova=aov(DV~A*B+Error(Sub/A*B),data=data) What should I do to include the covariate CV to run an ANCO

Re: [R] Looking for a test of standard normality

2012-11-11 Thread Herschtal Alan
Thanks for your response. The background is that I am trying to test whether a small sample and a much larger sample actually came from the same distribution. I could just perform a KS test on the 2 samples, but as I said, ideally I'd like a test that is more powerful than that. So I look at the pe

[R] arrange data

2012-11-11 Thread Roslina Zakaria
Dear r-users,   I have daily rainfall data from 1971 to 2000.  I would like to extract november and december data only.  I would also like to do column bind for november and december, therefore I would like to delete 31 December from december data so that the length of november and december are

Re: [R] 3d plotting from a 2d array

2012-11-11 Thread Duncan Murdoch
On 12-11-11 7:08 PM, Jake Roth wrote: Hi, I'm new to R and am learning the ropes of r-help and programming. I'm attempting to plot a 2-D mesh in 3-D using the persp function. I've positioned the graph using phi and theta, but I'm having trouble overlaying color onto the actual surface accordin

[R] 3d plotting from a 2d array

2012-11-11 Thread Jake Roth
Hi, I'm new to R and am learning the ropes of r-help and programming. I'm attempting to plot a 2-D mesh in 3-D using the persp function. I've positioned the graph using phi and theta, but I'm having trouble overlaying color onto the actual surface according to the surface's "z" values. I've tri

[R] Graphing a non-linear regresion line on a scatter plot.

2012-11-11 Thread Baigo
Hey I've been attempting to draw the non-parametric part of a regression on a scatter plot, with confidence intervals if possible. Even if I tried, I failed, reason why I'm asking here library(np) library(foreign) wage1 <- read.dta(file="PATH HERE\\wage1.dta") reg.np <- npplreg(lwage ~ female

Re: [R] biasing conditional sample

2012-11-11 Thread dms
Thanks for the solutions. Carlson's and Barradas's approaches give me what I need. Nonetheless, Carlson's proposal is slightly better for my purposes because it's shorter. Thanks Daniel > Can't you just use sample() on each row without replacement to guarantee > no > matches among the five (or m

Re: [R] biasing conditional sample

2012-11-11 Thread David L Carlson
Can't you just use sample() on each row without replacement to guarantee no matches among the five (or more) columns? set.seed(51) Data <- sapply(1:100, function(x) sample(1:10, size=5)) Data <- data.frame(t(Data)) names(Data) <- letters[1:5] -- David L

Re: [R] biasing conditional sample

2012-11-11 Thread arun
Hi, If the question is to remove the duplicates/repeated in each row from the example "data", then dat2<-data[apply(data,1,function(x) all(!duplicated(x)|duplicated(x,fromLast=TRUE))),] head(dat2) #   id a b  c d  e #6   6 9 5 10 1  7 #8   8 5 2  6 7  4 #11 11 6 4  9 8  5 #12 12 7 1  8 9 10 #15

Re: [R] Cropping a matrix by rows

2012-11-11 Thread Jeff Newmiller
I assiduously avoid automatically generating distinct objects, and recommend that you also do so. You have the data, and can refer to individual rows by index as you need them. --- Jeff NewmillerThe

Re: [R] biasing conditional sample

2012-11-11 Thread Rui Barradas
Hello, The function that follows returns a matrix, not a data.frame but does what you ask for. fun <- function(x, y, n){ f <- function(x, y){ while(TRUE){ rnd <- sample(x, 1) if(!any(rnd %in% y)) break } rnd } for(i in seq_len(n)){

Re: [R] How to include CI in a grouped barplot?

2012-11-11 Thread Thais Rangel
Thanks everyone. Thais Rangel Rio de Janeiro State University, Brazil [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.o

[R] biasing conditional sample

2012-11-11 Thread dms
Hi all, I'm looking for some help to bias the sample function. Basically, I'd like to generate a data frame where the first column is completely random, the second, however, is conditional do the first, the third is conditional to the first and the second and so on. By conditional I mean that I sh

Re: [R] multiple variable basic plot

2012-11-11 Thread David L Carlson
You have not said exactly what the problem is with the labels and thickness. For starters, putting 406 labels on the x axis is probably not going to produce anything legible. In your example, the row names seem to be years. Does your data span 406 years? As for line thickness, you have not specifie

Re: [R] Djjlölkjhfyn kb noknkkkkokljjyikkk hyjjjjjkjjjjkjkkpooololåååååååååååååååääääkkuiivjkoööklopipållällnbbbn mml ömmmm

2012-11-11 Thread Gustaf Granath
I concur with that. However, credit should go to my 4 year old daughter and iPhone's auto-correction function ;). Or maybe she was just trying to ask why lmer() doesnt give you P-values. Sorry for my original post. Cheers, Gustaf On 2012-11-11 18:37, Henrik Bengtsson wrote: > > > On Nov 11, 2

Re: [R] Multiplying elements of a list by rows of a matrix

2012-11-11 Thread William Dunlap
lapply(mapply(lapply(...))), along with making a vector out of a matrix then making a matrix out of it again seems like a pretty long-winded way of doing what is done by lapply(seq_along(X), function(i)tt[i,] %*% X[[i]]) or mapply(`%*%`, split(tt,row(tt))[1:3], X, SIMPLIFY=FALSE) (The exampl

[R] Cropping a matrix by rows

2012-11-11 Thread Hans Thompson
Hello r-help, I've been banging my head against the computer in an attempt to learn how to divide my matrix into segments by rows. I want to be able to return each segment as a newly named object. I've tried looking at the apply functions and creating a for loop but brain no work. Here's the bas

Re: [R] Multiplying elements of a list by rows of a matrix

2012-11-11 Thread Rui Barradas
Hello, I don't think he advantage here is speed but simplicity, lapply does it in one line of code. Rui Barradas Em 11-11-2012 18:02, Bert Gunter escreveu: Clemontina: As you have seen, the answer is yes, but my question is why bother? What's wrong with a for() loop? lapply() should offer no

Re: [R] Multiplying elements of a list by rows of a matrix

2012-11-11 Thread Bert Gunter
Clemontina: As you have seen, the answer is yes, but my question is why bother? What's wrong with a for() loop? lapply() should offer no advantage in speed over a loop. Vectorization could, but lapply() is not vectorization. -- Bert On Sun, Nov 11, 2012 at 8:33 AM, Clemontina Davenport wrote: >

Re: [R] Multiplying elements of a list by rows of a matrix

2012-11-11 Thread arun
Hi, In this case, you could try: res<-lapply(mapply(c,X,lapply(data.frame(t(tt[1:3,])),function(x) x),SIMPLIFY=FALSE),function(x) x[13:16]%*% matrix(x[1:12],ncol=3) ) res #[[1]]  #     [,1]  [,2]  [,3] #[1,] 14.27 16.65 10.12 #[[2]] #  [,1] [,2]  [,3] #[1,] 10.14 5.17 18.28 # #[[3]]  #    

Re: [R] Djjlölkjhfyn kb noknkkkkokljjyikkk hyjjjjjkjjjjkjkkpooololåååååååååååååååääääkkuiivjkoööklopipållällnbbbn mml ömmmm

2012-11-11 Thread Ted Harding
On 11-Nov-2012 17:09:24 peter dalgaard wrote: > On Nov 11, 2012, at 16:57 , Gustaf Granath wrote: >> >> M >> Påopklpnlbyjönvnmm >> M. Öplppkbkvöökä knbnnåöllpööåååtx hikkkhgxxx vj julöl > > Julöl? (Christmas beer) > > That would explain it, I suppose. "Don't drink and derive..." > > >>

Re: [R] Multiplying elements of a list by rows of a matrix

2012-11-11 Thread Rui Barradas
Hello, Thanks for the data example. Try lapply(seq_along(X), function(i) tt[i,] %*% X[[i]]) Hope this helps, Rui Barradas Em 11-11-2012 16:33, Clemontina Davenport escreveu: Hi all, I have the following code: set.seed(1) x1 <- matrix(sample(1:12), ncol=3) x2 <- matrix(sample(1:12), ncol=3) x

Re: [R] error message

2012-11-11 Thread Rui Barradas
Hello, Your example lacks the array BB and therefore is not reproducible. Anyway, making up BB <- structure(c(1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, 1, -1, -1, 1, 1, -1, -1, 1, 1, -1, -1, 1, 1, -1, -1, 1, -1, -1, 1, 1, -1, -1, 1, 1, -1, -1, 1, 1, -1, -1, 1, 1, 1, 1, 1, -1, -1

Re: [R] matrix of all difference between rows values

2012-11-11 Thread arun
Hi,  I tried with another example and was able to understand the error.  Sorry, I didn't test the code to other situations. For example: vec1<-c(8,7,10,15,1,3,6) #According to my first solution: res1<-apply(toeplitz(vec1),1,function(x) vec1[1]-x)  res1 # [,1] [,2] [,3] [,4] [,5] [,6] [,7] #

Re: [R] Djjlölkjhfyn kb noknkkkkokljjyikkk hyjjjjjkjjjjkjkkpooololåååååååååååååååääääkkuiivjkoööklopipållällnbbbn mml ömmmm

2012-11-11 Thread peter dalgaard
On Nov 11, 2012, at 16:57 , Gustaf Granath wrote: > > > M > Påopklpnlbyjönvnmm > M. Öplppkbkvöökä knbnnåöllpööåååtx hikkkhgxxx vj julöl Julöl? (Christmas beer) That would explain it, I suppose. "Don't drink and derive..." > > Sent from my iPhonejukujöbömjl jnmnmmm > Sorry for keepi

Re: [R] changing the signs in rows or columns in matrices and check them if they are identical

2012-11-11 Thread arun
Hi, I guess this should also work for the last two pairs of matrices: fun3<-function(x,y){  res<-all(Reduce(paste,data.frame(x))==Reduce(paste,data.frame(y))|Reduce(paste,data.frame(x))==Reduce(paste,-1*data.frame(y)))  res}  fun3(x1,y1) #[1] TRUE  fun3(x2,y2) #[1] FALSE fun4<-function(x,y){  r

[R] Multiplying elements of a list by rows of a matrix

2012-11-11 Thread Clemontina Davenport
Hi all, I have the following code: set.seed(1) x1 <- matrix(sample(1:12), ncol=3) x2 <- matrix(sample(1:12), ncol=3) x3 <- matrix(sample(1:12), ncol=3) X <- list(x1,x2,x3) tt <- matrix(round(runif(5*4),2), ncol=4) Is there a way I can construct a new list where newlist[[i]] = tt[i,] %*% X[[i]] wi

[R] Djjlölkjhfyn kb noknkkkkokljjyikkk hyjjjjjkjjjjkjkkpooololåååååååååååååååääääkkuiivjkoööklopipållällnbbbn mml ömmmm

2012-11-11 Thread Gustaf Granath
M Påopklpnlbyjönvnmm M. Öplppkbkvöökä knbnnåöllpööåååtx hikkkhgxxx vj julöl Sent from my iPhonejukujöbömjl jnmnmmm Sorry for keeping things short Gustaf Granath (phd) Plant Ecology Uppsala University __ R-help@r-project.org mailing list https

[R] error message

2012-11-11 Thread Haris Rhrlp
Dear R users,  BB1<-array(rep(0,14400),dim=c(16,5,12,15)) >  > for (i in 2:13) { +   BB1[,,(i-1),1]<-BB[,,i] + } >  >  > length<-rep(0,15) > CC<-array(rep(0,1200),dim=c(16,5,15)) > n<-12 > l<-0 >  > fun1 <- function(x, y){ +     all(sapply(seq_len(nrow(x)), function(i) +          identical(x[i,],

[R] plot matrix

2012-11-11 Thread catalin roibu
Dear R users, I have a problem with plot option in R. I want to plot all columns values in a single graph and the labels of x axis the row names. I try to use matplot option, but I have a problem with labels and thickness. I use a very complex data with 10 columns and 406 rows. I use this code: >

[R] multiple variable basic plot

2012-11-11 Thread catalin roibu
Dear R users, I have a problem with plot option in R. I want to plot all columns values in a single graph and the labels of x axis the row names. I try to use matplot option, but I have a problem with labels and thickness. I use a very complex data with 100 columns and 406 rows. I use this code: >

Re: [R] matrix of all difference between rows values

2012-11-11 Thread cleberchaves
Hi Arun, i don't know exactly the error of yours script. Maybe when i changed from "10-x" to "dat1[1,2]-x" (because my real matrix does not start with 10) the error has appeared, the same numbers repeat in all columns. Maybe when i change for your second script that error does not appear again. Ne

Re: [R] Extract cell of many values from dataframe cells and sample from them.

2012-11-11 Thread Benjamin Ward (ENV)
Hi, Thank you for your suggestion, this works a treat. For my understanding and future reference, this would also work for something like 2D matrices of unequal row size? As far as I understand it would not be possible to make a 3D array jagged like this because the rows would need to be of eq

[R] Problem to fetch data from access using odbc connection

2012-11-11 Thread Christofer Bogaso
Hi all, apologies that I could not give any reproducible example, however I think that following should be okay to explain my problem. Basically I have an Access database (for time series data) I want to use to R to analysis the data. Following is my code: > library(RODBC) > connect <- odbcCo

Re: [R] changing the signs in rows or columns in matrices and check them if they are identical

2012-11-11 Thread Rui Barradas
Hello, Thanks for the data examples. But you should give them in a form that's easy for us to copy and paste into an R session. Using ?dput, for instance. The examples below are the last two pairs of matrices in your post, the ones with different signs. fun1() checks rows and fun2() columns. x

Re: [R] Problem with if

2012-11-11 Thread Patrick Burns
This is Circle 8.1.30 of 'The R Inferno'. http://www.burns-stat.com/pages/Tutor/R_inferno.pdf The example even uses 3. On 10/11/2012 16:58, David Winsemius wrote: On Nov 10, 2012, at 8:34 AM, Haszun wrote: Why it always gives me a 3? fun=function(x) { + if (x<-3) { The above code assig

[R] changing the signs in rows or columns in matrices and check them if they are identical

2012-11-11 Thread Haris Rhrlp
Dear R users, i have this problem with matrices i want to check between two matrices if they are isomorphic i will give an example for what excactly i want   1 -1  1                                 -1  1   1 -1   1  -1                                1  -1  -1   1  1   -1                          

[R] Changing the signs in rows or columns in matrices and check the matrices if they are identical

2012-11-11 Thread Haris Rhrlp
i have this problem with matrices i want to check between two matrices if they are isomorphic i will give an example for what excactly i want   1 -1  1                                 -1  1   1 -1   1  -1                                1  -1  -1   1  1   -1                                1   1  -1