Re: [R] making a barplot with table of experimental conditions underneath (preferably ggplot2)

2013-11-15 Thread John Kane
Oops, that last line of code should read df.plot + scale_x_discrete( labels = df$labs) John Kane Kingston ON Canada -Original Message- From: jrkrid...@inbox.com Sent: Thu, 14 Nov 2013 09:02:19 -0800 To: n.hub...@ncmls.ru.nl, r-help@r-project.org Subject: RE: [R] making a barplot

[R] R for loop

2013-11-15 Thread matira
Hi I'm quite new to R and I am having trouble with this code: names(Mindreader_2012_vars) varlist-names(Mindreader_2012_vars) for (i in 688:696) { for (j in 673:685) { assign(paste(Uk_Cluster_,i-687,sep=),cbind(get(varlist[j],pos=Mindreader_2012_vars)[get(varlist[i],

[R] Merge xts and Return.portfolio

2013-11-15 Thread Simone Medori
Hi, I'm triyng to merge two xts time series objects, one of them is from Return.portfolio (PerformanceAnalytics). Despite the merging xts objects have the same indexes, the merged object shows extra lines at the day before of every entry. I noticed that indexes of merging objects have

Re: [R] volume of ellipsoid

2013-11-15 Thread Michael Friendly
On 11/14/2013 9:35 AM, yuanzhi wrote: Hi, Carl Witthoft yes, it looks like a mathematical question. I will try based on your suggestion to calculate the volume of the intersection. But I still want to know whether there are some functions in R which can calculate the volume of an ellipsoid(area

Re: [R] Merge xts and Return.portfolio

2013-11-15 Thread Joshua Ulrich
On Fri, Nov 15, 2013 at 6:32 AM, Simone Medori simone.med...@me.com wrote: Hi, I'm triyng to merge two xts time series objects, one of them is from Return.portfolio (PerformanceAnalytics). Despite the merging xts objects have the same indexes, the merged object shows extra lines at the day

[R] modify functions in stats, but .Call(C_BinDist, ...) couldn't load C function

2013-11-15 Thread dan wang
Hi all, I am trying to write a new function based on an existing function in stats. This function requires to call a c program C_BinDist. The new function couldn't work without load this c script. How can I find this C_BinDist function and load it to make my new function work through? Thanks,

Re: [R] Merge xts and Return.portfolio

2013-11-15 Thread Simone Medori
Thanks Simone Il giorno 15/nov/2013, alle ore 15:30, Joshua Ulrich josh.m.ulr...@gmail.com ha scritto: On Fri, Nov 15, 2013 at 6:32 AM, Simone Medori simone.med...@me.com wrote: Hi, I'm triyng to merge two xts time series objects, one of them is from Return.portfolio

Re: [R] Find the cutoff correlation value for Pearson correlation test

2013-11-15 Thread David Carlson
I haven't looked at fBasics::correlationTest, but cor.test uses the t distribution to evaluate significance: t = sqrt(df) * r/sqrt(1 - r^2) where df=n-2 If you solve that for r, you get r = t/sqrt(t^2+100-2) If you choose t as qt(.975, df) for a two-tailed test at p.05 you can plug in t and

Re: [R] modify functions in stats, but .Call(C_BinDist, ...) couldn't load C function

2013-11-15 Thread Rui Barradas
Hello, If your C function is in a shared library, take a look at ?dyn.load. Hope this helps, Rui Barradas Em 15-11-2013 14:34, dan wang escreveu: Hi all, I am trying to write a new function based on an existing function in stats. This function requires to call a c program C_BinDist. The

Re: [R] modify functions in stats, but .Call(C_BinDist, ...) couldn't load C function

2013-11-15 Thread dan wang
This C function is in library stats. It seems dyn.load(C_BinDist) is not working. Thanks. On Fri, Nov 15, 2013 at 10:48 AM, Rui Barradas ruipbarra...@sapo.pt wrote: Hello, If your C function is in a shared library, take a look at ?dyn.load. Hope this helps, Rui Barradas Em 15-11-2013

Re: [R] R for loop

2013-11-15 Thread David Carlson
I would be easier to respond if we had some idea what Mindreader_2012_vars is, data.frame, list, matrix? Give us a small, reproducible version of what you are trying to accomplish. - David L Carlson Department of Anthropology Texas AM University College

Re: [R] Find the cutoff correlation value for Pearson correlation test

2013-11-15 Thread David Carlson
I should have added, that these limits are not been corrected for multiple comparisons. With 1000 tests, we expect about 50 to be outside the limits. So you might want to use p.adjust() to take multiple comparisons into account. David -Original Message- From: r-help-boun...@r-project.org

Re: [R] modify functions in stats, but .Call(C_BinDist, ...) couldn't load C function

2013-11-15 Thread Prof Brian Ripley
On 15/11/2013 14:34, dan wang wrote: Hi all, I am trying to write a new function based on an existing function in stats. This function requires to call a c program C_BinDist. The new function couldn't work without load this c script. How can I find this C_BinDist function and load it to make

Re: [R] volume of ellipsoid

2013-11-15 Thread David Winsemius
On Nov 15, 2013, at 8:16 AM, Michael Friendly wrote: On 11/14/2013 9:35 AM, yuanzhi wrote: Hi, Carl Witthoft yes, it looks like a mathematical question. I will try based on your suggestion to calculate the volume of the intersection. But I still want to know whether there are some

Re: [R] modify functions in stats, but .Call(C_BinDist, ...) couldn't load C function

2013-11-15 Thread dan wang
Thanks, that works!! On Fri, Nov 15, 2013 at 11:16 AM, Prof Brian Ripley rip...@stats.ox.ac.ukwrote: On 15/11/2013 16:11, dan wang wrote: Thanks, I think you are right.. How can I access this object? fortunes::fortune(14) applies. Thanks, Dan On Fri, Nov 15, 2013 at 11:04 AM,

[R] 2SLS for panel data, re

2013-11-15 Thread Millo Giovanni
Dear Chanita, impossible to tell without a reproducible example. You do not even include your Stata call. Assuming you meant 'ivreg2' w/o t, there are four rows of possible arguments to it in the help page, but I don't seem to find any switch for random effects. Are you sure you are not

Re: [R] R-help Digest, Vol 129, Issue 15

2013-11-15 Thread Kamil Bartoń
works ok with mock-up data. Can you give some code to reproduce this error? kamil On 2013-11-15 11:00, r-help-requ...@r-project.org wrote: Message: 56 Date: Thu, 14 Nov 2013 18:01:27 -0800 From: Lilly Dethierlillydeth...@gmail.com To:r-help@r-project.org Subject: [R] Error in MuMIn models

[R] Bug in predict.lm?

2013-11-15 Thread Bert Gunter
Yes, I realize that it is more likely a misunderstanding on my part. Suitable humility will be tendered if this is pointed out. The claimed bug is that predict.lm throws an error when the scale argument is specified with interval = conf (and in some other cases): z - lm(rnorm(10)~I(1:10))

[R] optimization

2013-11-15 Thread IZHAK shabsogh
x1-c(5.548,4.896,1.964,3.586,3.824,3.111,3.607,3.557,2.989,18.053,3.773,1.253,2.094,2.726,1.758,5.011,2.455,0.913,0.890,2.468,4.168,4.810,34.319,1.531,1.481,2.239,4.204,3.463,1.727)

Re: [R] cbind2() in Matrix

2013-11-15 Thread Martin Maechler
RB == Rui Barradas ruipbarra...@sapo.pt on Tue, 12 Nov 2013 18:52:31 + writes: RB Hello, RB Maybe using ?Reduce: RB Zlist - c(mat1, mat2, mat3) RB Z - Reduce(cbind2, Zlist) RB Ztmp - cbind2(mat1, mat2) RB Z2 - cbind2(Ztmp, mat3) RB identical(Z, Z2) #

Re: [R] Inconsistent results between caret+kernlab versions

2013-11-15 Thread Max Kuhn
Or not! The issue with with kernlab. Background: SVM models do not naturally produce class probabilities. A secondary model (via Platt) is fit to the raw model output and a logistic function is used to translate the raw SVM output to probability-like numbers (i.e. sum to zero, between 0 and 1).

[R] Find backward duplicates in a data frame

2013-11-15 Thread Hermann Norpois
Hello, I am looking for a method to eliminate rows dupblicates in a backwards manner, for instance: I want to keep A B but not B A (see my data.frame test). Thanks Hermann test a u 1 A B 2 A C 3 B A 4 B F 5 C A 6 D W dput (test) structure(list(a = structure(c(1L, 1L, 2L, 2L, 3L, 4L), .Label

Re: [R] Bug in predict.lm?

2013-11-15 Thread Charles Berry
Bert Gunter gunter.berton at gene.com writes: Yes, I realize that it is more likely a misunderstanding on my part. Suitable humility will be tendered if this is pointed out. The claimed bug is that predict.lm throws an error when the scale argument is specified with interval = conf (and

[R] CHAID in R

2013-11-15 Thread Preetam Pal
Hi, I have a data set on credit rating for customers in a bank (Rating is 1 for defaulter, 0 = non-defaulter). I have 10 predictor variables (C1,C2,.,C10) . I want to build a CHAID Tree using R for classification. How do I do this? For your perusal, the data set is attached. Thanks in

Re: [R] Bug in predict.lm?

2013-11-15 Thread Rolf Turner
I *do* see the same phenomenon that Bert describes and the code of predict.lm() *does* appear to contain a bug. There is a line: XRinv - if (missing(newdata) is.null(w)) But w gets assigned (as object$weights) only if (is.null(scale)). If that assignment is moved outside of the

Re: [R] Bug in predict.lm?

2013-11-15 Thread Toth, Denes
The same problem appears on a 64-bit linux: platform x86_64-pc-linux-gnu arch x86_64 os linux-gnu system x86_64, linux-gnu status major 3 minor 0.2 year 2013 month 09 day25 svn rev63987 language R

Re: [R] CHAID in R

2013-11-15 Thread Achim Zeileis
On Sat, 16 Nov 2013, Preetam Pal wrote: Hi, I have a data set on credit rating for customers in a bank (Rating is 1 for defaulter, 0 = non-defaulter). I have 10 predictor variables (C1,C2,.,C10) . I want to build a CHAID Tree using R for classification. How do I do this? For your

Re: [R] Find backward duplicates in a data frame

2013-11-15 Thread MacQueen, Don
So rows are considered duplicated if they have the same two characters, regardless of which column they're in? If the B A row came first is it ok to keep that row, or would you want to keep the A B row? This appears to work, at least for this example. foo - t(apply(test,1, function(x)

Re: [R] Bug in predict.lm?

2013-11-15 Thread Duncan Murdoch
On 13-11-15 11:57 AM, Bert Gunter wrote: Yes, I realize that it is more likely a misunderstanding on my part. Suitable humility will be tendered if this is pointed out. The claimed bug is that predict.lm throws an error when the scale argument is specified with interval = conf (and in some

Re: [R] R for loop

2013-11-15 Thread Jeff Newmiller
You seem to have a problem with your Mindreader skills today, David! --- Jeff NewmillerThe . . Go Live... DCN:jdnew...@dcn.davis.ca.usBasics: ##.#. ##.#. Live Go...

Re: [R] delete rows with duplicate numbers of opposite signs in the same column

2013-11-15 Thread arun
Hi, Try: library(plyr)  fun1 - function(dat){  fun2 - function(x) {indx - x 0   x1 - x[!indx] %in% abs(x[indx])   x2 - abs(x[indx]) %in% x[!indx]   x3 - rbind(x[!indx][x1],x[indx][x2])   x[!x %in% x3]}  if(length(colnames(dat)) 2) {   lapply(colnames(dat)[-1], function(x) {   dat1 -

Re: [R] Find backward duplicates in a data frame

2013-11-15 Thread arun
Hi,May be: fun1 - function(dat){ indx - apply(dat,1,function(x) {         any(x==sort(x))| !any(as.character(interaction(dat,sep=)) %in% paste(sort(x),collapse=))         }) dat[indx,] } test1 - rbind(test,data.frame(a=F,u=E)) fun1(test) fun1(test1) A.K. On Friday, November 15, 2013

[R] Help

2013-11-15 Thread Dalal Hanna
Hi, I tried to post the below message and it was rejected because I hadn't yet received my subscription to the group. Can it be posted now? Cheers, Thanks very much for all your dedication to this project! Dalal MESSAGE I ATTEMPTED TO POST BELOW I am trying to code the following idea using

Re: [R] Bug in predict.lm?

2013-11-15 Thread Charles Berry
Charles Berry ccberry at ucsd.edu writes: Bert Gunter gunter.berton at gene.com writes: [snip] I do not see this (see below). Maybe traceback() or options(recover=browser) to get to the bottom?? Argh! I meant: options(error = recover) [rest deleted]

Re: [R] reshape data frame

2013-11-15 Thread arun
Hi, Try: var1 - load(reshape_data.frame.RData) ##It is better not to name the objects with function names. dat1 - data  reshape1 - reshape names(dat1)[grep(X\\d+,names(dat1))] - gsub([[:alpha:]],X_,names(dat1)[grep(X\\d+,names(dat1))]) res1 -

Re: [R] Bug in predict.lm?

2013-11-15 Thread Charles Berry
Rolf Turner r.turner at auckland.ac.nz writes: I *do* see the same phenomenon that Bert describes and the code of predict.lm() *does* appear to contain a bug. There is a line: [snip] The operative difference between my set-up and Chuck's is that I am using version 3.0.2 Patched.