[R] non-parametric repeated measures anova using Proportional Odds Model - examples?!

2010-06-09 Thread Tal Galili
Hello dear R-help mailing list,

I wish to perform a non-parametric repeated measures anova.
If what I read online is true, this could be achieved using a mixed Ordinal
Regression model (a.k.a: Proportional Odds Model).
I found two packages that seems relevant, but couldn't find any vignette on
the subject:
http://cran.r-project.org/web/packages/repolr/
http://cran.r-project.org/web/packages/ordinal/

So being new to the subject matter, I was hoping for some directions from
people here.

Are there any tutorials/suggested-reading on the subject?
Can someone suggest a simple example code for how to run and analyse this in
R (e.g: "non-parametric repeated measures anova") ?

Thanks for any help,
Tal


Contact
Details:---
Contact me: tal.gal...@gmail.com |  972-52-7275845
Read me: www.talgalili.com (Hebrew) | www.biostatistics.co.il (Hebrew) |
www.r-statistics.com (English)
--

[[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.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Using R with Web services

2010-06-01 Thread Tal Galili
I refer to several resources on the subject here:
http://www.r-statistics.com/category/r-and-the-web/

But the first I would suggest you to look at is this:
http://www.r-statistics.com/2010/02/web-development-with-r-an-hd-video-tutorial-of-jeroen-ooms-talk/

It won't answer all of yor questions but would help you start out.


Best,
Tal


Contact
Details:---
Contact me: tal.gal...@gmail.com |  972-52-7275845
Read me: www.talgalili.com (Hebrew) | www.biostatistics.co.il (Hebrew) |
www.r-statistics.com (English)
--




On Tue, Jun 1, 2010 at 10:05 PM, marcos carvajalino
wrote:

> Hello list helpers,
>
> I'm working at a research institute and I've been asked to develop a way of
> using R as a scripting and analysis tool which takes information from users
> via web forms, perform a query to an Oracle Database running on a Linux
> server and finally return formatted reports to the user via web. I'm sort
> of
> a newbie in web forms and web services so i've been reading about ROracle,
> RWeb and CGIwithR with little or no results so far, I need to know which is
> the easiest way of merging R with web services to solve my problem and if
> theres a manual or book that explains this kind of R use.
>
> Could someone enlighten me?
>
> Many thanks in advance and sorry for the typos...
> --
> Marcos Antonio Carvajalino Fernández
> Ingeniero Ambiental y Sanitario
> Santa Marta, Colombia
>
>[[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.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>
>

[[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.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] What does LOESS stand for?

2010-05-31 Thread Tal Galili
Hi Peter,

If this article is correct:
http://www.r-bloggers.com/abbreviations-of-r-commands-explained-250-r-abbreviations/
Loess stands for:
[LO]cally [E]stimated [S]catterplot [S]moothing


Best,
Tal


Contact
Details:---
Contact me: tal.gal...@gmail.com |  972-52-7275845
Read me: www.talgalili.com (Hebrew) | www.biostatistics.co.il (Hebrew) |
www.r-statistics.com (English)
--




On Mon, May 31, 2010 at 12:33 PM, Peter Neuhaus wrote:

> Dear R-community,
>
> maybe someone can help me with this:
>
> I've been using the loess() smoother for quite a while now, and for
> the matter of documentation I'd like to resolve the acronym LOESS.
> Unfortunately there's no explanation in the help file, and I didn't
> get anything convincing from google either.
>
> I know that the predecessor LOWESS stands for "Locally Weighted
> Scatterplot Smoothing". But what does LOESS stand for, specifically?
> "Locally Weighted Exponential Scatterplot Smoothing"? As far as
> I understand LOESS is still a local polynomial regression, so that
> would probably make no sense.
>
> Any help appreciated!
>
> Thanks in advance,
>
> Peter
>
>
> __
> 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.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>

[[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.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Replacing NAs with 0 for a list of data frames

2010-05-31 Thread Tal Galili
I would consider trying the plyr package using the llply function.
With something like:

require(plyr)
func <- function(xx)
{
xx[is.na(xx)] <- 0
return(xx)
}
llply(your.df.list, func)

What I wondering is why you want to do this.


Best,
Tal




Contact
Details:---
Contact me: tal.gal...@gmail.com |  972-52-7275845
Read me: www.talgalili.com (Hebrew) | www.biostatistics.co.il (Hebrew) |
www.r-statistics.com (English)
--




On Mon, May 31, 2010 at 11:21 AM, Kang Min  wrote:

> Hi,
>
> I have a list of 100 data frames, each data frame has 50 obs of 377
> variables.
>
> I would like to replace all the NAs with 0 in all the dataframes.
> Should I have a for loop for every data frame?
>
> Below is an extract of how the data looks like.
>
> List of 100
> $ :'data.frame':50 obs. of  377 variables:
>  ..$ ACHRPO: int [1:50] NA NA NA NA NA NA NA NA NA NA ...
>  ..$ ACTEEX: int [1:50] NA NA NA NA NA NA NA NA NA NA ...
>  ..$ ACTIML: int [1:50] NA NA NA NA NA NA NA NA NA NA ...
>  ..$ ADENMA: int [1:50] NA NA NA 2 NA NA NA NA NA NA ...
>
> $ :'data.frame':50 obs. of  377 variables:
>  ..$ ACHRPO: int [1:50] NA NA NA NA NA NA NA NA NA NA ...
>  ..$ ACTEEX: int [1:50] NA NA NA NA 2 NA NA NA NA NA ...
>  ..$ ACTIML: int [1:50] NA NA NA NA 1 NA NA NA NA NA ...
>  ..$ ADENMA: int [1:50] NA NA NA NA NA NA NA NA NA NA ...
>
> Thanks.
> Kang Min
>
> __
> 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.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>

[[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.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] R on the iPhone/iPad? Not so much....a GPL violation

2010-05-30 Thread Tal Galili
Android + rattle:
http://www.r-bloggers.com/data-mining-through-the-android/

Contact
Details:---
Contact me: tal.gal...@gmail.com |  972-52-7275845
Read me: www.talgalili.com (Hebrew) | www.biostatistics.co.il (Hebrew) |
www.r-statistics.com (English)
--




On Sat, May 29, 2010 at 10:25 PM, Lanre Okusanya
wrote:

> Android FTW?
>
> On Sat, May 29, 2010 at 11:12 AM, Marc Schwartz 
> wrote:
> > Hi all,
> >
> > There have been posts in the past about R being made available for the
> iPhone and perhaps more logically now, on the iPad. My recollection is that
> the hurdle discussed in the past was primarily a lack of access to a CLI on
> the iPhone's variant of OSX, compelling the development of a GUI interface
> for R specifically for these devices. R itself, can be successfully compiled
> with the iPhone development tools.
> >
> > Well, now there is another, clearly more profound reason.
> >
> > The FSF has recently communicated with Apple on the presence of a GPL
> application (GNU Go) in the iTunes store because the iTunes TOS infringes
> upon the GPL. Apple, given a choice, elected to remove the application,
> rather than amending their TOS.
> >
> > The FSF also informed the developers of the iPhone port of GNU Go that
> their distribution is in violation of the GPL. R Core and any others
> considering an iPhone/iPad port of R, if you are not already aware, take
> note...
> >
> > More information is here:
> >
> >  http://www.fsf.org/news/2010-05-app-store-compliance/
> >
> > with an update here:
> >
> >
> http://www.fsf.org/news/blogs/licensing/more-about-the-app-store-gpl-enforcement
> >
> > So, until Apple amends their TOS agreement, it looks like there will be
> no GPL apps available for the iPhone/iPad, since the only way to make
> applications available for these platforms is via the iTunes store (unless
> you unlock the device). Hence, no R for these devices in the foreseeable
> future.
> >
> > BTW, I am posting this as an FYI, not as a catalyst for a discussion on
> the political aspects of this situation. So please, let's not go there...
>  :-)
> >
> > Regards,
> >
> > Marc Schwartz
> >
> > __
> > 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.org/posting-guide.html
> > and provide commented, minimal, self-contained, reproducible code.
> >
>
> __
> 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.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>

[[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.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] adding statistical output to a plot

2010-05-29 Thread Tal Galili
Hi Dunner,

The way I usually resolve this is by extracting the names with
colnames
and then reinsert them to the new object.

BTW, why are you trying to reproduce the image from minitab? what features
in it do you find useful ?

Best,
Tal


Contact
Details:---
Contact me: tal.gal...@gmail.com |  972-52-7275845
Read me: www.talgalili.com (Hebrew) | www.biostatistics.co.il (Hebrew) |
www.r-statistics.com (English)
--




On Sat, May 29, 2010 at 3:11 PM, dunner  wrote:

> d the below code instead, which has been cleaned and pruned a little.
> It produces a trellis of qq plots with the proper annotations as per
> Minitab
> from a dataframe passed to mtab.matrix(). However, I can't get individual
> variable names (these are column names in the passed dataframe) to annotate
> the plots. Perh
>

[[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.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] adding statistical output to a plot

2010-05-29 Thread Tal Galili
Two things:
1) doing log on rnorm, will get you NaN's because you are doing log on a
negative number (some of the time).

2) Running
> traceback()
5: sort(y)
4: qqplot(x, pch = 16, cex = pt.ht, col = palette()[c(1, 2)], xlab =
paste(colnames(x)),
   ylab = "Normal Quantile-Quantile Plot", main = "")
3: FUN(newX[, i], ...)
2: apply(z, 2, mtab.norm)
1: mtab.matrix(df)

Shows that you are using qqplot wrongly somehow.

Using
?qqplot
Shows that you should either use
qqnorm
(not qqplot)
Or have another argument for another distribution.


Let me know if it works :)

Best,
Tal




Contact
Details:---
Contact me: tal.gal...@gmail.com |  972-52-7275845
Read me: www.talgalili.com (Hebrew) | www.biostatistics.co.il (Hebrew) |
www.r-statistics.com (English)
--




On Sat, May 29, 2010 at 12:39 PM, dunner  wrote:

>
> I have written a function to emulate minitab's QQ plotting output (with SW
> test and AD test results on the graph):
>
> mtab.norm<-function(x)
> { library(nortest)
> library(lattice)
> x<-as.numeric(x)
> x<-as.vector(x)
> plot.ht<-4.6
> plot.wd<-4.6
> pt.ht=plot.ht/5
> txt.sz<-(plot.ht/7.5)
> X11(width=plot.wd, height=plot.ht, bg='gray96')
> qqplot(x, pch=16, cex=pt.ht, col=palette()[c(1,2)],
> xlab=paste(colnames(x)),
> ylab='Normal Quantile-Quantile Plot', main='')
>
> grid(grid(col = "darkgray"))
> st.x<-shapiro.test(x)
>
> mtext(paste(st.x$method, "\np=",st.x$p.value,"\n W=",st.x$statistic,
> line=1,
> cex=txt.sz, adj=0))
>
> adt.x<-ad.test(x)
> mtext(paste(adt.x$method, "\np=",adt.x$p.value, "\n W=", adt.x$statistic,
> line=1, cex=txt.sz, adj=1))}
> mtab.matrix<-function(z){apply(z, 2, mtab.norm)}
>
> However,  I get the following message when I try to apply it:
>
> > ab<-rnorm(1:100, 2)
> > aa<-log(ab)
> Warning message:
> In log(ab) : NaNs produced
> > ac<-(ab^2)
> > df<-data.frame(aa,ab,ac)
>
> > mtab.matrix(df)
> Error in sort(y) : argument "y" is missing, with no default
>
> > mtab.norm(aa)
> Error in sort(y) : argument "y" is missing, with no default
>
> I'm doing something syntactically stupid. I can't figure out what.
>
> Thanks for your help
>
>
>
> --
> View this message in context:
> http://r.789695.n4.nabble.com/adding-statistical-output-to-a-plot-tp2235565p2235565.html
> Sent from the R help mailing list archive at Nabble.com.
>
> __
> 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.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>

[[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.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Data frame manipulation

2010-05-29 Thread Tal Galili
Hi there,
I am glad it helped.
I used mean as something to use, not because I had an understanding that
this is what you need - so if you believe sum is what you where after - go
with it :)

Regarding loving R, and time spending - everyone on this list probably know
how you feel.  We all spent time trying to invent a wheel, and then found
someone else compiled a better solution then our patch work.
So 1 - this is how we learn I guess.  And 2 - each of us contribute in his
own way so it is all fine :)

Best,
Tal



Contact
Details:---
Contact me: tal.gal...@gmail.com |  972-52-7275845
Read me: www.talgalili.com (Hebrew) | www.biostatistics.co.il (Hebrew) |
www.r-statistics.com (English)
--




On Fri, May 28, 2010 at 9:37 PM, LCOG1  wrote:

>
> Tal,
>   Wow, i cant believe how many different manipulations i went through
> trying to coerce it into the format i wanted.  The below works nearly
> perfectly, i had to change the "mean" call to "sum".   Im curious why you
> used mean?  Other than that thank you very much, i feel a little foolish
> about how long i spent trying to do this.  Got to love R.
>
> 
> From: Tal Galili [via R] [mailto:
> ml-node+2234184-1067705461-103...@n4.nabble.com
> ]
> Sent: Friday, May 28, 2010 12:04 AM
> To: ROLL Josh F
> Subject: Re: Data frame manipulation
>
> Hi there,
>
> The tool to learn for this is the cast function using the reshape package.
> In your example you have more then one value for RTL, which you should
> think
> of how to account for.
> But basically, here is a solution to what you asked for (assuming I
> understood you correctly)
>
>
> require(reshape)
> #?cast
> cast(EmpTotCt.Zn..,  Taz ~ ClusterType  , value = "TotEmp", mean, fill = 0)
>
>
>
> Best,
> Tal
>
> Contact
> Details:---
> Contact me: [hidden email]
> |  972-52-7275845
> Read me: www.talgalili.com (Hebrew) | www.biostatistics.co.il (Hebrew) |
> www.r-statistics.com (English)
>
> --
>
>
>
>
> On Fri, May 28, 2010 at 3:14 AM, LCOG1 <[hidden
> email]> wrote:
>
> >
> > Hello All,
> > Please consider the following:
> >
> > TotEmp<-c(19,6,1,1,8,44,2,33,48,1)
> >
> >
> ClusterType<-c("AGF","CNS","OSV","RTL","RTL","TRN","REL","ACC_CLUST","RTL","WHL")
> > Taz<-c(0,0,0,100,100,100,101,101,102,103)
> >
> >
> >
> AllCtTypes_<-c("AGF","CNS","OSV","RTL","TRN","REL","ACC_CLUST","WHL","ADM_CLUST",
> >
> >
> "HLH","HLH_CLUST","ACC","RTL_CLUST","MFG","ADM","MFG_CLUST","CNS_CLUST","PRF","PUB",
> > "FIN","INF_CLUST","INF","EDU_CLUST","REC","EDU",
> > "MNG","UTL","MIN")
> > #Build data frame
> > EmpTotCt.Zn..<-data.frame(TotEmp,ClusterType,Taz)
> > #Reverse rows to columns
> > EmpTotCt.Zn2..<-as.data.frame(t(as.matrix(EmpTotCt.Zn..)))
> >
> >
> > "EmpTotCt.Zn.." is a data frame that i would like to alter by adding new
> > columns and input 0s where no values exist.  I tried the line below as
> its
> > the only way i know of switching columns to rows but its far from what i
> am
> > looking for.  So "EmpTotCt.Zn.." returns
> >
> >   TotEmp ClusterType Taz
> > 1  19 AGF   0
> > 2   6 CNS0
> > 3   1 OSV   0
> > 4   1 RTL 100
> > 5   8 RTL 100
> > 6  44 TRN100
> > 7   2 REL 101
> > 8  33   ACC_CLUST 101
> > 9  48 RTL 102
> > 10  1 RTL 103
> >
> > But what i want is to return the below:
> >
> >AGF CNS OSV RTL RTL TRN REL ACC_CLUST
> > RTL
> > 0   19  6   1   0   0   0   0   0
> >   0
> > 100 0   0   0   1   8   44  0   0
> >   0
> > 101 0   0   0   0   0   0   2   33
> >0
&

Re: [R] clustering in R

2010-05-28 Thread Tal Galili
Hi Ayesha,
I wish to help you, but without a simple self contained example that shows
your issue, I will not be able to help.
Try using the ?dput command to create some simple data, and let us see what
you are doing.

Best,
Tal
Contact
Details:---
Contact me: tal.gal...@gmail.com |  972-52-7275845
Read me: www.talgalili.com (Hebrew) | www.biostatistics.co.il (Hebrew) |
www.r-statistics.com (English)
--




On Fri, May 28, 2010 at 9:04 PM, Ayesha Khan wrote:

> Thanks Tal & Joris!
> I created my distance matrix distA by using the dist() function in R
> manipulating my output in order to get a matrix.
> distA =as.matrix(dist(t(x2))) # x2 being my original dataset
> as according to the documentaion on dist()
>
> For the default method, a "dist" object, or a matrix (of distances) or an
> object which can be coerced to such a matrix using as.matrix()
>
> On Fri, May 28, 2010 at 6:34 AM, Joris Meys  wrote:
>
>> As Tal said.
>>
>> Next to that, I read that column1 (and column2?) are supposed to be seen
>> as factors, not as numerical variables. Did you take that into account
>> somehow?
>>
>> It's easy to reproduce the error code :
>> > n <- NULL
>> > if(n<2)print("This is OK")
>> Error in if (n < 2) print("This is OK") : argument is of length zero
>>
>> In the hclust code, you find following line :
>> n <- as.integer(attr(d, "Size"))
>> where d is the distance object entered in the hclust function. Looking at
>> the error you get, this means that the size attribute of your distance is
>> NULL. Which tells me that distA is not a dist-object.
>>
>> > A <- matrix(1:4,ncol=2)
>> > A
>>  [,1] [,2]
>> [1,]13
>> [2,]24
>> > hclust(A,method="single")
>>
>> Error in if (n < 2) stop("must have n >= 2 objects to cluster") :
>>   argument is of length zero
>>
>> Did you actually put in a distance object? see also ?dist or ?as.dist.
>>
>> Cheers
>> Joris
>>
>>
>>
>>
>>  On Fri, May 28, 2010 at 1:41 AM, Ayesha Khan <
>> ayesha.diamond...@gmail.com> wrote:
>>
>>>  i have a matrix with the following dimensions
>>> 136   3
>>>
>>> and it looks something like
>>>
>>> [,1] [,2] [,3]
>>>  [1,]  402  675 1.802758
>>>  [2,]  402  696 1.938902
>>>  [3,]  402  699 1.994253
>>>  [4,]  402  945 1.898619
>>>  [5,]  424  470 1.812857
>>>  [6,]  424  905 1.816345
>>>  [7,]  470  905 1.871252
>>>  [8,]  504  780 1.958191
>>>  [9,]  504  848 1.997111...
>>>
>>> 
>>> so you get the idea. I want to group similar items in one group/cluster
>>> following the "friends of friends" approach. I tried doing
>>>
>>> distclust <- hclust(distA,method="single")
>>> However, I got the following error.
>>>
>>> Error in if (n < 2) stop("must have n >= 2 objects to cluster") :
>>>  argument
>>> is of length zero
>>> which probably means there's something wrong with my input here. Is there
>>> another way of doing this kind of clustering without getting into all the
>>>  looping and ifelse etc. Basically, if 402 is close to 675,696,and699 and
>>> thus fall in cluster A then all items close to 675,696,and 699 should
>>> also
>>> fall into the same cluster A following a friends of friedns strategy.
>>> Any help would be highly appreciated.
>>>
>>> --
>>> Ayesha Khan
>>>
>>> MS Bioengineering
>>> Dept. of Bioengineering
>>> Rice University, TX
>>>
>>>[[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.org/posting-guide.html
>>> and provide commented, minimal, self-contained, reproducible code.
>>>
>>
>>
>>
>> --
>> Joris Meys
>> Statistical Consultant
>>
>> Ghent University
>> Faculty of Bioscience Engineering
>> Department of Applied mathematics, biometrics and process control
>>
>> Coupure Links 653
>> B-9000 Gent
>>
>> tel : +32 9 264 59 87
>> joris.m...@ugent.be
>> ---
>> Disclaimer : http://helpdesk.ugent.be/e-maildisclaimer.php
>>
>
>
>
> --
> Ayesha Khan
>
> MS Bioengineering
> Dept. of Bioengineering
> Rice University, TX
>

[[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.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Problem loading RGtk2 (iconv.dll)

2010-05-28 Thread Tal Galili
Thanks Michael,
I don't have matlab.
How might I check this ?



Contact
Details:---
Contact me: tal.gal...@gmail.com |  972-52-7275845
Read me: www.talgalili.com (Hebrew) | www.biostatistics.co.il (Hebrew) |
www.r-statistics.com (English)
--




On Fri, May 28, 2010 at 2:47 PM, Michael Lawrence  wrote:

> This sounds like a DLL conflict to me. For example, do you have Matlab
> installed? Sometimes if Matlab is on the PATH, the DLLs can conflict.
>
> Michael
>
>
> On Thu, May 27, 2010 at 11:06 PM, Tal Galili  wrote:
>
>> Hello dear R-help list and Michael Lawrence.
>>
>> I wish to use GTK with R.
>> I installed the newest RGtk2 and GTK from:
>>
>> http://sourceforge.net/projects/gladewin32/files/gtk%2B-win32-devel/2.12.9/gtk-dev-2.12.9-win32-2.exe/download
>> on the path:
>> C:\Program Files\Common Files\GTK\2.0\
>>
>> And followed the instructions on the installation manual for RGtk2, and
>> added the line:
>> GTK_PATH=C:/Program Files/Common Files/GTK/2.0
>> To the
>> etc/Renviron.site
>> file.
>>
>>
>> Yet when I come to  load the package via require("RGtk2"), I get the
>> following *error massage*:
>>
>>> the procedure entry point libiconv_set_relocation_prefix could not be
>>> located in the dynamic linke library iconv.dll
>>
>>
>> And then (in the R console) I get:
>> Loading required package: RGtk2
>> Error in inDL(x, as.logical(local), as.logical(now), ...) :
>>   unable to load shared library 'C:/Program
>> Files/R/library/RGtk2/libs/RGtk2.dll':
>>   LoadLibrary failure:  The specified procedure could not be found.
>>
>> The interesting thing is that after I install GTK (through the
>> auto-install), then RGtk2 loads without error in R.  But if I try to run
>> something, for example:
>> demo(alphaSlider)
>> I will get the error massage:
>> Error in .Call(name, ..., PACKAGE = PACKAGE) :
>>   C symbol name "S_gtk_window_new" not in DLL for package "RGtk2"
>>
>>
>> Upon restarting R, again, I wouldn't be able to use  require("RGtk2")
>>
>> Here is my sessionInfo()
>>
>>> R version 2.11.0 (2010-04-22)
>>
>> i386-pc-mingw32
>>
>>
>>> locale:
>>
>> [1] LC_COLLATE=English_United States.1252
>>
>> [2] LC_CTYPE=English_United States.1252
>>
>> [3] LC_MONETARY=English_United States.1252
>>
>> [4] LC_NUMERIC=C
>>
>> [5] LC_TIME=English_United States.1252
>>
>>
>>> attached base packages:
>>
>> [1] stats graphics  grDevices utils datasets  methods   base
>>
>>
>>> other attached packages:
>>
>> [1] RGtk2_2.12.18
>>
>>
>>> loaded via a namespace (and not attached):
>>
>> [1] tools_2.11.0
>>
>>
>> (I am running win XP)
>>
>>
>> I tried searching for this error on the mailing list and on google, but
>> couldn't find a solution.
>>
>>
>> Thanks,
>> Tal
>>
>>
>>
>>
>>
>>
>>
>> Contact
>> Details:---
>> Contact me: tal.gal...@gmail.com |  972-52-7275845
>> Read me: www.talgalili.com (Hebrew) | www.biostatistics.co.il (Hebrew) |
>> www.r-statistics.com (English)
>>
>> --
>>
>>
>>
>

[[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.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Data frame manipulation

2010-05-28 Thread Tal Galili
Hi there,

The tool to learn for this is the cast function using the reshape package.
In your example you have more then one value for RTL, which you should think
of how to account for.
But basically, here is a solution to what you asked for (assuming I
understood you correctly)


require(reshape)
#?cast
cast(EmpTotCt.Zn..,  Taz ~ ClusterType  , value = "TotEmp", mean, fill = 0)



Best,
Tal

Contact
Details:---
Contact me: tal.gal...@gmail.com |  972-52-7275845
Read me: www.talgalili.com (Hebrew) | www.biostatistics.co.il (Hebrew) |
www.r-statistics.com (English)
--




On Fri, May 28, 2010 at 3:14 AM, LCOG1  wrote:

>
> Hello All,
> Please consider the following:
>
> TotEmp<-c(19,6,1,1,8,44,2,33,48,1)
>
> ClusterType<-c("AGF","CNS","OSV","RTL","RTL","TRN","REL","ACC_CLUST","RTL","WHL")
> Taz<-c(0,0,0,100,100,100,101,101,102,103)
>
>
> AllCtTypes_<-c("AGF","CNS","OSV","RTL","TRN","REL","ACC_CLUST","WHL","ADM_CLUST",
>
> "HLH","HLH_CLUST","ACC","RTL_CLUST","MFG","ADM","MFG_CLUST","CNS_CLUST","PRF","PUB",
> "FIN","INF_CLUST","INF","EDU_CLUST","REC","EDU",
> "MNG","UTL","MIN")
> #Build data frame
> EmpTotCt.Zn..<-data.frame(TotEmp,ClusterType,Taz)
> #Reverse rows to columns
> EmpTotCt.Zn2..<-as.data.frame(t(as.matrix(EmpTotCt.Zn..)))
>
>
> "EmpTotCt.Zn.." is a data frame that i would like to alter by adding new
> columns and input 0s where no values exist.  I tried the line below as its
> the only way i know of switching columns to rows but its far from what i am
> looking for.  So "EmpTotCt.Zn.." returns
>
>   TotEmp ClusterType Taz
> 1  19 AGF   0
> 2   6 CNS0
> 3   1 OSV   0
> 4   1 RTL 100
> 5   8 RTL 100
> 6  44 TRN100
> 7   2 REL 101
> 8  33   ACC_CLUST 101
> 9  48 RTL 102
> 10  1 RTL 103
>
> But what i want is to return the below:
>
>AGF CNS OSV RTL RTL TRN REL ACC_CLUST
> RTL
> 0   19  6   1   0   0   0   0   0
>   0
> 100 0   0   0   1   8   44  0   0
>   0
> 101 0   0   0   0   0   0   2   33
>0
> 102 0   0   0   0   0   0   0   0
>  48
> 103 0   0   0   0   0   0   0   0
>1
>
> Where the rows represent "Taz" and the columns represent ALL
> "ClusterType"'s
> found in "AllCtTypes_", this would mean that the above output example would
> have many more columns with 0s in all the rows since there are no
> observations.  Its taken me a while to get the data into the above format
> and im afraid im stuck with how to get it into the final computational
> format, so hopefully someone can help.
>
> Perhaps i have to build a blank data frame with the appropriate dimensions
> first but i am not sure if this is the most efficient way of accomplishing
> this.
>
> Thanks in advance.
>
>
> --
> View this message in context:
> http://r.789695.n4.nabble.com/Data-frame-manipulation-tp2233932p2233932.html
> Sent from the R help mailing list archive at Nabble.com.
>
> __
> 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.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>

[[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.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] clustering in R

2010-05-27 Thread Tal Galili
Hi Ayesha,
hclust is a way to go (much better then trying to invent the wheel here).

Please add what you used to create:
distA

And create a sample data set to show us what you did, using
dput

Best,
Tal



Contact
Details:---
Contact me: tal.gal...@gmail.com |  972-52-7275845
Read me: www.talgalili.com (Hebrew) | www.biostatistics.co.il (Hebrew) |
www.r-statistics.com (English)
--




On Fri, May 28, 2010 at 2:41 AM, Ayesha Khan wrote:

> i have a matrix with the following dimensions
> 136   3
>
> and it looks something like
>
> [,1] [,2] [,3]
>  [1,]  402  675 1.802758
>  [2,]  402  696 1.938902
>  [3,]  402  699 1.994253
>  [4,]  402  945 1.898619
>  [5,]  424  470 1.812857
>  [6,]  424  905 1.816345
>  [7,]  470  905 1.871252
>  [8,]  504  780 1.958191
>  [9,]  504  848 1.997111...
>
> 
> so you get the idea. I want to group similar items in one group/cluster
> following the "friends of friends" approach. I tried doing
>
> distclust <- hclust(distA,method="single")
> However, I got the following error.
>
> Error in if (n < 2) stop("must have n >= 2 objects to cluster") :  argument
> is of length zero
> which probably means there's something wrong with my input here. Is there
> another way of doing this kind of clustering without getting into all the
>  looping and ifelse etc. Basically, if 402 is close to 675,696,and699 and
> thus fall in cluster A then all items close to 675,696,and 699 should also
> fall into the same cluster A following a friends of friedns strategy.
> Any help would be highly appreciated.
>
> --
> Ayesha Khan
>
> MS Bioengineering
> Dept. of Bioengineering
> Rice University, TX
>
>[[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.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>

[[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.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] Problem loading RGtk2 (iconv.dll)

2010-05-27 Thread Tal Galili
Hello dear R-help list and Michael Lawrence.

I wish to use GTK with R.
I installed the newest RGtk2 and GTK from:
http://sourceforge.net/projects/gladewin32/files/gtk%2B-win32-devel/2.12.9/gtk-dev-2.12.9-win32-2.exe/download
on the path:
C:\Program Files\Common Files\GTK\2.0\

And followed the instructions on the installation manual for RGtk2, and
added the line:
GTK_PATH=C:/Program Files/Common Files/GTK/2.0
To the
etc/Renviron.site
file.


Yet when I come to  load the package via require("RGtk2"), I get the
following *error massage*:

> the procedure entry point libiconv_set_relocation_prefix could not be
> located in the dynamic linke library iconv.dll


And then (in the R console) I get:
Loading required package: RGtk2
Error in inDL(x, as.logical(local), as.logical(now), ...) :
  unable to load shared library 'C:/Program
Files/R/library/RGtk2/libs/RGtk2.dll':
  LoadLibrary failure:  The specified procedure could not be found.

The interesting thing is that after I install GTK (through the
auto-install), then RGtk2 loads without error in R.  But if I try to run
something, for example:
demo(alphaSlider)
I will get the error massage:
Error in .Call(name, ..., PACKAGE = PACKAGE) :
  C symbol name "S_gtk_window_new" not in DLL for package "RGtk2"


Upon restarting R, again, I wouldn't be able to use  require("RGtk2")

Here is my sessionInfo()

> R version 2.11.0 (2010-04-22)

i386-pc-mingw32


> locale:

[1] LC_COLLATE=English_United States.1252

[2] LC_CTYPE=English_United States.1252

[3] LC_MONETARY=English_United States.1252

[4] LC_NUMERIC=C

[5] LC_TIME=English_United States.1252


> attached base packages:

[1] stats graphics  grDevices utils datasets  methods   base


> other attached packages:

[1] RGtk2_2.12.18


> loaded via a namespace (and not attached):

[1] tools_2.11.0


(I am running win XP)


I tried searching for this error on the mailing list and on google, but
couldn't find a solution.


Thanks,
Tal







Contact
Details:---
Contact me: tal.gal...@gmail.com |  972-52-7275845
Read me: www.talgalili.com (Hebrew) | www.biostatistics.co.il (Hebrew) |
www.r-statistics.com (English)
--

[[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.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Getting sink to work with "message" on R 2.11.0 - what didI miss?

2010-05-26 Thread Tal Galili
Hello Greg,

First, I wish to thank/compliment you for the coding you did.  I am sure it
will help that guy more then what I had made - I simply didn't know how to
do it the way you did it, so I did what I could.

Regarding the formatting of tables - he needs that output to go for
assignments he is giving his teacher, and he is using R instead of SPSS, so
it is more of a challenge to him.

Regarding all the rest of what you said about aesthetics - I can not add
anything and just say thank you for the interesting read.

But, as to what you wrote in fortune(226), I agree with your point in most
cases - but this is one case that is trickier.
For someone like me who might want something looking different, I can go and
learn how to tinker with the functions output and get what I want.
But when I imagine the learning curve of a blind person going through trying
to make summary.lm give him an output that he can "read" (that is, an output
that when is read - can be easily remembered), I see no reasonable way for
him to learn this by himself in a reasonable time.
So I do think there is a point (for some of the more basic functions), to
make a point and try to create some wrapper function for them that will
produce an easier text-to-speech output.

I do agree with you that probably it shouldn't be the person who wrote the
package who should be dealing with providing a text-to-speech interface to
the functions.
In this sense, I think that Henrik's comments where very interesting and
that I hope someone might take on himself developing this architecture a bit
further.
a TTS package sounds like the right direction to me...


With much respect,
Tal











Contact
Details:---
Contact me: tal.gal...@gmail.com |  972-52-7275845
Read me: www.talgalili.com (Hebrew) | www.biostatistics.co.il (Hebrew) |
www.r-statistics.com (English)
--




On Wed, May 26, 2010 at 10:49 PM, Greg Snow  wrote:

> Inline below:
>
> > From: Tal Galili [mailto:tal.gal...@gmail.com]
> > Sent: Wednesday, May 26, 2010 12:26 AM
> > To: Greg Snow
> > Cc: Faiz Rasool; R-help@r-project.org
> > Subject: Re: [R] Getting sink to work with "message" on R 2.11.0 - what
> didI miss?
> >
> > Hello Greg,
> > Thank you for the coding.
> >
> > A few questions and remarks:
> >
> > 1) I have a feature request that I believe Faiz is interested in:
> > He would like to have the formatting of tables/data.frames in the output
> to be prettier then the one extracted from the console output.  I wonder if
> that is (reasonably) possible.
>
> I have thought about this, but have not yet convinced myself that I am the
> one to do anything about it.  What is "prettier"?  I claim no expertise in
> that area.  Some things are a matter of preference to the beholder, what is
> pretty to me might be ugly to someone else.  I know that many of the
> examples of fancy things that can be done with tabular output to make it
> "prettier" really annoy me.  If we could get a real graphics designer
> involved, then there may be some promise.  But, a real issue to consider is
> does making something pretty change its usefulness.  I remember one project
> where I was exporting matrices from to LaTeX to pdf files.  I jumped through
> some extra hoops to use the LaTeX tool that lines everything up on the
> decimal place, but then when I had the final pdf file, you could not just
> copy and paste the numbers back into another program because each number was
> split into 3 pieces and the decimal was a special character.  I went back
> and just used the format function (now I would use sprintf) to make sure
> that all the numbers had the same number of digits after the decimal and
> therefore lined up.  In that case the numbers could all be copied and pasted
> directly from the pdf to other tools (and for this project that was
> important).  The tables did not look as nice (though most people probably
> would not notice without both versions side by side to compare), but
> usability far outweighed a slight visual improvement.
>
> One of the things that most impressed me about R2wd when I first started
> playing with it was the effort to make the tables look nice.  Use the
> wdTable function in R2wd, but have the word document visible as well, you
> will see the table appear originally in the MS default, but then it is
> changed getting rid of useless 3d effects, unneeded boxes/lines, removing
> excess space, etc.
>
> It seems odd to discuss making something look pretty in a discussion about
> usability for blind people.
>
> What is the difference to the text to speech converter between reading

Re: [R] Getting sink to work with "message" on R 2.11.0 - what didI miss?

2010-05-25 Thread Tal Galili
code provided by David Winsemius. Should I just copy that to
> > console and it will start to divert the output to a txt or a .doc file?
> >
> > Thank you once again to all of those who have participated in this
> > thread.
> > Faiz.
> >
> >  - Original Message -
> > From: "David Winsemius" 
> > To: "Greg Snow" 
> > Cc: 
> > Sent: Saturday, May 22, 2010 2:46 AM
> > Subject: Re: [R] Getting sink to work with "message" on R 2.11.0 - what
> > didI
> > miss?
> >
> >
> > >
> > > On May 21, 2010, at 5:34 PM, Greg Snow wrote:
> > >
> > >> Look at txtStart and friends in the TeachingDemos package as an
> > >> alternative to sink that includes commands as well as output.
> > >
> > > Know the quality of Greg Snows work it will probably be better than
> > mine,
> > > but perhaps:
> > >
> > > > capfn <- function(inp) {
> > > +  instring <- deparse(substitute(inp))
> > > +  capture.output(instring, inp, file="all.Rout") }
> > > > capfn(1+3)
> > >
> > > The file looks like this:
> > >
> > > [1] "1 + 3"
> > > [1] 4
> > >>
> > >> --
> > >> Gregory (Greg) L. Snow Ph.D.
> > >> Statistical Data Center
> > >> Intermountain Healthcare
> > >> greg.s...@imail.org
> > >> 801.408.8111
> > >>
> > >>
> > >>> -Original Message-
> > >>> From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-
> > >>> project.org] On Behalf Of Tal Galili
> > >>> Sent: Friday, May 21, 2010 3:21 PM
> > >>> To: David Winsemius
> > >>> Cc: r-help@r-project.org
> > >>> Subject: Re: [R] Getting sink to work with "message" on R 2.11.0 -
> > what
> > >>> did I miss?
> > >>>
> > >>> Hi David,
> > >>>
> > >>> I want to get both the 4 and the "1+3" that created it.
> > >>>
> > >>> I am trying to help someone else on the mailing list that is
> > looking
> > >>> for a
> > >>> way to "sink" the console into word, so he could have word read it
> > to
> > >>> him
> > >>> (he is blind).
> > >>> I know how to do the second part, but the first part (using sink
> > with
> > >>> the
> > >>> commands, and not just the output), I am somehow missing...
> > >>>
> > >>> Best,
> > >>> Tal
> > >>>
> > >>>
> > >>>
> > >>> Contact
> > >>> Details:---
> > >>> Contact me: tal.gal...@gmail.com |  972-52-7275845
> > >>> Read me: www.talgalili.com (Hebrew) | www.biostatistics.co.il
> > (Hebrew)
> > >>> |
> > >>> www.r-statistics.com (English)
> > >>> ---
> > 
> > >>> ---
> > >>>
> > >>>
> > >>>
> > >>>
> > >>> On Sat, May 22, 2010 at 12:17 AM, David Winsemius
> > >>> wrote:
> > >>>
> > >>>>
> > >>>> On May 21, 2010, at 5:02 PM, Tal Galili wrote:
> > >>>>
> > >>>> Hi all,
> > >>>>>
> > >>>>> I am trying to use type message with sink, like this:
> > >>>>>
> > >>>>> sink("all.Rout", type="message")
> > >>>>> 1+3
> > >>>>>
> > >>>>> sink()
> > >>>>>
> > >>>>> readLines(con = "all.Rout")
> > >>>>>
> > >>>>> So to get the following output:
> > >>>>>
> > >>>>> 1+3
> > >>>>>>
> > >>>>> [1] 4
> > >>>>>
> > >>>>> Obviously this doesn't work.
> > >>>>>
> > >>>>>
> > >>>> What are you trying to do? The sink help page has two rather dire
> > >>> warnings
> > >>>> about not using type="message",  and using type="output would give
>

Re: [R] Increasing the maximum number of rows

2010-05-23 Thread Tal Galili
Hello Jim,
It sounds like a good time to go read about the packages
bigmemory
and/or
ff

Best,
Tal


Contact
Details:---
Contact me: tal.gal...@gmail.com |  972-52-7275845
Read me: www.talgalili.com (Hebrew) | www.biostatistics.co.il (Hebrew) |
www.r-statistics.com (English)
--




On Sun, May 23, 2010 at 12:31 PM, jim holtman  wrote:

> You are trying to create an object with 1G elements.  Given that these
> are integers, this will require about 4GB of space.  If you are
> running on a 32-bit system, which has a total phyical limit of 2-3GB
> depending on what options you are running (at least on Windows), then
> you have exceeded the limits.  It is a good idea to limit your largest
> object to about 25% of physical memory in case copies have to be made
> during some of the analysis.
>
>
> On Sat, May 22, 2010 at 10:31 PM, Wu Gong  wrote:
> >
> > Might there be a limit ?
> >
> >> c <- matrix(1:1, ncol=200)
> >> dim(c)
> > [1] 50200
> >> c <- matrix(1:10, ncol=200)
> > Error: cannot allocate vector of size 3.7 Gb
> >
> >
> > -
> > A R learner.
> > --
> > View this message in context:
> http://r.789695.n4.nabble.com/Increasing-the-maximum-number-of-rows-tp2226950p2227578.html
> > Sent from the R help mailing list archive at Nabble.com.
> >
> > __
> > 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.org/posting-guide.html
> > and provide commented, minimal, self-contained, reproducible code.
> >
>
>
>
> --
> Jim Holtman
> Cincinnati, OH
> +1 513 646 9390
>
> What is the problem that you are trying to solve?
>
> __
> 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.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>

[[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.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Getting sink to work with "message" on R 2.11.0 - what did I miss?

2010-05-22 Thread Tal Galili
Hi all,
As I wrote on other instances of this thread (that I think gotten split
because of me - my apologies for that!), I was able to use Greg Snow
solution to write something up for Faiz (and other blind R users), to help
direct R output into word.
I published it here:
http://www.r-statistics.com/2010/05/helping-the-blind-use-r-by-exporting-r-console-to-word/

<http://www.r-statistics.com/2010/05/helping-the-blind-use-r-by-exporting-r-console-to-word/>I
hope it will help.

My thank for all of you who where willing to help!

With much respect,
Tal

Contact
Details:---
Contact me: tal.gal...@gmail.com |  972-52-7275845
Read me: www.talgalili.com (Hebrew) | www.biostatistics.co.il (Hebrew) |
www.r-statistics.com (English)
--




On Sat, May 22, 2010 at 12:32 PM, Tal Galili  wrote:

> Hello Greg,
> This is exactly what I was looking for, thank you very much for both
> writing the code and of replying here!
>
> I'll publish a small hack that uses this with R2wd shortly, in the hopes it
> will help Faiz request.
>
> Best,
> Tal
>
>
> Contact
> Details:---
> Contact me: tal.gal...@gmail.com |  972-52-7275845
> Read me: www.talgalili.com (Hebrew) | www.biostatistics.co.il (Hebrew) |
> www.r-statistics.com (English)
>
> --
>
>
>
>
> On Sat, May 22, 2010 at 12:34 AM, Greg Snow  wrote:
>
>> Look at txtStart and friends in the TeachingDemos package as an
>> alternative to sink that includes commands as well as output.
>>
>> --
>> Gregory (Greg) L. Snow Ph.D.
>> Statistical Data Center
>> Intermountain Healthcare
>> greg.s...@imail.org
>> 801.408.8111
>>
>>
>> > -Original Message-
>> > From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-
>> > project.org] On Behalf Of Tal Galili
>> > Sent: Friday, May 21, 2010 3:21 PM
>> > To: David Winsemius
>> > Cc: r-help@r-project.org
>> > Subject: Re: [R] Getting sink to work with "message" on R 2.11.0 - what
>> > did I miss?
>> >
>> > Hi David,
>> >
>> > I want to get both the 4 and the "1+3" that created it.
>> >
>> > I am trying to help someone else on the mailing list that is looking
>> > for a
>> > way to "sink" the console into word, so he could have word read it to
>> > him
>> > (he is blind).
>> > I know how to do the second part, but the first part (using sink with
>> > the
>> > commands, and not just the output), I am somehow missing...
>> >
>> > Best,
>> > Tal
>> >
>> >
>> >
>> > Contact
>> > Details:-------
>> > Contact me: tal.gal...@gmail.com |  972-52-7275845
>> > Read me: www.talgalili.com (Hebrew) | www.biostatistics.co.il (Hebrew)
>> > |
>> > www.r-statistics.com (English)
>> > ---
>> > ---
>> >
>> >
>> >
>> >
>> > On Sat, May 22, 2010 at 12:17 AM, David Winsemius
>> > wrote:
>> >
>> > >
>> > > On May 21, 2010, at 5:02 PM, Tal Galili wrote:
>> > >
>> > >  Hi all,
>> > >>
>> > >> I am trying to use type message with sink, like this:
>> > >>
>> > >> sink("all.Rout", type="message")
>> > >> 1+3
>> > >>
>> > >> sink()
>> > >>
>> > >> readLines(con = "all.Rout")
>> > >>
>> > >> So to get the following output:
>> > >>
>> > >>  1+3
>> > >>>
>> > >> [1] 4
>> > >>
>> > >> Obviously this doesn't work.
>> > >>
>> > >>
>> > > What are you trying to do? The sink help page has two rather dire
>> > warnings
>> > > about not using type="message",  and using type="output would give
>> > you what
>> > > you ask:
>> > >
>> > > > sink("all.Rout", type="output")
>> > >
>> > > > 1+3
>> > > >
>> > > > sink()
>> > &

Re: [R] Capturing R console output into a file (sink+savehistory ??)

2010-05-22 Thread Tal Galili
Hello Duncan, David, and other R-help mailing list members.

I found the solution using Greg Snow answer to this thread.

I wanted to have that so to help a blind person who asked on the mailing
list how to direct R output to word.

I wrote up a solution, and wrapped it with words.  It is now published here:
http://www.r-statistics.com/2010/05/helping-the-blind-use-r-by-exporting-r-console-to-word/

Thank you for offering your help.

Best,
Tal

Contact
Details:---
Contact me: tal.gal...@gmail.com |  972-52-7275845
Read me: www.talgalili.com (Hebrew) | www.biostatistics.co.il (Hebrew) |
www.r-statistics.com (English)
--




On Sat, May 22, 2010 at 1:26 PM, Duncan Murdoch wrote:

> Tal Galili wrote:
>
>> After reading more, I understand I didn't formulate my last question
>> correctly, so please allow me to rephrase:
>>
>> What I am looking for is a way to save the R console session output.
>> That is, a command that would combine the results of using:
>> ?sink   # And
>> ?savehistory
>>
>>
>
> I think there's still some ambiguity in the question; I'll try to answer a
> few versions.
>
> Do you want to run R normally, then afterwards save the console log?  That
> depends on what front end you're using.  In the Windows GUI, you can do it
> with
> Ctrl-A to select everything in the console, then menu items File | Save to
> file..., or just Ctrl-C to copy, and then paste it into Word.  Similar
> operations would work on a Mac.
>
> Do you want to run code in a way that writes it to a file without
> displaying it to the screen?  R CMD batch does that.
>
> Do you want to run just a few commands like that? Then try
>
> capture.output(source(stdin(), echo=TRUE))
>
> This will accept commands from the console until it hits an EOF (Ctrl-Z on
> Windows, I don't know on other systems, but Ctrl-D is a good guess) and will
> return
> the results in a character vector, which you could write to a file.
>
> Do you want to run R normally with output on screen, but also logging
> everything to a file?  I don't know how to do that in the R GUI in Windows,
> but there are probably command line tools that could do it.
>
> Duncan Murdoch
>
>   My motivation for this is that doing it will allow someone who is a blind
>> user of R to be able to easily export his results to word so he could have
>> word read him the text.
>> I also imagine it might be useful for session login.
>>
>> Thanks,
>> Tal
>>
>>
>>
>>
>> Contact
>> Details:---
>> Contact me: tal.gal...@gmail.com |  972-52-7275845
>> Read me: www.talgalili.com (Hebrew) | www.biostatistics.co.il (Hebrew) |
>> www.r-statistics.com (English)
>>
>> --
>>
>>
>>
>>
>> On Sat, May 22, 2010 at 12:20 AM, Tal Galili 
>> wrote:
>>
>>
>>
>>> Hi David,
>>>
>>> I want to get both the 4 and the "1+3" that created it.
>>>
>>> I am trying to help someone else on the mailing list that is looking for
>>> a
>>> way to "sink" the console into word, so he could have word read it to him
>>> (he is blind).
>>> I know how to do the second part, but the first part (using sink with the
>>> commands, and not just the output), I am somehow missing...
>>>
>>> Best,
>>> Tal
>>>
>>>
>>>
>>> --------Contact
>>> Details:---
>>> Contact me: tal.gal...@gmail.com |  972-52-7275845
>>> Read me: www.talgalili.com (Hebrew) | www.biostatistics.co.il (Hebrew) |
>>> www.r-statistics.com (English)
>>>
>>>
>>> --
>>>
>>>
>>>
>>>
>>> On Sat, May 22, 2010 at 12:17 AM, David Winsemius <
>>> dwinsem...@comcast.net>wrote:
>>>
>>>
>>>
>>>> On May 21, 2010, at 5:02 PM, Tal Galili wrote:
>>>>
>>>>  Hi all,
>>>>
>>>>
>>>>> I am trying to use type message with sink, like this:
>>>>>
>>>>> sink("all.Rout", type="message")
>>>>> 1+3
>>>>>
>>>>> sink()
&g

Re: [R] Reading results of commands in Microsoft Word typed in the terminal window, A question from a Blind R user.

2010-05-22 Thread Tal Galili
Hello Faiz,

I just wrote an extended tutorial that (I believe) fully addresses your
question, here:

http://www.r-statistics.com/2010/05/helping-the-blind-use-r-by-exporting-r-console-to-word/

(It is based on Greg Snows answer on the other thread, coupled with
the article I once wrote on some of the main features R2wd offers.  I
suggest you read it as well:
http://www.r-statistics.com/2010/05/exporting-r-output-to-ms-word-with-r2wd-an-example-session/
)

Let me know if it helps, and good luck to you!
Best,
Tal


Contact
Details:---
Contact me: tal.gal...@gmail.com |  972-52-7275845
Read me: www.talgalili.com (Hebrew) | www.biostatistics.co.il (Hebrew) |
www.r-statistics.com (English)
--




On Thu, May 20, 2010 at 12:23 PM, Faiz Rasool  wrote:

> Hi all,
>
> I would like to read the results of the commands type in the terminal
> window in Microsoft Word. As a blind user my options are somewhat limited
> and are time consuming if I want to see the results of the commands that I
> have type earlier. for example if  my first two commands were
>  x<-c(1,2,3,4,5)
> mean(x)
> and I have typed ten more commands after the first two commands it is not
> easy for me to see that what was the result of mean(x)
> but if I can somehow divert the results of the commands to Microsoft Word
> it is comparatively easy for me to see what was the result of mean(x) and
> what were the results of other commands. One another advantage of diverting
> R's output to Microsoft Word for me is that from there they can be easily
> copied into assignments as well.
>
> Any ideas and suggestions are appreciated.
>
> faiz.
>
>
>
>
>
>
>
>[[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.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>

[[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.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Getting sink to work with "message" on R 2.11.0 - what did I miss?

2010-05-22 Thread Tal Galili
Hello Greg,
This is exactly what I was looking for, thank you very much for both writing
the code and of replying here!

I'll publish a small hack that uses this with R2wd shortly, in the hopes it
will help Faiz request.

Best,
Tal


Contact
Details:---
Contact me: tal.gal...@gmail.com |  972-52-7275845
Read me: www.talgalili.com (Hebrew) | www.biostatistics.co.il (Hebrew) |
www.r-statistics.com (English)
--




On Sat, May 22, 2010 at 12:34 AM, Greg Snow  wrote:

> Look at txtStart and friends in the TeachingDemos package as an alternative
> to sink that includes commands as well as output.
>
> --
> Gregory (Greg) L. Snow Ph.D.
> Statistical Data Center
> Intermountain Healthcare
> greg.s...@imail.org
> 801.408.8111
>
>
> > -Original Message-
> > From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-
> > project.org] On Behalf Of Tal Galili
> > Sent: Friday, May 21, 2010 3:21 PM
> > To: David Winsemius
> > Cc: r-help@r-project.org
> > Subject: Re: [R] Getting sink to work with "message" on R 2.11.0 - what
> > did I miss?
> >
> > Hi David,
> >
> > I want to get both the 4 and the "1+3" that created it.
> >
> > I am trying to help someone else on the mailing list that is looking
> > for a
> > way to "sink" the console into word, so he could have word read it to
> > him
> > (he is blind).
> > I know how to do the second part, but the first part (using sink with
> > the
> > commands, and not just the output), I am somehow missing...
> >
> > Best,
> > Tal
> >
> >
> >
> > Contact
> > Details:---
> > Contact me: tal.gal...@gmail.com |  972-52-7275845
> > Read me: www.talgalili.com (Hebrew) | www.biostatistics.co.il (Hebrew)
> > |
> > www.r-statistics.com (English)
> > ---
> > ---
> >
> >
> >
> >
> > On Sat, May 22, 2010 at 12:17 AM, David Winsemius
> > wrote:
> >
> > >
> > > On May 21, 2010, at 5:02 PM, Tal Galili wrote:
> > >
> > >  Hi all,
> > >>
> > >> I am trying to use type message with sink, like this:
> > >>
> > >> sink("all.Rout", type="message")
> > >> 1+3
> > >>
> > >> sink()
> > >>
> > >> readLines(con = "all.Rout")
> > >>
> > >> So to get the following output:
> > >>
> > >>  1+3
> > >>>
> > >> [1] 4
> > >>
> > >> Obviously this doesn't work.
> > >>
> > >>
> > > What are you trying to do? The sink help page has two rather dire
> > warnings
> > > about not using type="message",  and using type="output would give
> > you what
> > > you ask:
> > >
> > > > sink("all.Rout", type="output")
> > >
> > > > 1+3
> > > >
> > > > sink()
> > > >
> > > > readLines(con = "all.Rout")
> > > [1] "[1] 4"
> > >
> > > The extra "[1]" and quotes are from the readLines function, not from
> > > all.Rout.
> > >
> > >
> > >  I tried some variations (based on the explanations in the help) but
> > am
> > >> missing something on how to make it work.
> > >>
> > >> Any suggestions?
> > >>
> > >> (p.s: I need this so to help Faiz Rasool in his latest post)
> > >>
> > >> Thanks,
> > >>
> > >> Tal
> > >>
> > > --
> > > David Winsemius, MD
> > > West Hartford, CT
> > >
> > >
> >
> >   [[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.org/posting-
> > guide.html
> > and provide commented, minimal, self-contained, reproducible code.
>

[[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.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] Capturing R console output into a file (sink+savehistory ??)

2010-05-22 Thread Tal Galili
After reading more, I understand I didn't formulate my last question
correctly, so please allow me to rephrase:

What I am looking for is a way to save the R console session output.
That is, a command that would combine the results of using:
?sink   # And
?savehistory

My motivation for this is that doing it will allow someone who is a blind
user of R to be able to easily export his results to word so he could have
word read him the text.
I also imagine it might be useful for session login.

Thanks,
Tal




Contact
Details:---
Contact me: tal.gal...@gmail.com |  972-52-7275845
Read me: www.talgalili.com (Hebrew) | www.biostatistics.co.il (Hebrew) |
www.r-statistics.com (English)
--




On Sat, May 22, 2010 at 12:20 AM, Tal Galili  wrote:

> Hi David,
>
> I want to get both the 4 and the "1+3" that created it.
>
> I am trying to help someone else on the mailing list that is looking for a
> way to "sink" the console into word, so he could have word read it to him
> (he is blind).
> I know how to do the second part, but the first part (using sink with the
> commands, and not just the output), I am somehow missing...
>
> Best,
> Tal
>
>
>
> Contact
> Details:---
> Contact me: tal.gal...@gmail.com |  972-52-7275845
> Read me: www.talgalili.com (Hebrew) | www.biostatistics.co.il (Hebrew) |
> www.r-statistics.com (English)
>
> --
>
>
>
>
> On Sat, May 22, 2010 at 12:17 AM, David Winsemius 
> wrote:
>
>>
>> On May 21, 2010, at 5:02 PM, Tal Galili wrote:
>>
>>  Hi all,
>>>
>>> I am trying to use type message with sink, like this:
>>>
>>> sink("all.Rout", type="message")
>>> 1+3
>>>
>>> sink()
>>>
>>> readLines(con = "all.Rout")
>>>
>>> So to get the following output:
>>>
>>>  1+3
>>>>
>>> [1] 4
>>>
>>> Obviously this doesn't work.
>>>
>>>
>> What are you trying to do? The sink help page has two rather dire warnings
>> about not using type="message",  and using type="output would give you what
>> you ask:
>>
>> > sink("all.Rout", type="output")
>>
>> > 1+3
>> >
>> > sink()
>> >
>> > readLines(con = "all.Rout")
>> [1] "[1] 4"
>>
>> The extra "[1]" and quotes are from the readLines function, not from
>> all.Rout.
>>
>>
>>  I tried some variations (based on the explanations in the help) but am
>>> missing something on how to make it work.
>>>
>>> Any suggestions?
>>>
>>> (p.s: I need this so to help Faiz Rasool in his latest post)
>>>
>>> Thanks,
>>>
>>> Tal
>>>
>> --
>> David Winsemius, MD
>> West Hartford, CT
>>
>>
>

[[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.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Getting sink to work with “message” on R 2.11.0 - what did I miss?

2010-05-21 Thread Tal Galili
Hi David,

I want to get both the 4 and the "1+3" that created it.

I am trying to help someone else on the mailing list that is looking for a
way to "sink" the console into word, so he could have word read it to him
(he is blind).
I know how to do the second part, but the first part (using sink with the
commands, and not just the output), I am somehow missing...

Best,
Tal



Contact
Details:---
Contact me: tal.gal...@gmail.com |  972-52-7275845
Read me: www.talgalili.com (Hebrew) | www.biostatistics.co.il (Hebrew) |
www.r-statistics.com (English)
--




On Sat, May 22, 2010 at 12:17 AM, David Winsemius wrote:

>
> On May 21, 2010, at 5:02 PM, Tal Galili wrote:
>
>  Hi all,
>>
>> I am trying to use type message with sink, like this:
>>
>> sink("all.Rout", type="message")
>> 1+3
>>
>> sink()
>>
>> readLines(con = "all.Rout")
>>
>> So to get the following output:
>>
>>  1+3
>>>
>> [1] 4
>>
>> Obviously this doesn't work.
>>
>>
> What are you trying to do? The sink help page has two rather dire warnings
> about not using type="message",  and using type="output would give you what
> you ask:
>
> > sink("all.Rout", type="output")
>
> > 1+3
> >
> > sink()
> >
> > readLines(con = "all.Rout")
> [1] "[1] 4"
>
> The extra "[1]" and quotes are from the readLines function, not from
> all.Rout.
>
>
>  I tried some variations (based on the explanations in the help) but am
>> missing something on how to make it work.
>>
>> Any suggestions?
>>
>> (p.s: I need this so to help Faiz Rasool in his latest post)
>>
>> Thanks,
>>
>> Tal
>>
> --
> David Winsemius, MD
> West Hartford, CT
>
>

[[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.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] Getting sink to work with “message” on R 2.11.0 - what did I miss?

2010-05-21 Thread Tal Galili
Hi all,

I am trying to use type message with sink, like this:

sink("all.Rout", type="message")
1+3

sink()

readLines(con = "all.Rout")

So to get the following output:

> 1+3
[1] 4

Obviously this doesn't work.

I tried some variations (based on the explanations in the help) but am
missing something on how to make it work.

Any suggestions?

(p.s: I need this so to help Faiz Rasool in his latest post)

Thanks,

Tal



Contact
Details:---
Contact me: tal.gal...@gmail.com |  972-52-7275845
Read me: www.talgalili.com (Hebrew) | www.biostatistics.co.il (Hebrew) |
www.r-statistics.com (English)
--

[[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.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] IF-ELSE question

2010-05-21 Thread Tal Galili
Example:
if (abs(-1-1) <= 3 & abs(1+1) <= 3) {print(1)} else {print(2)}



Contact
Details:---
Contact me: tal.gal...@gmail.com |  972-52-7275845
Read me: www.talgalili.com (Hebrew) | www.biostatistics.co.il (Hebrew) |
www.r-statistics.com (English)
--




On Fri, May 21, 2010 at 4:39 PM, Sarah Goslee wrote:

> You need parentheses enclosing the entire if() statement:
>
> if(something & somethingelse) {
>   do this
> }
>
> Sarah
>
> On Fri, May 21, 2010 at 9:36 AM, Robert U  wrote:
> > Dear
> > R-users,
> >
> >
> >
> > I've been trying to write a script but i encounter much problems with
> basic
> > functions.. That is, i try to write a simple IF ELSE statement, with 2
> > requirements for the IF :
> >
> >
> >
> > if (abs(x + Dataset$LAT[1]) <= 3) and (abs(y + Dataset$LONG[1]) <= 3) {z
> > <- 1} else {z <-0}
> >
> >
> >
> > This does not work. So far i succeeded with one of tthe conditions :
> >
> >
> >
> > if (abs(x + Dataset$LAT[1]) <= 3) {z <- 1} else {z <-0}
> >> this work, so i tried to had the second condition with "and" or
> > "&" or even "& &&" as writen in operators
> > r-help but none of my trials works, it retrun "unexpected symbol
> > "{" ...
> >
> >
> >
> > any tip ?
> >
> >
> >
> >
> >
> > with regards
> >
> >
> >
> >
>
>
> --
> Sarah Goslee
> http://www.functionaldiversity.org
>
> __
> 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.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>

[[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.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] writing function

2010-05-20 Thread Tal Galili
Try this:

paste("tot", 4:16, sep = "")


Or:

func <- function(x,y)
{
 paste("tot", x:y, sep = "")
}
func(4,16)




Contact
Details:---
Contact me: tal.gal...@gmail.com |  972-52-7275845
Read me: www.talgalili.com (Hebrew) | www.biostatistics.co.il (Hebrew) |
www.r-statistics.com (English)
--




On Thu, May 20, 2010 at 6:54 PM, arnaud Gaboury wrote:

> Dear group,
>
> I am trying to write functions, but as a beginner, everything is not so
> obvious.
> Let's say I want the results in a list of elemts like this :
> tot1, tot2, etc
>
> Here is a function:
>
> toto <-
> function(x,y)
>
> {
>
> for(i in x:y){
>
> paste(c("tot",i),collapse="")<-(i*2)
>
> }
> }
>
> If I type this :
> >toto(1,5)
> I get this message error:
> Error in paste(c("tot", i), collapse = "") <- (i * 2) :
>  target of assignment expands to non-language object
>
> How can I write it to get the result I want (i.e tot1, tot2... with tot1=2,
> tot2=4...) in my environment?
>
> TY for any help
>
> __
> 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.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>

[[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.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Deleting a file on a drive from within R

2010-05-20 Thread Tal Galili
Check out:
?unlink





Contact
Details:---
Contact me: tal.gal...@gmail.com |  972-52-7275845
Read me: www.talgalili.com (Hebrew) | www.biostatistics.co.il (Hebrew) |
www.r-statistics.com (English)
--




On Thu, May 20, 2010 at 11:46 AM, Sergey Goriatchev wrote:

> Hello,
>
> I have an Excel file on a drive and I extract data from it into R session.
> Once I have extracted the data, I want to delete that Excel file from the
> drive.
> Can I do that from within R, please?
>
> Thank you for help!
>
> Regards,
> Sergey
>
> __
> 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.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>

[[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.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Generating all possible models from full model

2010-05-19 Thread Tal Galili
Hi Tim,

Here is a rather clumsy way of going about your task:

# -- example code -
func.getY.getX.return.lm <- function(Y,  X.matrix , lm.id.vec)
{
# gets a Y, a vec of T/F and a X.matrix
# performs lm
# and returns output
 potential.X.size <- length(lm.id.vec) + 1
 lm.data <- data.frame(Y, X.matrix[,lm.id.vec])
 lm1 <- lm(Y ~ . ,data = lm.data)
return(lm1)
}

data(mtcars)
X <- mtcars[, -1]
Y <- mtcars[, 1]
X.toUse <- sample(c(T,F), 10, T)

func.getY.getX.return.lm(Y, X , X.toUse )

# -- example code -


Now what you will need to do is:
1) Create an X matrix that includes the vectors of all the interactions you
will be interested in.
2) make a matrix of TRUE/FALSE id's for the variables you would like to use.
3) go through that matrix and build the models (using, for example, the
function I gave above)
4) insert the output to a big list(), and on that list perform the checks
that interest you for finding your model.

As Frank Harrell and the others have mentioned, you are walking on VERY
shaky grounds (in terms of the stability of your models
predictive/explanatory power).

In case you develop the code more, I'd be curious to see how you did it.

Good luck,
Tal






Contact
Details:---
Contact me: tal.gal...@gmail.com |  972-52-7275845
Read me: www.talgalili.com (Hebrew) | www.biostatistics.co.il (Hebrew) |
www.r-statistics.com (English)
--




On Wed, May 19, 2010 at 8:48 PM, Tim Clark  wrote:

> Tal,
>
> No, I am definitely not wanting to generate 7! models.  At least not with
> my current dataset.  That would only be if I was running all first order
> terms and all possible interactions.  In this example I am only wanting to
> run interactions for the variables year:site, which should give 2^7+32=160
> possible models.  What I am really asking is if everyone writes out all of
> their models of interest by hand, or if there is some function that has been
> written that makes it easier to generate all the models.  I keep making
> mistakes when writing out lots of models, and was hoping for something that
> would automate the process so that I was sure I didn't screw up in the
> formulas.  This may just require more practice on my part, but it seems like
> such a common problem that someone would have written a function to do it.
> It looks like a function could be written using combn() with different
> number of elements.  I will see if I can come up with something.
>
> I am using AIC values to pick the best models and the function modavg() in
> the package AICcmodavg to generate model averages.  I have read a lot about
> the problems of stepwise selection, so I am trying to find something besides
> regsubsets() from leaps package.
>
> Thanks,
>
> Tim
>
>
> Tim Clark
> Department of Zoology
> University of Hawaii
>
> --- On *Wed, 5/19/10, Tal Galili * wrote:
>
>
> From: Tal Galili 
> Subject: Re: [R] Generating all possible models from full model
> To: "Tim Clark" 
> Cc: r-help@r-project.org
> Date: Wednesday, May 19, 2010, 12:47 AM
>
>  Hi Tim,
> So if I understand you correctly, you are talking about 7! models, that's
> hell of alot, are you considering model-selection/multiple-comparisons
> issues when you are picking your models ?
> If you are hoping to do cross validation on such a variaty of models, you
> might find out it wouldn't scale for larger problems.
>
>  There is the
> regsubsets from the {leaps} package.
> Which can also work with biglm and bigglm objects.  I am not sure what
> alternative exists for other glm objects, but it's worth checking.
>
> I can imagine you can write a function that will create all the variable
> combinations using a combo of the functions combn (to create all the
> combinations) with eval+parse.
> But asI wrote, I think you're issue here is the model selection, not just
> the creation of all the models.
>
> Best,
> Tal
>
>
>
>
>
> Contact
> Details:---
> Contact me: 
> tal.gal...@gmail.com<http://us.mc361.mail.yahoo.com/mc/compose?to=tal.gal...@gmail.com>|
>   972-52-7275845
> Read me: www.talgalili.com (Hebrew) | www.biostatistics.co.il (Hebrew) |
> www.r-statistics.com (English)
>
> --
>
>
>
>
> On Wed, May 19, 2010 at 2:00 PM, Tim Clark 
> http://us.mc361.mail.yahoo.com/mc/compose?to=mudiver1...@yahoo.com>
> > wrote:
>
>>   Not necessarily.  In the example I included:
>>
>>

Re: [R] Calling R-tists

2010-05-19 Thread Tal Galili
Hi Katharine,
Very cool idea!
I republished your call on my blog:
http://www.r-statistics.com/2010/05/user-2010-is-looking-for-a-t-shirt-design/

And encourage people who will create such a design to link to it (for
example by posting about it here on the list), and also to tag it (if they
put it on flickr or picasa and so on) with the tag:
useR2010Tshirt
So it would be easy later to find online.

I hope this call will be heard by creative designers,
Best,
Tal



Contact
Details:---
Contact me: tal.gal...@gmail.com |  972-52-7275845
Read me: www.talgalili.com (Hebrew) | www.biostatistics.co.il (Hebrew) |
www.r-statistics.com (English)
--




On Wed, May 19, 2010 at 6:56 PM, Katharine Mullen  wrote:

> Participants in the R User Conference, useR! 2010, July 21-23,
> (http://R-project.org/useR-2010) will each receive a t-shirt, thanks to
> the sponsorship of Mango Solutions (http://www.mango-solutions.com/).
>
> This email is a call for designs for the front of the t-shirt.  The design
> should be made using a single color of your choice.  The design should be
> in the form of a high-resolution (at least 300 dpi) jpeg, png or gif file,
> and will be printed on a 13'' x 13'' area on the shirt.  There are no
> rules for the content.
>
> The shirts will be white.  The back of the t-shirt will include the useR!
> logo (in blue and black), and the logo of Mango Solutions (in orange and
> black).
>
> The staff of Mango Solutions will decide which design to use.  The creator
> of the chosen design will receive 5 free t-shirts plus a book token (i.e.,
> a gift certificate for a book).  You don't have to be registered for the
> conference to enter a design.
>
> Please email your design proposal by Sunday, June 6, to
> usert-sh...@mango-solutions.com.  The designer that submits the chosen
> design will be notified by June 15th.
>
> Thanks in advance for enriching the conference and the wardrobes of useR!
> participants!
>
> Kate Mullen, for the useR! 2010 Organizing Committee
>

[[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.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Generating all possible models from full model

2010-05-19 Thread Tal Galili
My apologies for rushing to write 7! , that one was not thought out at all.


Tal


Contact
Details:---
Contact me: tal.gal...@gmail.com |  972-52-7275845
Read me: www.talgalili.com (Hebrew) | www.biostatistics.co.il (Hebrew) |
www.r-statistics.com (English)
--




On Wed, May 19, 2010 at 5:01 PM, Ben Bolker  wrote:

> Tal Galili  gmail.com> writes:
> >
> > On Wed, May 19, 2010 at 7:38 AM, Tim Clark  yahoo.com>
> wrote:
> >
> > > Is there a function that will allow me to run all model iterations if I
> > > specify a full model?
> > >
> > >
> > m1234567<-glm.convert(glm.nb(mantas~site*year+cosmonth+sinmonth+
> >   coslunar+sinlunar+plankton,
> >   data=mydata))
> > >
> > > and have R run all the other models.
>
>   PS  I think it's slightly fewer than 2^8 (=256) models [I believe
> MuMIn will respect marginality constraints, so models with the site:year
> model will necessarily have site and year in them (I just tried an
> example, with MuMIn::dredge, and it comes out to 160).  A lot better
> than 7! = 5040
>
> __
> 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.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>

[[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.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Generating all possible models from full model

2010-05-19 Thread Tal Galili
Hi Tim,
So if I understand you correctly, you are talking about 7! models, that's
hell of alot, are you considering model-selection/multiple-comparisons
issues when you are picking your models ?
If you are hoping to do cross validation on such a variaty of models, you
might find out it wouldn't scale for larger problems.

 There is the
regsubsets from the {leaps} package.
Which can also work with biglm and bigglm objects.  I am not sure what
alternative exists for other glm objects, but it's worth checking.

I can imagine you can write a function that will create all the variable
combinations using a combo of the functions combn (to create all the
combinations) with eval+parse.
But asI wrote, I think you're issue here is the model selection, not just
the creation of all the models.

Best,
Tal





Contact
Details:---
Contact me: tal.gal...@gmail.com |  972-52-7275845
Read me: www.talgalili.com (Hebrew) | www.biostatistics.co.il (Hebrew) |
www.r-statistics.com (English)
--




On Wed, May 19, 2010 at 2:00 PM, Tim Clark  wrote:

> Not necessarily.  In the example I included:
>
> manta~year*site
>
> in the model, which includes both first order terms and interactions:
>
> manta~year+site+year:site
>
> I am just wanting to know if there is an easier way than writing out all
> the possible models long-hand given a full model with all desired terms,
> where some terms may have interactions and others don't.
>
>
>
>
>
>
> Tim Clark
> Department of Zoology
> University of Hawaii
>
> --- On *Tue, 5/18/10, Tal Galili * wrote:
>
>
> From: Tal Galili 
> Subject: Re: [R] Generating all possible models from full model
> To: "Tim Clark" 
> Cc: r-help@r-project.org
> Date: Tuesday, May 18, 2010, 9:40 PM
>
>
> Do you mean only all of the FIRST order models (that is, without
> interactions) ?
>
>
>
>
> Contact
> Details:---
> Contact me: tal.gal...@gmail.com<http://mc/compose?to=tal.gal...@gmail.com>|  
> 972-52-7275845
> Read me: www.talgalili.com (Hebrew) | www.biostatistics.co.il (Hebrew) |
> www.r-statistics.com (English)
>
> --
>
>
>
>
> On Wed, May 19, 2010 at 7:38 AM, Tim Clark 
> http://mc/compose?to=mudiver1...@yahoo.com>
> > wrote:
>
>> Is there a function that will allow me to run all model iterations if I
>> specify a full model?  I am using information criteria to choose between
>> possible candidate models.  I have been writing out all possible model
>> combinations by hand, and I am always worried that I am missing models or
>> have made a mistake somewhere.  It is also difficult to alter models if I
>> want to change a term.  For example, below are the set of models I would
>> like to run.  Is there a way to specify the full model and have R generate
>> the rest?  I.e. specify
>>
>>  
>> m1234567<-glm.convert(glm.nb(mantas~site*year+cosmonth+sinmonth+coslunar+sinlunar+plankton,
>> data=mydata))
>>
>> and have R run all the other models.
>>
>>
>> library(MASS)
>>
>> #Intercept only
>>  m0<-glm.convert(glm.nb(mantas~1,data=mydata))
>>
>> #One term - 7 models
>>  #Manta abundance is greater at one of the two sites
>>  m1<-glm.convert(glm.nb(mantas~site,data=mydata))
>>  #Manta abundance increases each year as the population increases in size
>> due to births or immigration being greater than deaths and emmigration
>>  m2<-glm.convert(glm.nb(mantas~year,data=mydata))
>>  #Manta abundances increases during part of the year due to seasonal
>> cycles in resources (mates, food)
>>  m3<-glm.convert(glm.nb(mantas~cosmonth,data=mydata))
>>  m4<-glm.convert(glm.nb(mantas~sinmonth,data=mydata))
>>  #Manta abundance decreases with increased lunar phase
>>  m5<-glm.convert(glm.nb(mantas~coslunar, data=mydata))
>>  m6<-glm.convert(glm.nb(mantas~sinlunar, data=mydata))
>>  #Manta abundance increases with increased levels of plankton
>>  m7<-glm.convert(glm.nb(mantas~plankton,data=mydata))
>>
>> #Two terms - 21 models
>>  m12<-glm.convert(glm.nb(mantas~site*year, data=mydata))   #Interaction
>> term to account for hotel being closed at Keauhou for some years
>>  m13<-glm.convert(glm.nb(mantas~site+cosmonth,data=mydata))
>>  m14<-glm.convert(glm.nb(mantas~site+sinmonth,data=mydata))
>>  m15<-glm.convert(glm.nb(man

Re: [R] Generating all possible models from full model

2010-05-19 Thread Tal Galili
Do you mean only all of the FIRST order models (that is, without
interactions) ?




Contact
Details:---
Contact me: tal.gal...@gmail.com |  972-52-7275845
Read me: www.talgalili.com (Hebrew) | www.biostatistics.co.il (Hebrew) |
www.r-statistics.com (English)
--




On Wed, May 19, 2010 at 7:38 AM, Tim Clark  wrote:

> Is there a function that will allow me to run all model iterations if I
> specify a full model?  I am using information criteria to choose between
> possible candidate models.  I have been writing out all possible model
> combinations by hand, and I am always worried that I am missing models or
> have made a mistake somewhere.  It is also difficult to alter models if I
> want to change a term.  For example, below are the set of models I would
> like to run.  Is there a way to specify the full model and have R generate
> the rest?  I.e. specify
>
>  
> m1234567<-glm.convert(glm.nb(mantas~site*year+cosmonth+sinmonth+coslunar+sinlunar+plankton,
> data=mydata))
>
> and have R run all the other models.
>
>
> library(MASS)
>
> #Intercept only
>  m0<-glm.convert(glm.nb(mantas~1,data=mydata))
>
> #One term - 7 models
>  #Manta abundance is greater at one of the two sites
>  m1<-glm.convert(glm.nb(mantas~site,data=mydata))
>  #Manta abundance increases each year as the population increases in size
> due to births or immigration being greater than deaths and emmigration
>  m2<-glm.convert(glm.nb(mantas~year,data=mydata))
>  #Manta abundances increases during part of the year due to seasonal cycles
> in resources (mates, food)
>  m3<-glm.convert(glm.nb(mantas~cosmonth,data=mydata))
>  m4<-glm.convert(glm.nb(mantas~sinmonth,data=mydata))
>  #Manta abundance decreases with increased lunar phase
>  m5<-glm.convert(glm.nb(mantas~coslunar, data=mydata))
>  m6<-glm.convert(glm.nb(mantas~sinlunar, data=mydata))
>  #Manta abundance increases with increased levels of plankton
>  m7<-glm.convert(glm.nb(mantas~plankton,data=mydata))
>
> #Two terms - 21 models
>  m12<-glm.convert(glm.nb(mantas~site*year, data=mydata))   #Interaction
> term to account for hotel being closed at Keauhou for some years
>  m13<-glm.convert(glm.nb(mantas~site+cosmonth,data=mydata))
>  m14<-glm.convert(glm.nb(mantas~site+sinmonth,data=mydata))
>  m15<-glm.convert(glm.nb(mantas~site+coslunar,data=mydata))
>  m16<-glm.convert(glm.nb(mantas~site+sinlunar,data=mydata))
>  m17<-glm.convert(glm.nb(mantas~site+plankton,data=mydata)) #Should this
> have an interaction term?  Plankton may varry by site
>
>  m23<-glm.convert(glm.nb(mantas~year+cosmonth,data=mydata))
>  m24<-glm.convert(glm.nb(mantas~year+sinmonth,data=mydata))
>  m25<-glm.convert(glm.nb(mantas~year+coslunar,data=mydata))
>  m26<-glm.convert(glm.nb(mantas~year+sinlunar,data=mydata))
>  m27<-glm.convert(glm.nb(mantas~year+plankton,data=mydata))
>
>  m34<-glm.convert(glm.nb(mantas~cosmonth+sinmonth,data=mydata))
>  m35<-glm.convert(glm.nb(mantas~cosmonth+coslunar,data=mydata))
>  m36<-glm.convert(glm.nb(mantas~cosmonth+sinlunar,data=mydata))
>  m37<-glm.convert(glm.nb(mantas~cosmonth+plankton,data=mydata))
>  #Interaction term?  Plankton may vary by season
>
>  m45<-glm.convert(glm.nb(mantas~sinmonth+coslunar, data=mydata))
>  m46<-glm.convert(glm.nb(mantas~sinmonth+sinlunar, data=mydata))
>  m47<-glm.convert(glm.nb(mantas~sinmonth+plankton, data=mydata))
> #Interaction term?  Plankton may vary by season
>
>  m56<-glm.convert(glm.nb(mantas~coslunar+sinlunar, data=mydata))
>  m57<-glm.convert(glm.nb(mantas~coslunar+plankton, data=mydata))
>
>  m67<-glm.convert(glm.nb(mantas~sinlunar+plankton, data=mydata))
> #Interaction term?  Plankton may have lunar cycles
>
> #Three terms - 35 models
>  m123<-glm.convert(glm.nb(mantas~site*year+cosmonth, data=mydata))
>  m124<-glm.convert(glm.nb(mantas~site*year+sinmonth, data=mydata))
>  m125<-glm.convert(glm.nb(mantas~site*year+coslunar, data=mydata))
>  m126<-glm.convert(glm.nb(mantas~site*year+sinlunar, data=mydata))
>  m127<-glm.convert(glm.nb(mantas~site*year+plankton, data=mydata))
>
>  m134<-glm.convert(glm.nb(mantas~site+cosmonth+sinmonth,data=mydata))
>  m135<-glm.convert(glm.nb(mantas~site+cosmonth+coslunar,data=mydata))
>  m136<-glm.convert(glm.nb(mantas~site+cosmonth+sinlunar,data=mydata))
>  m137<-glm.convert(glm.nb(mantas~site+cosmonth+plankton,data=mydata))
>
>  m145<-glm.convert(glm.nb(mantas~site+sinmonth+coslunar,data=mydata))
>  m146<-glm.convert(glm.nb(mantas~site+sinmonth+sinlunar,data=mydata))
>  m147<-glm.convert(glm.nb(mantas~site+sinmonth+plankton,data=mydata))
>
>  m156<-glm.convert(glm.nb(mantas~site+coslunar+sinlunar,data=mydata))
>  m157<-glm.convert(glm.nb(mantas~site+coslunar+plankton,data=mydata))
>
>  m167<-glm.convert(glm.nb(mantas~site+sinlunar+plankton,data=mydata))
>
>  m234<-glm.convert(glm.nb(mantas~year+cosmonth+sinmonth,data=mydata))
>  m235<-glm.con

Re: [R] p value

2010-05-16 Thread Tal Galili
Hi Soham,
I don't feel your question is well defined.
But an equally ill defined answer would be:
Through a permutation test.



Contact
Details:---
Contact me: tal.gal...@gmail.com |  972-52-7275845
Read me: www.talgalili.com (Hebrew) | www.biostatistics.co.il (Hebrew) |
www.r-statistics.com (English)
--




On Sat, May 15, 2010 at 7:04 PM, Soham wrote:

>
> How to compute the p-value of a statistic generally?
> --
> View this message in context:
> http://r.789695.n4.nabble.com/p-value-tp2217867p2217867.html
> Sent from the R help mailing list archive at Nabble.com.
>
> __
> 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.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>

[[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.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Dataframe to word, using R2wd

2010-05-15 Thread Tal Galili
Hi Felipe,
I don't think it is possible at this time (if anyone knows otherwise -
please correct me).

I am informing Christian (the R2wd developer) about your feature suggestion,
he might be interested in it.

Cheers,
Tal



Contact
Details:---
Contact me: tal.gal...@gmail.com |  972-52-7275845
Read me: www.talgalili.com (Hebrew) | www.biostatistics.co.il (Hebrew) |
www.r-statistics.com (English)
--




On Sat, May 15, 2010 at 11:15 PM, Felipe Carrillo
wrote:

> Hi:
> Just adding on to this question...Is it a way to add footnotes to tables
> with R2wd? I started using this nice package
> about a month ago and is one of the things that I can't figure out yet..
>
> Felipe D. Carrillo
> Supervisory Fishery Biologist
> Department of the Interior
> US Fish & Wildlife Service
> California, USA
>
>
>
> - Original Message 
> > From: Tal Galili 
> > To: Jeremy Miles 
> > Cc: r-help@r-project.org
> > Sent: Sat, May 15, 2010 1:03:12 AM
> > Subject: Re: [R] Dataframe to word, using R2wd
> >
> > Hi Jeremy,
>
> 1) This is not the command to use on data.frames, it is:
> > wdTable
> 2) There is a slightly newer version of R2wd, that (for now) can only
> > be
> downloaded
> > here:
>
> http://www.r-statistics.com/2010/05/exporting-r-output-to-ms-word-with-r2wd-an-example-session/
> (That
> > posts also offers a step by step on
> > R2wd)
>
> Cheers,
> Tal
>
>
>
> Contact
> Details:---
> Contact
> > me: > href="mailto:tal.gal...@gmail.com";>tal.gal...@gmail.com |
> > 972-52-7275845
> Read me: > href="http://www.talgalili.com";>www.talgalili.com (Hebrew) | >
> target="_blank"
> > href="http://www.biostatistics.co.il";>www.biostatistics.co.il (Hebrew)
> > |
> > href="http://www.r-statistics.com";>www.r-statistics.com
> > (English)
>
> --
>
>
>
>
> On
> > Sat, May 15, 2010 at 8:46 AM, Jeremy Miles <> ymailto="mailto:
> jeremy.mi...@gmail.com"
> > href="mailto:jeremy.mi...@gmail.com";>jeremy.mi...@gmail.com>wrote:
>
> >
> > Hi All,
> >
> > I'm trying to use R2wd to send a dataframe to
> > Word.  The dataframe
> > isn't huge - 300 rows, 12 variables, although
> > it has some long strings
> > in it.
> >
> > Using:
> >
> >
> > wdTable(format(myDataFrame))
> >
> > or
> >
> >
> > wdTable(myDataFrame)
> >
> > Produces a very complex table, which Word
> > struggles to process and
> > layout.  (I can't work out what the table
> > is - it seems to be nested
> > tables. Converting to text gives one long
> > column.)
> >
> > Using
> >
> >
> > wdBody(MyDataFrame)
> >
> > or
> >
> >
> > wdNormal(MyDataFrame)
> >
> > Is there another way to use R2wd to send
> > the dataframe to word?
> >
> > Thanks (in advance)
> >
> >
> > Jeremy
> >
> >
> >
> >
> > --
> > Jeremy Miles
> >
> > Psychology Research Methods Wiki: > href="
> http://www.researchmethodsinpsychology.com";>
> www.researchmethodsinpsychology.com
> >
> >
> > __
> > > ymailto="mailto:R-help@r-project.org";
> > href="mailto:R-help@r-project.org";>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.org/posting-guide.html
> > and
> > provide commented, minimal, self-contained, reproducible
> > code.
> >
>
> [[alternative HTML version
> > deleted]]
>
> __
> > ymailto="mailto:R-help@r-project.org";
> > href="mailto:R-help@r-project.org";>R-help@r-project.org mailing list
> > href="https://stat.ethz.ch/mailman/listinfo/r-help"; target=_blank
> > >https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting
> > guide > >http://www.R-project.org/posting-guide.html
> and provide commented,
> > minimal, self-contained, reproducible code.
>
>
>
>
>

[[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.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Dataframe to word, using R2wd

2010-05-15 Thread Tal Galili
Hi Jeremy,

1) This is not the command to use on data.frames, it is: wdTable
2) There is a slightly newer version of R2wd, that (for now) can only be
downloaded here:
http://www.r-statistics.com/2010/05/exporting-r-output-to-ms-word-with-r2wd-an-example-session/
(That posts also offers a step by step on R2wd)

Cheers,
Tal



Contact
Details:---
Contact me: tal.gal...@gmail.com |  972-52-7275845
Read me: www.talgalili.com (Hebrew) | www.biostatistics.co.il (Hebrew) |
www.r-statistics.com (English)
--




On Sat, May 15, 2010 at 8:46 AM, Jeremy Miles wrote:

> Hi All,
>
> I'm trying to use R2wd to send a dataframe to Word.  The dataframe
> isn't huge - 300 rows, 12 variables, although it has some long strings
> in it.
>
> Using:
>
> wdTable(format(myDataFrame))
>
> or
>
> wdTable(myDataFrame)
>
> Produces a very complex table, which Word struggles to process and
> layout.  (I can't work out what the table is - it seems to be nested
> tables. Converting to text gives one long column.)
>
> Using
>
> wdBody(MyDataFrame)
>
> or
>
> wdNormal(MyDataFrame)
>
> Is there another way to use R2wd to send the dataframe to word?
>
> Thanks (in advance)
>
> Jeremy
>
>
>
>
> --
> Jeremy Miles
> Psychology Research Methods Wiki: www.researchmethodsinpsychology.com
>
> __
> 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.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>

[[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.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Removing points

2010-05-12 Thread Tal Galili
Hi Egg,
please read this:
http://www.statmethods.net/management/subset.html



Contact
Details:---
Contact me: tal.gal...@gmail.com |  972-52-7275845
Read me: www.talgalili.com (Hebrew) | www.biostatistics.co.il (Hebrew) |
www.r-statistics.com (English)
--




On Wed, May 12, 2010 at 3:33 PM, Blue.Egg  wrote:

>
> I have a some data, and imagine a column of how many parasitic eggs found
> in
> the stool of some children some of the children we do not have this data so
> we put -1 in stead. How can you remove the people with -1, to calculate
> means and do box plots. Thank you!
> --
> View this message in context:
> http://r.789695.n4.nabble.com/Removing-points-tp2195945p2195945.html
> Sent from the R help mailing list archive at Nabble.com.
>
> __
> 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.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>

[[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.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Revolution R and the R Community?

2010-05-12 Thread Tal Galili
Thanks for the corrections Duncan,
I didn't know about Bill Dunlap affiliation with Tibco.


Best,
Tal


Contact
Details:---
Contact me: tal.gal...@gmail.com |  972-52-7275845
Read me: www.talgalili.com (Hebrew) | www.biostatistics.co.il (Hebrew) |
www.r-statistics.com (English)
--




On Wed, May 12, 2010 at 2:17 AM, Duncan Murdoch wrote:

> On 11/05/2010 4:03 PM, Tal Galili wrote:
>
>> Hi Iaw (or Ivo ?!),
>>
>> I have seen REvolution in useR 2009.  I personally know one of the
>> students
>> they sponsored once, and have been following David Smith's (great) online
>> work for over a year now.
>> REvolution is real, and I hope they (and more companies like them)
>> will flourish in the future.
>>
>> I agree with Duncan that finding the balance between open-source community
>> and paid company employers can be a tricky game to play.  But it seems to
>> me
>> that REvolution (and especially David Smith), have been doing not bad at
>> all.
>> I hope that other R based companies, like:
>>
>>   - R+ <http://www.experience-rplus.com/> from XL Solutions.
>>   - RStat <http://random-technologies-llc.com/products/RStat/rstat>
>>   - S-PLUS <http://en.wikipedia.org/wiki/S-PLUS>
>>
>>
>
> S-PLUS isn't a company, it's a product.  The company that currently owns it
> is Tibco Software, as the Wikipedia article mentions.  And Bill Dunlap of
> Tibco has been making valuable contributions to S and S-PLUS for years, and
> more recently to R on this mailing list.
>
> Duncan Murdoch
>
>> Would have acted more in a similar way.
>> (And if they do, I didn't know about it and would like to have been more
>> informed)
>>
>>
>> Best,
>> Tal
>>
>>
>>
>> Contact
>> Details:---
>> Contact me: tal.gal...@gmail.com |  972-52-7275845
>> Read me: www.talgalili.com (Hebrew) | www.biostatistics.co.il (Hebrew) |
>> www.r-statistics.com (English)
>>
>> --
>>
>>
>>
>>
>> On Tue, May 11, 2010 at 6:08 PM, ivo welch  wrote:
>>
>>
>>
>>> As an end-user, I wonder about Revolution R.  Is the relationship
>>> between Revolution R and the R community at-large a positive one?  Do
>>> the former contribute to the development efforts of the latter?  Is
>>> there a competitive aspect?  is their forum competitive with r-help?
>>> any other thoughts?  (most of all, I simply hope that they help some
>>> of the many helpful experts on this forum, who have volunteered their
>>> expertise to help me so many times.)
>>>
>>> as for me, I discovered Revolution a few days ago.  they did not have
>>> an OSX enterprise version, so I downloaded the community version.
>>> alas, after installation, starting up their GUI interface, I
>>> immediately get
>>>   Error in library(Revobase) : there is no package called 'Revobase'
>>> I tried to sign up for their forum, but the forum email responder
>>> seems to be dead.  (I sent them an email, but have not heard back
>>> yet.)  someone else here tried out their enterprise version on a linux
>>> machine, but it had ugly problems in the creation of the top-level
>>> Makefile.  so, my initial impression is not overwhelming.  are they
>>> for real?
>>>
>>> regards,
>>>
>>> /iaw
>>>
>>> 
>>> Ivo Welch (ivo.we...@brown.edu, ivo.we...@gmail.com)
>>>
>>> __
>>> 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.org/posting-guide.html
>>> and provide commented, minimal, self-contained, reproducible code.
>>>
>>>
>>>
>>
>>[[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.org/posting-guide.html
>> and provide commented, minimal, self-contained, reproducible code.
>>
>>
>
>

[[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.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] What are your thoughts about the "R programming" wiki-book ?

2010-05-11 Thread Tal Galili
An R community member named Ajay wrote today about the "R programming"
wiki-book project (link to Ajay's
post<http://decisionstats.wordpress.com/2010/05/10/the-r-online-wikibook/>),
and I would like to know what you think about the project:
http://en.wikibooks.org/wiki/R_Programming

Ajay believes that

> "What we need is a consolidated document that can add 1) show multiple
> packages on the same topic (eg clustering) 2) be used as a handy reference
> book 3) be editable and updated for package specific updates."



Personally I am a bit skeptical.
It seems that there are already many good (freely contributed) books about R
on:
http://cran.r-project.org/doc/contrib/
What will this book has to offer over the others?
Who will have use for a community based book about R? (beginners? advanced
useRs? R gurus ?!)
Who will be willing to contribute to such a book? (will the authors of the
above books be willing to set their content CC, to go into the public book)
Who can (and might want) to coordinate the development of such a book?
Who might work at editing such a book? (I know many of the active R
community users are already putting much time into coding, and answering
questions here and on SO, so will they have the time?)

I can imagine University instructors encouraging students to work on the
book as homework assignments. I can imagine R book authors
contributing material, and R community leaders taking on working on such a
project.
But I am truly wondering if there is a real need or interest in such a
project by members of the R community.


Tal Galili







Contact
Details:---
Contact me: tal.gal...@gmail.com |  972-52-7275845
Read me: www.talgalili.com (Hebrew) | www.biostatistics.co.il (Hebrew) |
www.r-statistics.com (English)
--

[[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.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Revolution R and the R Community?

2010-05-11 Thread Tal Galili
Hi Iaw (or Ivo ?!),

I have seen REvolution in useR 2009.  I personally know one of the students
they sponsored once, and have been following David Smith's (great) online
work for over a year now.
REvolution is real, and I hope they (and more companies like them)
will flourish in the future.

I agree with Duncan that finding the balance between open-source community
and paid company employers can be a tricky game to play.  But it seems to me
that REvolution (and especially David Smith), have been doing not bad at
all.
I hope that other R based companies, like:

   - R+  from XL Solutions.
   - RStat 
   - S-PLUS 

Would have acted more in a similar way.
(And if they do, I didn't know about it and would like to have been more
informed)


Best,
Tal



Contact
Details:---
Contact me: tal.gal...@gmail.com |  972-52-7275845
Read me: www.talgalili.com (Hebrew) | www.biostatistics.co.il (Hebrew) |
www.r-statistics.com (English)
--




On Tue, May 11, 2010 at 6:08 PM, ivo welch  wrote:

> As an end-user, I wonder about Revolution R.  Is the relationship
> between Revolution R and the R community at-large a positive one?  Do
> the former contribute to the development efforts of the latter?  Is
> there a competitive aspect?  is their forum competitive with r-help?
> any other thoughts?  (most of all, I simply hope that they help some
> of the many helpful experts on this forum, who have volunteered their
> expertise to help me so many times.)
>
> as for me, I discovered Revolution a few days ago.  they did not have
> an OSX enterprise version, so I downloaded the community version.
> alas, after installation, starting up their GUI interface, I
> immediately get
>Error in library(Revobase) : there is no package called 'Revobase'
> I tried to sign up for their forum, but the forum email responder
> seems to be dead.  (I sent them an email, but have not heard back
> yet.)  someone else here tried out their enterprise version on a linux
> machine, but it had ugly problems in the creation of the top-level
> Makefile.  so, my initial impression is not overwhelming.  are they
> for real?
>
> regards,
>
> /iaw
>
> 
> Ivo Welch (ivo.we...@brown.edu, ivo.we...@gmail.com)
>
> __
> 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.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>

[[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.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Smoothing Techniques - short stepwise functions with spikes

2010-05-11 Thread Tal Galili
Hi Ralf,

I can't offer you many resources, but the few I came across are:
1) loess (or the older version: lowess)
2) smooth
3) rollapply (from the zoo pacakge)

I used a combination of 1 and 3 when creating an R implementaion for a
(simplistic) quantile loess, you might find the code useful:
http://www.r-statistics.com/2010/04/quantile-loess-combining-a-moving-quantile-window-with-loess-r-function/



Best,
Tal



Contact
Details:---
Contact me: tal.gal...@gmail.com |  972-52-7275845
Read me: www.talgalili.com (Hebrew) | www.biostatistics.co.il (Hebrew) |
www.r-statistics.com (English)
--




On Tue, May 11, 2010 at 10:17 AM, Ralf B  wrote:

> R Friends,
>
> I have data from which I would like to learn a more general
> (smoothened) trend by applying data smoothing methods. Data points
> follow a positive stepwise function.
>
>
> |x
> x
> |   
> |   xx
> | xxx 
> |   x
> |
> |
>  xxx 
> |__
>
>
> Data points from each step should not be interacting with any other
> step. The outliers I want to to remove are spikes as shown in the
> diagram. These spikes do not have more than one or two points. I
> consider larger groups as relevant and want to keep them in. I
> sometimes have less than 5 points for each step, and up to 50 at max.
> Given these conditions would you suggest using one of the moving
> averages (e.g. SMA, EMA, DEMA, ...) or the locally linear regression
> (lowress) method. Are there any other options? Does anybody know a
> good site that overviews all methods without going to much into
> mathematical details but rather focusing on the requirements and
> underlying assumptions of each method? Is there perhaps even a package
> that runs and visualizes a comparison on the data similar to packages
> like 'party' ? (with 1000s of active packages, one can always hope for
> that)
>
> Thanks in advance!
> Ralf
>
> __
> 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.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>

[[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.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Count cases in a list

2010-05-08 Thread Tal Galili
Elegant Henrique, thanks !


Contact
Details:---
Contact me: tal.gal...@gmail.com |  972-52-7275845
Read me: www.talgalili.com (Hebrew) | www.biostatistics.co.il (Hebrew) |
www.r-statistics.com (English)
--




On Sun, May 9, 2010 at 1:23 AM, Henrique Dallazuanna wrote:

> Try this also:
>
> colSums(sapply(nombreC, grepl, nombreL))
>
>
> On Sat, May 8, 2010 at 5:22 AM, Sebastian Kruk wrote:
>
>> 2010/5/8 Tal Galili :
>> > Hi Sebastian,
>> > Please check if this does what you want:
>> >
>> > nombreL <- c("Alvaro Perez", "Sebastián García", "Luis Gomez", "Jorge
>> Rial",
>> > "Ronaldo Apud", "Ana María Bianco")
>> > nombreC <- c("Alvaro", "Ana","Jorge","Ronaldo", "Sebastian")
>> > func1 <- function(x)
>> > {
>> > grep(x, noquote(nombreL))
>> > }
>> > lapply(noquote(nombreC), func1)
>>
>> Hi Tal, I just want to count how many time appear any element of
>> nombreC in nombreL.
>>
>> Alvaro appear once in nombreL so cuenta = 1
>> Ana appear 0 times in nombreL so cuenta = 1
>> Jorge appear 0 times in nombreL so cuenta = 1
>> Ronaldo appear 0 times in nombreL so cuenta = 1
>> Sebastian appear once in nombreL so cuenta = 1+1
>>
>> Sebastian.
>>
>> __
>> 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.org/posting-guide.html
>> and provide commented, minimal, self-contained, reproducible code.
>>
>
>
>
> --
> Henrique Dallazuanna
> Curitiba-Paraná-Brasil
> 25° 25' 40" S 49° 16' 22" O
>

[[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.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Count cases in a list

2010-05-08 Thread Tal Galili
There you go:


nombreL <- c("Alvaro Perez", "Sebastian García","Sebastian 2", "Luis Gomez",
"Jorge Rial", "Ronaldo Apud", "Ana María Bianco")
nombreC <- c("Alvaro", "Ana","Jorge","Ronaldo", "Sebastian")

func1 <- function(x)
{
length(grep(x, noquote(nombreL)))
}
a <- lapply(noquote(nombreC), func1)
names(a) <- nombreC
a





Contact
Details:---
Contact me: tal.gal...@gmail.com |  972-52-7275845
Read me: www.talgalili.com (Hebrew) | www.biostatistics.co.il (Hebrew) |
www.r-statistics.com (English)
----------




On Sat, May 8, 2010 at 11:22 AM, Sebastian Kruk wrote:

> 2010/5/8 Tal Galili :
> > Hi Sebastian,
> > Please check if this does what you want:
> >
> > nombreL <- c("Alvaro Perez", "Sebastián García", "Luis Gomez", "Jorge
> Rial",
> > "Ronaldo Apud", "Ana María Bianco")
> > nombreC <- c("Alvaro", "Ana","Jorge","Ronaldo", "Sebastian")
> > func1 <- function(x)
> > {
> > grep(x, noquote(nombreL))
> > }
> > lapply(noquote(nombreC), func1)
>
> Hi Tal, I just want to count how many time appear any element of
> nombreC in nombreL.
>
> Alvaro appear once in nombreL so cuenta = 1
> Ana appear 0 times in nombreL so cuenta = 1
> Jorge appear 0 times in nombreL so cuenta = 1
> Ronaldo appear 0 times in nombreL so cuenta = 1
> Sebastian appear once in nombreL so cuenta = 1+1
>
> Sebastian.
>

[[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.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] meaning of "<<-"

2010-05-08 Thread Tal Galili
try:
?"<<-"

This is used for assigning to an object that exists in a parent environment
from which you made the assigning (thus allows some playing with R's lexical
scoping).



Contact
Details:---
Contact me: tal.gal...@gmail.com |  972-52-7275845
Read me: www.talgalili.com (Hebrew) | www.biostatistics.co.il (Hebrew) |
www.r-statistics.com (English)
--




On Sat, May 8, 2010 at 9:59 AM, Ruihong Huang  wrote:

> Hi,
>
> In my memory, "<<-" means assigning via a pointer or alias. But this is not
> officially defined in "R Language Definition". Could anybody help for the
> clarification? Thank you very much!
>
> Bests,
> Ruihong
>
> __
> 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.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>

[[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.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Count cases in a list

2010-05-08 Thread Tal Galili
Hi Sebastian,
Please check if this does what you want:


nombreL <- c("Alvaro Perez", "Sebastián García", "Luis Gomez", "Jorge Rial",
"Ronaldo Apud", "Ana María Bianco")
nombreC <- c("Alvaro", "Ana","Jorge","Ronaldo", "Sebastian")

func1 <- function(x)
{
grep(x, noquote(nombreL))
}
lapply(noquote(nombreC), func1)






Contact
Details:---
Contact me: tal.gal...@gmail.com |  972-52-7275845
Read me: www.talgalili.com (Hebrew) | www.biostatistics.co.il (Hebrew) |
www.r-statistics.com (English)
--




On Sat, May 8, 2010 at 10:46 AM, Sebastian Kruk wrote:

> Hi, for example I have two list:
>
> nombreL <- c("Alvaro Perez", "Sebastián García", "Luis Gomez", "Jorge
> Rial", "Ronaldo Apud",..., "Ana María Bianco")
> nombreC <- c("Alvaro",..., "Ana",...,"Jorge",...,"Ronaldo",
> "Sebastian",...)
>
> and my code is:
>
> cuenta <- 0
> topL <- length(nombreL)
> topC <- length(nombreC)
> for (i in 1:topL) {
> for (j in 1:topC) {
>   k <-
> grep(noquote(nombreL[i]),nombreC[j])
>   if (length(k) > 0){
>
> cuenta <- cuenta + 1
>}
>  }
>
> Thanks,
>
> Sebastian.
>

[[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.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Count cases in a list

2010-05-08 Thread Tal Galili
Hi Sebastian,

Please add an example to the code you made, so to make it easier to help
you.

p.s: it seems possible to make it faster using lapply

Tal


Contact
Details:---
Contact me: tal.gal...@gmail.com |  972-52-7275845
Read me: www.talgalili.com (Hebrew) | www.biostatistics.co.il (Hebrew) |
www.r-statistics.com (English)
--




On Sat, May 8, 2010 at 10:13 AM, Sebastian Kruk wrote:

> Hi everybody, I would like to count how many times names in list L,
> nombreL,  apear in list C, nombreC.
>
> Can I improve the next program?
>
> cuenta <- 0
> topL <- length(nombreL)
> topC <- length(nombreC)
> for (i in 1:topL) {
>  for (j in 1:topC) {
>k <-
> grep(noquote(nombreL[i]),nombreC[j])
>if (length(k) > 0){
>
> cuenta <- cuenta + 1
>   }
> }
>
> ¿Is there a way to vectorizad?
>
> Thanks,
>
> Sebastián.
>
> Saludos,
>
> Sebastián.
>
> __
> 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.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>

[[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.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Any way to apply TWO functions with tapply()?

2010-05-07 Thread Tal Galili
Look at the reshape package - it allows that when using "cast"



Contact
Details:---
Contact me: tal.gal...@gmail.com |  972-52-7275845
Read me: www.talgalili.com (Hebrew) | www.biostatistics.co.il (Hebrew) |
www.r-statistics.com (English)
--




On Fri, May 7, 2010 at 12:39 PM, Phil Wieland  wrote:

>
> I need to compute the mean and the standard deviation of a data set and
> would
> like to have the results in one table/data frame. I call tapply() two times
> and do then merge the resulting tables to have them all in one table. Is
> there any way to tell tapply() to use the functions mean and sd within one
> function call? Something like tapply(data$response, list(data$targets,
> data$conditions), c(mean, sd)).
>
> Thanks in advance.
> --
> View this message in context:
> http://r.789695.n4.nabble.com/Any-way-to-apply-TWO-functions-with-tapply-tp2133924p2133924.html
> Sent from the R help mailing list archive at Nabble.com.
>
> __
> 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.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>

[[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.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] What is the best way to have "R" output tables in an MS Word format?

2010-05-06 Thread Tal Galili
Hi Chris,

Following this thread, I started experimenting with the R2wd package myself.

I wrote to the developer who gave me some promising news (that is - that an
updated package is expected to be released in the next couple of months)
I wrote about this, and gave an example session on what I found can be done
with R2wd here:
http://www.r-statistics.com/2010/05/exporting-r-output-to-ms-word-with-r2wd-an-example-session/

This package is in it's early stages, but can still function well (though
probably much less then what a Latex person can do with Sweave)

Tal



Contact
Details:---
Contact me: tal.gal...@gmail.com |  972-52-7275845
Read me: www.talgalili.com (Hebrew) | www.biostatistics.co.il (Hebrew) |
www.r-statistics.com (English)
--




On Mon, May 3, 2010 at 4:47 PM, Chris Evans  wrote:

> Thanks Tal & Thomas, I am now experimenting with both SWord and R2wd and
> both are certainly a huge step forward for me, tied as I am to Word and
> the Windoze/M$ world for now.
>
> Chris
>
>
>
> Tal Galili sent the following  at 01/05/2010 09:44:
>
> > Hi all,
> > I forwarded this question to the r-com mailing list, and received the
> > following reply from Thomas Baier :
> >
> >
> >
> > Hi Tal,
> >
> > two solutions immediately come to my mind: SWord
> > (http://rcom.univie.ac.at) and R2wd (from CRAN).
> >
> > If creating a paper in Word, then SWord may be the better choice, if you
> > want to create reports controlled from R, R2wd might be the better one.
> >
> > Best,
> > Thomas
>
> They both look potentially very useful and can do wonderful embedding of
> tabulated data frames and graphics to judge form the help page for R2wd
> and that works on my set up.  However, I'm crash R2wd and hange R
> passing lm output with:
>lm.D9 <- lm(weight ~ group) # from the lm help page
>wdBody(lm.D9)
>
> I'll try to link up with whoever I should (Thomas, Christian?) to debug
> this (and, of course, it may be particular to my set up) but I still
> argue there's a problem letting these output capabilities go to packages
> and not putting them in the core:
> a) it's easy for us not to know of them, I didn't know of R2wd nor ascii
> for example,
> b) surely to have provided really excellent graphic output in the core
> is a bit incongruent with having even provided tabs for matrices and
> tables?
>
> I'll pick up more in response to Max Kuhn's message.
>
> Very best,
>
> Chris
>
>
>
>
> --
> Chris Evans  Skype: chris-psyctc
> Consultant Psychiatrist in Psychotherapy, Notts. PDD network;
> Trust Research Governance Lead and Clinical Director, Psychological
>  Therapies Directorate in Local Services, Nottinghamshire NHS Trust;
> Professor, Psychotherapy, Nottingham University
> *If I am writing from one of those roles, it will be clear. Otherwise*
> *my views are my own and not representative of those institutions*
> If you have difficulty Emailing me on this address or getting a reply,
> send again but cc to:   chris dot evans at nottshc dot nhs dot uk
> and to: c dot evans at nottingham dot ac dot uk
>
> __
> 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.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>

[[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.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] How to solve: Error with Anova {car} due to "deficient rank" ?

2010-05-06 Thread Tal Galili
Hello Peter,

Thank you very much for the fresh approach!
I will go with it to the researcher.

Thanks again,
Tal


Contact
Details:---
Contact me: tal.gal...@gmail.com |  972-52-7275845
Read me: www.talgalili.com (Hebrew) | www.biostatistics.co.il (Hebrew) |
www.r-statistics.com (English)
--




On Thu, May 6, 2010 at 4:47 PM, peter dalgaard  wrote:

>
> On May 6, 2010, at 1:42 PM, Tal Galili wrote:
>
> > Hi Joris,
> > Thank you for taking the time to answer.
> >
> > This data is of a test done for 39 subjects (from 2 groups) over 12
> weeks.
> > And the questions I would like to answer are:
> > 1) Did the test results changed over time?
> > 2) Did the group effected the test results?
> > 3) Did the effect of time differ for each group?
> >
> > I understand that the general limitation of using repeated measures anova
> > here is (obviously) that even if one get's a significant "effect" of
> time,
> > the analysis doesn't give any clue as to how time influences the test
> (the
> > same goes for the interaction term).
> > But a more appropriate tool would probably be some sort of GAM lm, which
> is
> > based on models I don't have much understanding of (yet).
> >
> > I am using this test since the researcher for whom I am doing the
> analysis
> > asked me to use it (since this is what was done in the previous work on
> > similar data, done by someone else).
> >
> > Due to the current stage of my ignorance, and the researchers tendency
> > towards this analysis - I am not sure how to proceed.
> >
>
> You may be able to get through with anova.mlm (little-a anova) and
> sphericity assumptions. However, I wouldn't trust the results.
>
> These data are nowhere near normally distributed, and with the size of the
> data set and the pattern of many series of straight 4s, I don't think anyone
> has a chance of figuring out how this affects the p-values.
>
> I'd rather do something like this (with the original "dat", before
> jittering):
>
> First look at the average patterns per group:
>
> > aggregate(dat[-1],dat[1],mean)
>   DC week6 week7week8week9   week10   week11
> 1control 4 4 4.00 3.90 3.90 3.90
> 2 head (20g) 4 4 3.894737 3.789474 3.736842 3.736842
> week12   week13   week14   week15   week16   week17
> 1 3.90 3.90 3.90 3.85 3.85 3.75
> 2 3.736842 3.684211 3.526316 3.421053 3.368421 3.315789
> > matplot(t(aggregate(dat[-1],dat[1],mean)[-1]))
>
> which looks promising and roughly linear. However, the slopes might differ
> between subjects and this would be the appropriate variation to gauge the
> mean slope differences against. So let's compute the individual slopes:
>
> > slope <- apply(dat[-1],1,function(x)coef(lm(x~I(1:12)))[2])
>
> We can compare these between the groups with a t test:
>
> > t.test(slope~dat$DC)
>
>Welch Two Sample t-test
>
> data:  slope by dat$DC
> t = 1.6138, df = 27.189, p-value = 0.1181
> alternative hypothesis: true difference in means is not equal to 0
> 95 percent confidence interval:
>  -0.01217805  0.10203819
> sample estimates:
>   mean in group control mean in group head (20g)
> -0.01800699  -0.06293706
>
> However, looking more carefully at the data, we realize that many slopes
> are exactly zero, so a nonparametric test might be in order. It doesn't
> change anything, though:
>
> > wilcox.test(slope~dat$DC)
>
>Wilcoxon rank sum test with continuity correction
>
> data:  slope by dat$DC
> W = 232, p-value = 0.09845
> alternative hypothesis: true location shift is not equal to 0
>
> Warning message:
> In wilcox.test.default(x = c(-2.36672330631823e-16, -2.36672330631823e-16,
>  :
>  cannot compute exact p-value with ties
> --
> Peter Dalgaard
> Center for Statistics, Copenhagen Business School
> Solbjerg Plads 3, 2000 Frederiksberg, Denmark
> Phone: (+45)38153501
> Email: pd@cbs.dk  Priv: pda...@gmail.com
>
>

[[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.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] How to solve: Error with Anova {car} due to "deficient rank" ?

2010-05-06 Thread Tal Galili
Thank you for the detailed answer Joris,

First - I would like to nominate your final remark:

> Sorry to break it to you, but this is a classic case of "analysis died due
> to a lack of usable data".

(In response to a question on why Anova {car} broke with the Error

 SSP matrix is apparently of deficient rank = 7 < 11

)

As a fortune.


Secondly,
I would have went with your suggestion for a mixed model, unless both you
(and Peter, in the later post), didn't believe in it to give reliable enough
results.
I will go with Peter's suggestion, and will do my best at explaining the
researcher the situation.

Again, many thanks for both you and Peter for helping out.  It is an amazing
feeling to get such helpful replies from people like you two in this mailing
list!
Tal



Contact
Details:---
Contact me: tal.gal...@gmail.com |  972-52-7275845
Read me: www.talgalili.com (Hebrew) | www.biostatistics.co.il (Hebrew) |
www.r-statistics.com (English)
--




On Thu, May 6, 2010 at 4:13 PM, Joris Meys  wrote:

> Hi Tal,
>
> a few remarks:
> - The way you did it, week is essentially a nominal variable. The analysis
> you use completely ignores the sequence of the weeks. You have to take that
> one into account as well.
>
> - The method you use tells me you're attempting some kind of
> repeated-measures anova in R. Actually, the code looks almost identical to
> http://gribblelab.org/2009/03/09/repeated-measures-anova-using-r/ , third
> case. One of the other options can be used as well, provided you're not
> interested in taking autocorrelation into account. I wouldn't bother too
> much about it in this dataset anyway.
>
> That brings us to the following possibility :
>
> # restructure the data
> NewFrame <- data.frame(val=unlist(dat[,-1]))
> NewFrame$week <- rep(6:17,each=39)
> NewFrame$subject <- rep(1:39,times=12)
> NewFrame$DC <- rep(dat[,1],times=12)
>
> # build the model
> require(nlme)
> options(contrasts=c("contr.sum","contr.poly")) # I always use those
>
> mod.ok <- lme(val ~ DC*week, random = ~1|subject/week , data=NewFrame)
> anova(mod.ok)
>
> Post-hoc testing can be done as explained in the link above.
>
> Mind you, I'm not saying this is a perfect or even a correct solution. You
> have to be VERY careful when interpreting the results. But at least it gives
> you some indication about the research questions you have.
>
> In any case, the amount of information in your data is pretty low due to
> the high amount of identical values. Actually, you can in no possible way
> consider your dependent a continuous variable, so a repeated measures ANOVA
> is not the correct method. forget about GAM modelling, they have far too
> much degrees of freedom to do anything that makes sense with your data.
> Actually, as I see it you should have some kind of ordinal logistic model,
> but again, your data is far too sparse and has too much aliasing to expect
> anything decent coming out of such an analysis.
>
> Sorry to break it to you, but this is a classic case of "analysis died due
> to a lack of useable data".
>
> Cheers
> Joris
>
>
>
> On Thu, May 6, 2010 at 1:42 PM, Tal Galili  wrote:
>
>> Hi Joris,
>> Thank you for taking the time to answer.
>>
>> This data is of a test done for 39 subjects (from 2 groups) over 12 weeks.
>> And the questions I would like to answer are:
>> 1) Did the test results changed over time?
>> 2) Did the group effected the test results?
>> 3) Did the effect of time differ for each group?
>>
>> I understand that the general limitation of using repeated measures anova
>> here is (obviously) that even if one get's a significant "effect" of time,
>> the analysis doesn't give any clue as to how time influences the test (the
>> same goes for the interaction term).
>> But a more appropriate tool would probably be some sort of GAM lm, which
>> is based on models I don't have much understanding of (yet).
>>
>> I am using this test since the researcher for whom I am doing the analysis
>> asked me to use it (since this is what was done in the previous work on
>> similar data, done by someone else).
>>
>> Due to the current stage of my ignorance, and the researchers tendency
>> towards this analysis - I am not sure how to proceed.
>>
>>
>>
>> Thanks,
>> Tal
>>
>>
>>
>>
>> Contact
>> Details:---
>> Contact

Re: [R] How to solve: Error with Anova {car} due to "deficient rank" ?

2010-05-06 Thread Tal Galili
Hi Joris,
Thank you for taking the time to answer.

This data is of a test done for 39 subjects (from 2 groups) over 12 weeks.
And the questions I would like to answer are:
1) Did the test results changed over time?
2) Did the group effected the test results?
3) Did the effect of time differ for each group?

I understand that the general limitation of using repeated measures anova
here is (obviously) that even if one get's a significant "effect" of time,
the analysis doesn't give any clue as to how time influences the test (the
same goes for the interaction term).
But a more appropriate tool would probably be some sort of GAM lm, which is
based on models I don't have much understanding of (yet).

I am using this test since the researcher for whom I am doing the analysis
asked me to use it (since this is what was done in the previous work on
similar data, done by someone else).

Due to the current stage of my ignorance, and the researchers tendency
towards this analysis - I am not sure how to proceed.



Thanks,
Tal




Contact
Details:---
Contact me: tal.gal...@gmail.com |  972-52-7275845
Read me: www.talgalili.com (Hebrew) | www.biostatistics.co.il (Hebrew) |
www.r-statistics.com (English)
--




On Thu, May 6, 2010 at 2:25 PM, Joris Meys  wrote:

> Hi Tal,
>
> The problem is not the analysis, but the data. You have 2 weeks that only
> have a value 4, and 31 out of 39 cases that only have a value 4. Your
> residual matrix is thus malformed, and has a lower rank than the amount of
> weeks minus 1. This makes it impossible to do the calculations in the Anova
> procedure. Even when dropping the weeks where the value is 4 for every case,
> the analysis can't be performed.
>
> Cheers
> Joris
>
> What is it you want to know exactly?
> On Thu, May 6, 2010 at 11:57 AM, Tal Galili  wrote:
>
>> Hello all,
>>
>> I am getting the following error:
>>
>> Error in linear.hypothesis.mlm(mod, hyp.matrix.1, SSPE = SSPE, V = V,  :
>>  The error SSP matrix is apparently of deficient rank = 7 < 11
>>
>> After running:
>> mod.ok <- lm(as.matrix(dat[,-1]) ~  DC, data=dat)
>> (av.ok <- Anova(mod.ok, idata=idata, idesign=~week))
>>
>> Although if I jitter the data in "dat", the function seems to work.
>>
>> What should I do ?
>>
>> (here is a self sufficient example code of my situation)
>>
>>
>>
>>
>>
>> #- R code 
>>
>> # creating data
>> idata <- structure(list(week = structure(1:12, .Label = c("week6",
>> "week7",
>> "week8", "week9", "week10", "week11", "week12", "week13", "week14",
>>  "week15", "week16", "week17"), class = "factor")), .Names = "week",
>> row.names = c(NA,
>> -12L), class = "data.frame")
>>
>> dat <- structure(list(DC = structure(c(1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
>> 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 2L, 2L, 2L, 2L,
>>  2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L), .Label =
>> c("control",
>> "head (20g)"), class = "factor"), week6 = c(4, 4, 4, 4, 4, 4,
>>  4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
>> 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4), week7 = c(4, 4, 4, 4, 4,
>>  4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
>> 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4), week8 = c(4, 4, 4, 4,
>>  4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
>> 4, 4, 4, 4, 4, 4, 3, 4, 3, 4, 4, 4, 4, 4), week9 = c(4, 4, 3,
>>  4, 4, 3, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
>> 3, 4, 4, 4, 4, 4, 4, 3, 4, 3, 4, 4, 4, 4, 3), week10 = c(4, 4,
>>  3, 4, 4, 3, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 3, 4,
>> 4, 3, 4, 4, 4, 4, 4, 4, 3, 4, 3, 4, 4, 4, 4, 3), week11 = c(4,
>>  4, 3, 4, 4, 3, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 3,
>> 4, 4, 3, 4, 4, 4, 4, 4, 4, 3, 4, 3, 4, 4, 4, 4, 3), week12 = c(4,
>>  4, 3, 4, 4, 3, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 3,
>> 4, 4, 3, 4, 4, 4, 4, 4, 4, 3, 4, 3, 4, 4, 4, 4, 3), week13 = c(4,
>>  4, 3, 4, 4, 3, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 2,
>> 4, 4, 3, 4, 4, 4, 4, 4, 4, 3, 4, 3, 4, 4, 4, 4, 3), week14 = c(4,
>>  4, 3, 4, 4, 3, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 2,
>> 4, 4, 2, 4, 3, 4, 4, 4, 4, 3, 4, 2, 4, 4, 4, 4, 3), week15 = c(4,
>>  4, 2, 4, 4, 3, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,

[R] How to solve: Error with Anova {car} due to "deficient rank" ?

2010-05-06 Thread Tal Galili
Hello all,

I am getting the following error:

Error in linear.hypothesis.mlm(mod, hyp.matrix.1, SSPE = SSPE, V = V,  :
  The error SSP matrix is apparently of deficient rank = 7 < 11

After running:
mod.ok <- lm(as.matrix(dat[,-1]) ~  DC, data=dat)
(av.ok <- Anova(mod.ok, idata=idata, idesign=~week))

Although if I jitter the data in "dat", the function seems to work.

What should I do ?

(here is a self sufficient example code of my situation)





#- R code 

# creating data
idata <- structure(list(week = structure(1:12, .Label = c("week6", "week7",
"week8", "week9", "week10", "week11", "week12", "week13", "week14",
 "week15", "week16", "week17"), class = "factor")), .Names = "week",
row.names = c(NA,
-12L), class = "data.frame")

dat <- structure(list(DC = structure(c(1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 2L, 2L, 2L, 2L,
 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L), .Label =
c("control",
"head (20g)"), class = "factor"), week6 = c(4, 4, 4, 4, 4, 4,
 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4), week7 = c(4, 4, 4, 4, 4,
 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4), week8 = c(4, 4, 4, 4,
 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
4, 4, 4, 4, 4, 4, 3, 4, 3, 4, 4, 4, 4, 4), week9 = c(4, 4, 3,
 4, 4, 3, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
3, 4, 4, 4, 4, 4, 4, 3, 4, 3, 4, 4, 4, 4, 3), week10 = c(4, 4,
 3, 4, 4, 3, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 3, 4,
4, 3, 4, 4, 4, 4, 4, 4, 3, 4, 3, 4, 4, 4, 4, 3), week11 = c(4,
 4, 3, 4, 4, 3, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 3,
4, 4, 3, 4, 4, 4, 4, 4, 4, 3, 4, 3, 4, 4, 4, 4, 3), week12 = c(4,
 4, 3, 4, 4, 3, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 3,
4, 4, 3, 4, 4, 4, 4, 4, 4, 3, 4, 3, 4, 4, 4, 4, 3), week13 = c(4,
 4, 3, 4, 4, 3, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 2,
4, 4, 3, 4, 4, 4, 4, 4, 4, 3, 4, 3, 4, 4, 4, 4, 3), week14 = c(4,
 4, 3, 4, 4, 3, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 2,
4, 4, 2, 4, 3, 4, 4, 4, 4, 3, 4, 2, 4, 4, 4, 4, 3), week15 = c(4,
 4, 2, 4, 4, 3, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 2,
4, 4, 1, 4, 3, 4, 4, 4, 4, 2, 4, 2, 4, 4, 4, 4, 3), week16 = c(4,
 4, 2, 4, 4, 3, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 2,
4, 4, 0, 4, 3, 4, 4, 4, 4, 2, 4, 2, 4, 4, 4, 4, 3), week17 = c(4,
 4, 1, 4, 4, 2, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 2,
4, 4, 0, 4, 2, 4, 4, 4, 4, 2, 4, 2, 4, 4, 4, 4, 3)), .Names = c("DC",
 "week6", "week7", "week8", "week9", "week10", "week11", "week12",
"week13", "week14", "week15", "week16", "week17"), class = c("cast_df",
 "data.frame"), row.names = c(NA, 39L))
# This fails
mod.ok <- lm(as.matrix(dat[,-1]) ~  DC, data=dat)
(av.ok <- Anova(mod.ok, idata=idata, idesign=~week))

# But this works
dat[,-1] <- apply(dat[,-1],2, jitter )
mod.ok <- lm(as.matrix(dat[,-1]) ~  DC, data=dat)
(av.ok <- Anova(mod.ok, idata=idata, idesign=~week))

#- R code 


Thanks in advance,
Tal

Contact
Details:---
Contact me: tal.gal...@gmail.com |  972-52-7275845
Read me: www.talgalili.com (Hebrew) | www.biostatistics.co.il (Hebrew) |
www.r-statistics.com (English)
--

[[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.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Data frame "pivoting"

2010-05-06 Thread Tal Galili
Hi Angelo,
You can solve thins using the "melt" and "cast" functions in the "reshape"
package.

Tal




Contact
Details:---
Contact me: tal.gal...@gmail.com |  972-52-7275845
Read me: www.talgalili.com (Hebrew) | www.biostatistics.co.il (Hebrew) |
www.r-statistics.com (English)
--




On Thu, May 6, 2010 at 10:06 AM,  wrote:

>
> Dear R experts,
>
> I am trying to solve this problem, related to the possibility of
> changing the shape of a data frame using a "pivoting-like" function.
> I have a dataframe df of observations as follows:
>
> ID  VALIDITY YEAR   PROPERTYPROPERTY VALUE
> A1  2007P1  V1
> A1  2007P2  V2
> A1  2007P3  V3
> A1  2008P1  V10
> A1  2008P2  V20
> A2  2007P5  V50
> A2  2008P6  V20
> A3  2007P1  V1
> A3  2007P3  V30
> A3  2008P1  V10
> A3  2008P2  V4
> A3  2008P6  V25
>
> (you can imagine that this data is collected every year from a sample of
> people with several "measures" - weight, number of children, income...
> It can happen that some properties could be missing from some IDs).
> I have to obtain a data frame like this:
>
>
> ID  VALIDITY YEAR   P1  P2  P3  P4  P5  P6
> A1  2007V1  V2  V3  -   -
> -
> A1  200 V10 V20 -   -   -
> -
> A2  2007-   -   -   -   V50
> -
> A2  2008-   -   -   -   -
> V60
> A3  2007V1  -   V30 -   -
> -
> A3  2008V10 V4  -   -   -
> V25
>
>
> I started using the operator "by" obtaining the different "slices" of
> data:
>
> by(df,df$PROPERTY,list)
>
> but then ?
>
> I also tried using tapply:
>
> tapply(df$CID,df$PROPERTY,list)
>
> obtaining a list but I am not able to go on.
>
> Can you help me ?
>
> Thank you in advance
>
> Angelo Linardi
>
>
>
> ** Le e-mail provenienti dalla Banca d'Italia sono trasmesse in buona fede
> e non
> comportano alcun vincolo ne' creano obblighi per la Banca stessa, salvo che
> cio' non
> sia espressamente previsto da un accordo scritto.
> Questa e-mail e' confidenziale. Qualora l'avesse ricevuta per errore, La
> preghiamo di
> comunicarne via e-mail la ricezione al mittente e di distruggerne il
> contenuto. La
> informiamo inoltre che l'utilizzo non autorizzato del messaggio o dei suoi
> allegati
> potrebbe costituire reato. Grazie per la collaborazione.
> -- E-mails from the Bank of Italy are sent in good faith but they are
> neither binding on
> the Bank nor to be understood as creating any obligation on its part except
> where
> provided for in a written agreement. This e-mail is confidential. If you
> have received it
> by mistake, please inform the sender by reply e-mail and delete it from
> your system.
> Please also note that the unauthorized disclosure or use of the message or
> any
> attachments could be an offence. Thank you for your cooperation. **
>
> __
> 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.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>

[[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.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] OLS Regression diagnostic measures check list - what to consider?

2010-05-05 Thread Tal Galili
Hello dear R help list,

I wish to compile a check-list for diagnostic measures for OLS regression.

My question:
Can you offer more (or newer) tests/measures for the validity of a linear
model then what is given here:
http://www.statmethods.net/stats/rdiagnostics.html

This resource gives a list of measures to test for:
OUTLIERS, INFLUENTIAL OBSERVATIONS, NON-NORMALITY, NON-CONSTANT ERROR
VARIANCE, MULTI-COLLINEARITY, NONLINEARITY, NON-INDEPENDENCE OF ERRORS and
some global validation.

I came across it after searching online for ways to validate a regression
model.
Although this is a great list, I am wondering if there is any newer methods
that are overlooked, or important consideration to take into account that
are not described in that page.


Thanks,
Tal



Contact
Details:---
Contact me: tal.gal...@gmail.com |  972-52-7275845
Read me: www.talgalili.com (Hebrew) | www.biostatistics.co.il (Hebrew) |
www.r-statistics.com (English)
--

[[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.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] R for web browser

2010-05-04 Thread Tal Galili
I wrote about R-Node last month, it offers what you are talking about:

http://www.r-statistics.com/2010/04/r-node-a-web-front-end-to-r-with-protovis/




Contact
Details:---
Contact me: tal.gal...@gmail.com |  972-52-7275845
Read me: www.talgalili.com (Hebrew) | www.biostatistics.co.il (Hebrew) |
www.r-statistics.com (English)
--




On Tue, May 4, 2010 at 4:51 PM, Lanna Jin  wrote:

>
> Hi Everyone,
>
> Does anyone know of any projects for running an interactive R session
> within
> a web browser?
> I'm looking for something similar to the one on the Ruby website
> (http://tryruby.org), except for R.
>
> Thanks for your responses in advance!
>
> Lanna
>
> -
> Lanna Jin
>
> lanna...@gmail.com
> 510-898-8525
> --
> View this message in context:
> http://r.789695.n4.nabble.com/R-for-web-browser-tp2125571p2125571.html
> Sent from the R help mailing list archive at Nabble.com.
>
> __
> 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.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>

[[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.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] Comparing the correlations coefficient of two (very) dependent samples

2010-05-03 Thread Tal Galili
Hello all,

I believe this can be done using bootstrap, but I am wondering if there is
some other way that might be used to tackle this.

#Let's say I have two pairs of samples:
set.seed(100)
s1 <- rnorm(100)
s2 <- s1 + rnorm(100)

x1 <- s1[1:99]
y1 <- s2[1:99]

x2 <- x1
y2 <- s2[2:100]

#And both yield the following two correlations:
cor(x1,y1) # 0.7568969  (cor1)
cor(x2,y2) # -0.2055501 (cor2)

Now for my questions:
1) is cor1 larger then cor2?   (CI for the diff ?)
2) With what P value?
3) What if the values of s1 are not independent ?

I found an older thread discussing such issues:
http://tolstoy.newcastle.edu.au/R/e2/help/06/09/1035.html
But wasn't sure how much this might be relevant to my case.



Thanks for any help,
Tal

Contact
Details:---
Contact me: tal.gal...@gmail.com |  972-52-7275845
Read me: www.talgalili.com (Hebrew) | www.biostatistics.co.il (Hebrew) |
www.r-statistics.com (English)
--

[[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.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Odp: What is the best way to have "R" output tables in an MS Word format?

2010-05-03 Thread Tal Galili
To continue Petr suggestion, a simple variation for this would be to use
sink()


Contact
Details:---
Contact me: tal.gal...@gmail.com |  972-52-7275845
Read me: www.talgalili.com (Hebrew) | www.biostatistics.co.il (Hebrew) |
www.r-statistics.com (English)
--




On Mon, May 3, 2010 at 11:43 AM, Petr PIKAL  wrote:

> Hi
>
>
> r-help-boun...@r-project.org napsal dne 01.05.2010 00:13:06:
>
> > Dear "R" list,
> >
> > Our statisticians usually give us results back in a PDF format. I would
> like
> > to be able to copy and past tables from "R" output directly into a
> Microsoft
> > Word table since this will save us tons of time, be more accurate to
> > minimize human copying errors and help us update data in our papers more
> > easily.
>
> Others gave you more sophisticated solutions which can pay out in longer
> time and when you use the output quite often. However there is one simple
> approach
>
> select output in R console
> ctrl C
> open Word
> ctrl V
> format text as (I believe) Courier
>
> This usually aligns text in proper way to columns.
>
> Regards
> Petr
>
> >
> > Do people have suggestions for the best way to do this?
> >
> > I am a novice to "R" but I do work with a couple of
> > very knowledgeable statisticians who do most of the heavy statistical
> > lifting for our research group.
> >
> > Many thanks,
> > Max
> >
> >
> > Max Gunther, PhD
> >
> > Vanderbilt University - Radiology
> > Institute of Imaging Sciences - VUIIS
> > Center for Health Services Research
> > Nashville, TN www.ICUdelirium.org
> >
> >[[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.org/posting-guide.html
> > and provide commented, minimal, self-contained, reproducible code.
>
> __
> 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.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>

[[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.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Replace query

2010-05-02 Thread Tal Galili
The following code might work:

a[a==1] <- b[a==1]

But it depends on what a and b are exactly (vector, matrix, list,
data.frame).


Tal


Contact
Details:---
Contact me: tal.gal...@gmail.com |  972-52-7275845
Read me: www.talgalili.com (Hebrew) | www.biostatistics.co.il (Hebrew) |
www.r-statistics.com (English)
--




On Sun, May 2, 2010 at 2:01 PM, burgundy  wrote:

>
> Hi,
>
> I'm trying to replace all values equal to 1 in one file (a) with the value
> in the corresponding column in a separate file (b). Example below.
> Any help (and brief notes if poss) much appreciated. Thanks!!
>
> file a:
> 0,0,1,1,0
> 1,0,0,0,1
> 0,0,0,0,0
> 1,0,1,1,0
>
> file b:
> 3,4,6,8,11
>
> output request:
> 0,0,6,8,0
> 3,0,0,0,11
> 0,0,0,0,0
> 3,0,6,8,0
>
>
>
> --
> View this message in context:
> http://r.789695.n4.nabble.com/Replace-query-tp2122706p2122706.html
> Sent from the R help mailing list archive at Nabble.com.
>
> __
> 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.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>

[[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.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Resize Graphics Window

2010-05-01 Thread Tal Galili
Hi Sigal, could you give a simple example ?

I can imagine in some cases that enlarging the windows would help, but on
others there are other parameters you would like to play with instead.  So
having an example to solve, will help people help you.

Tal


Contact
Details:---
Contact me: tal.gal...@gmail.com |  972-52-7275845
Read me: www.talgalili.com (Hebrew) | www.biostatistics.co.il (Hebrew) |
www.r-statistics.com (English)
--




On Sat, May 1, 2010 at 7:40 AM, Sigal Blay  wrote:

> Need way to resize an existing graphics window.
> This should be applicable across platforms (as part of a package).
> Context: function1() draws main plot (I'm using grid), function2() adds
> smaller plot
> above main plot, but this one can sometimes overflow the original graphics
> window
> area.
>
> Thanks,
> Sigal
>
> __
> 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.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>

[[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.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] What is the best way to have "R" output tables in an MS Word format?

2010-05-01 Thread Tal Galili
Hi all,
I forwarded this question to the r-com mailing list, and received the
following reply from Thomas Baier :



Hi Tal,

two solutions immediately come to my mind: SWord
(http://rcom.univie.ac.at) and R2wd (from CRAN).

If creating a paper in Word, then SWord may be the better choice, if you
want to create reports controlled from R, R2wd might be the better one.

Best,
Thomas



Contact
Details:---
Contact me: tal.gal...@gmail.com |  972-52-7275845
Read me: www.talgalili.com (Hebrew) | www.biostatistics.co.il (Hebrew) |
www.r-statistics.com (English)
--




On Sat, May 1, 2010 at 10:18 AM, Jim Lemon  wrote:

> On 05/01/2010 08:13 AM, Max Gunther wrote:
>
>> Dear "R" list,
>>
>> Our statisticians usually give us results back in a PDF format. I would
>> like
>> to be able to copy and past tables from "R" output directly into a
>> Microsoft
>> Word table since this will save us tons of time, be more accurate to
>> minimize human copying errors and help us update data in our papers more
>> easily.
>>
>> Do people have suggestions for the best way to do this?
>>
>> I am a novice to "R" but I do work with a couple of
>> very knowledgeable statisticians who do most of the heavy statistical
>> lifting for our research group.
>>
>>  Hi Max,
> In addition to all the other suggestions, htmlize in the prettyR package
> will produce HTML output with embedded plots, and delim.table in the same
> package will output tables in a variety of formats if you only want tables.
>
> Jim
>
>
> __
> 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.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>

[[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.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] stars plot - how to changing petal angle by weight ?

2010-05-01 Thread Tal Galili
Hello all,

I am wondering how the
?stars
function might be changed so it will get another parameter
(petal.weight) that describes the "weight" for each petal of the flower
(star) plot.
The way this weight will effect is by reducing the angle of the petal by the
weights proportion.  So for example, in this plot:

stars(USJudgeRatings[1,1:4], locations = 0:1, scale=FALSE,
  draw.segments = TRUE, col.segments=0)

Each of the four petals has the angle of 90 degrees.

I would like to add a parameter like:
petal.weight = c(.5,1,.333,.5)
So now the new petals will have the angles:
45, 90,30,45
Centered around where the petals originally where drown.

Can anyone suggest on how to do this ?

Thanks,
Tal



Contact
Details:---
Contact me: tal.gal...@gmail.com |  972-52-7275845
Read me: www.talgalili.com (Hebrew) | www.biostatistics.co.il (Hebrew) |
www.r-statistics.com (English)
--

[[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.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Re :reading large file

2010-04-30 Thread Tal Galili
Hi Mohan,
Check:

dim(bmtrend)

If the output is like the dimension of your data, then it would appear you
succeeded in reading in the data :)

Best,
Tal



Contact
Details:---
Contact me: tal.gal...@gmail.com |  972-52-7275845
Read me: www.talgalili.com (Hebrew) | www.biostatistics.co.il (Hebrew) |
www.r-statistics.com (English)
--




On Sat, May 1, 2010 at 8:35 AM, Mohan L  wrote:

> On Sat, May 1, 2010 at 11:02 AM, Mohan L  wrote:
>
> > Hi All,
> >
> > I am new to R and the mailing list.
> >
> > I have a data file (.xls) format with little bit large (16 column,35000
> > rows ) data file. I am trying to read this file for calculation.  I have
> > converted the file into .csv format and read like that :
> >
> > > bmtrend <- read.csv(file="simple.csv",head=TRUE,sep=",")
> >
> > > bmtrend
> >
> > will display something in the middle of display
> >
> > [ reached get Option("max.print") -- omitted 30061 rows ]]
> >
> > It will not show the full list of data.
> >
> > please suggest me best way to read large file?
> >
> >
> >
> > Thanks & Rg
> > Mohan L
> >
>
> I send the mail without subject, I apologies for  inconvenience.
>
>[[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.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>

[[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.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Newbie question

2010-04-30 Thread Tal Galili
Hi Bill (or William)

What plot do you want to create ? (scatter plot, boxplot, so on?)




Contact
Details:---
Contact me: tal.gal...@gmail.com |  972-52-7275845
Read me: www.talgalili.com (Hebrew) | www.biostatistics.co.il (Hebrew) |
www.r-statistics.com (English)
--




On Fri, Apr 30, 2010 at 5:42 PM, William Clapham <
william.clap...@ars.usda.gov> wrote:

> If I have 3 columns of data, col 1 = Independent Var; cols 2 and 3 are Dep.
> Vars.  I would like to produce a plot with both:  col2=f(col1) and
> col3=f(col1).  How do I do this such that I can control line parameters
> (line type, color, etc).  I know that if I stack the data and col2 and col3
> are treated as different factor levels, that I can accomplish this, but
> lose
> control over the line parameters.  Any guidance is greatly appreciated.
>
> Bill
>
> __
> 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.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>

[[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.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] How to generate a distance matrix?

2010-04-30 Thread Tal Galili
Wouldn't the

?dist

function help you ?



Contact
Details:---
Contact me: tal.gal...@gmail.com |  972-52-7275845
Read me: www.talgalili.com (Hebrew) | www.biostatistics.co.il (Hebrew) |
www.r-statistics.com (English)
--




On Fri, Apr 30, 2010 at 11:12 AM, burgundy  wrote:

>
> Hi,
>
> I'm trying to generate a distance matrix between sample pairs (example
> below). I'm not very familiar with the loop command which I expect I will
> need for this. The example below demosntrates what I'd like to get out of
> the data - essentially, to calculate the proportion of positions where two
> samples differ.
> Any help much appreciated! Also, any notes on how the functions work would
> be great!
>
> Thanks!
>
>
> Example input (note: comma indicates column separators, a:d are sample
> names):
>
> a,1,2,4,4
> b,2,1,4,4
> c,1,2,3,4
> d,1,0,4,0
>
> Identify positions which differ between pairwise comparisons of samples a:d
> (score 1 for differ, 0 for shared in example below)
> some comparisons are duplicates, e.g. ab and ba, and self-comparisons such
> as aa or bb are obviously all "1", but these are neccessary to make the
> matrix
>
> aa,1,1,1,1
> ab,1,1,0,0
> ac,0,0,1,0
> ad,0,1,0,1
> ba,1,1,0,0
> bb,1,1,1,1
> bc,1,1,1,0
> etc... to dd
>
> Calculate proportion of differing positions between pairwise comparisons
> aa,0
> ab,0.5
> ac,0.25
> ad,0.5
> ba,0.5
> bb,0
> bc,0.75
> etc...to dd
>
> prepare matrix (e.g. ab value plotted in [a,b]; ba value plotted in [b,a]
> etc...)
>
>   a,b,c,d
> a,0,0.5,0.25,0.5
> b,0.5,0,0.75 etc...
> c
> d
>
>
>
>
> --
> View this message in context:
> http://r.789695.n4.nabble.com/How-to-generate-a-distance-matrix-tp2076600p2076600.html
> Sent from the R help mailing list archive at Nabble.com.
>
> __
> 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.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>

[[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.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Can't load "doSMP" from REvolutionR in regular R2.11.0

2010-04-29 Thread Tal Galili
Hi Tao,
Thanks for the file - it works great for me.

Tal

Contact
Details:---
Contact me: tal.gal...@gmail.com |  972-52-7275845
Read me: www.talgalili.com (Hebrew) | www.biostatistics.co.il (Hebrew) |
www.r-statistics.com (English)
--




On Thu, Apr 29, 2010 at 11:40 PM, Tao Shi  wrote:

>
> Thanks, David!  I forgot to check that email...
>
> I have built the revoIPC using R2.11.0 and it seemed there were no error
> messages.  I can load doSMP now, but haven't tested it yet.
>
> Tal,
>
> I'll send you the file offline, so you can also test it.
>
> best!
>
> ...Tao
>
>
>
> 
> > From: da...@revolution-computing.com
> > Date: Thu, 29 Apr 2010 13:15:43 -0700
> > Subject: Re: [R] Can't load "doSMP" from REvolutionR in regular R2.11.0
> > To: shi...@hotmail.com
> > CC: r-help@r-project.org; tal.gal...@gmail.com
> >
> > Did you download the source bundle when you downloaded REvolution R?
> > You'll find them there. There's a link in the same email that gives
> > instructions for downloading the binaries.
> >
> > # David Smith
> >
> > On Thu, Apr 29, 2010 at 12:48 PM, Tao Shi  wrote:
> >>
> >> Hi David,
> >>
> >> Thank you for the reply!  Do you know where I can find the source code
> for these packages?  I can give it a try.
> >>
> >> ...Tao
> >>
> >>
> >> 
> >>> From: da...@revolution-computing.com
> >>> Date: Thu, 29 Apr 2010 08:59:08 -0700
> >>> Subject: Re: [R] Can't load "doSMP" from REvolutionR in regular R2.11.0
> >>> To: shi...@hotmail.com
> >>> CC: r-help@r-project.org
> >>>
> >>> We haven't tested doSMP with the mingw compiler (hence why we haven't
> >>> yet submitted it to CRAN). We compiled it under R 2.10 using the same
> >>> Intel compilers we use for REvolution R. It is open source (GPL) so
> >>> you're welcome to try compiling it under mingw yourself, but we can't
> >>> offer support for that configuration.
> >>>
> >>> # David Smith
> >>>
> >>> On Wed, Apr 28, 2010 at 5:10 PM, Tao Shi  wrote:
>  I was testing out the "doSMP" package from REvolutionR in my regular
> R2.11.0 installation and I got the following error message.  Well, one
> obvious thing is that R2.11.0 was built using "i386-pc-mingw32" which is
> different from what revoIPC used.  I could just use REvolutionR, but all my
> R peripherals were set up to work
>   with the regular R2.11.0.  So, I really want to make this work.
>  Anyideas?
> >>>
> >>> --
> >>> David M Smith
> >>> VP of Marketing, REvolution Computing
> http://blog.revolution-computing.com
> >>> Tel: +1 (650) 330-0553 x205 (Palo Alto, CA, USA)
> >>>
> >>> Download REvolution R free:
> >>> www.revolution-computing.com/downloads/revolution-r.php
> >>
> >> _
> >> Hotmail is redefining busy with tools for the New Busy. Get more from
> your inbox.
> >>
> http://www.windowslive.com/campaign/thenewbusy?ocid=PID28326::T:WLMTAGL:ON:WL:en-US:WM_HMP:042010_2
> >
> >
> >
> > --
> > David M Smith
> > VP of Marketing, REvolution Computing
> http://blog.revolution-computing.com
> > Tel: +1 (650) 330-0553 x205 (Palo Alto, CA, USA)
> >
> > Download REvolution R free:
> > www.revolution-computing.com/downloads/revolution-r.php
>
> _
> Hotmail has tools for the New Busy. Search, chat and e-mail from your
> inbox.
>
> http://www.windowslive.com/campaign/thenewbusy?ocid=PID28326::T:WLMTAGL:ON:WL:en-US:WM_HMP:042010_1

[[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.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] Request - adding recycled "lwd" parameter to polygon

2010-04-29 Thread Tal Galili
Hello dear members of R-help and R-core mailing list,

I am not sure if this request is a "ticket" that should be filled somewhere
outside the mailing list.  If so, I apologize for not doing and would like
to know where I should have filled it.



And to the subject matter:

I would like to use a command like this:

plot(c(1,8), 1:2, type="n")

polygon(1:7, c(2,1,2,NA,2,1,2),

 col=c("red", "blue"),

 # border=c("green", "yellow"),

 border=c(1,10),

 lwd=c(1:10))

To create two triangles, with different line widths.

But the polygon command doesn't seem to recycle the "lwd" parameter as it
does for the col, lty, and the border parameters.

I would like the resulting plot to look like what the following code will
produce:

plot(c(1,8), 1:2, type="n")

polygon(1:3, c(2,1,2),

 col=c("red"),

 # border=c("green", "yellow"),

 border=c(1,10),

 lwd=c(1))

polygon(5:7, c(2,1,2),

 col=c( "blue"),

 # border=c("green", "yellow"),

 border=c(1,10),

 lwd=c(10))


I opened up the polygon code to add the lwd parameter so to be used as the
lty is used.
For some reason it didn't work (I am wondering if it is because of some way
.Internal(polygon(xy$x, xy$y, col, border, lty, lwd,...)) doesn't accept
lwd...)



Here is the updates code I wrote:



polygon2   <-   function (x, y = NULL, density = NULL, angle = 45, border =
NULL,
   col = NA, lty = par("lty"), lwd
=par("lwd") ,..., fillOddEven = FALSE)
{
..debug.hatch <- FALSE
xy <- xy.coords(x, y)
if (is.numeric(density) && all(is.na(density) | density <
0))
density <- NULL
if (!is.null(angle) && !is.null(density)) {
polygon.onehatch <- function(x, y, x0, y0, xd, yd, ..debug.hatch =
FALSE,
...) {
if (..debug.hatch) {
points(x0, y0)
arrows(x0, y0, x0 + xd, y0 + yd)
}
halfplane <- as.integer(xd * (y - y0) - yd * (x -
x0) <= 0)
cross <- halfplane[-1L] - halfplane[-length(halfplane)]
does.cross <- cross != 0
if (!any(does.cross))
return()
x1 <- x[-length(x)][does.cross]
y1 <- y[-length(y)][does.cross]
x2 <- x[-1L][does.cross]
y2 <- y[-1L][does.cross]
t <- (((x1 - x0) * (y2 - y1) - (y1 - y0) * (x2 -
x1))/(xd * (y2 - y1) - yd * (x2 - x1)))
o <- order(t)
tsort <- t[o]
crossings <- cumsum(cross[does.cross][o])
if (fillOddEven)
crossings <- crossings%%2
drawline <- crossings != 0
lx <- x0 + xd * tsort
ly <- y0 + yd * tsort
lx1 <- lx[-length(lx)][drawline]
ly1 <- ly[-length(ly)][drawline]
lx2 <- lx[-1L][drawline]
ly2 <- ly[-1L][drawline]
segments(lx1, ly1, lx2, ly2, ...)
}
polygon.fullhatch <- function(x, y, density, angle, ..debug.hatch =
FALSE,
...) {
x <- c(x, x[1L])
y <- c(y, y[1L])
angle <- angle%%180
if (par("xlog") || par("ylog")) {
warning("cannot hatch with logarithmic scale active")
return()
}
usr <- par("usr")
pin <- par("pin")
upi <- c(usr[2L] - usr[1L], usr[4L] - usr[3L])/pin
if (upi[1L] < 0)
angle <- 180 - angle
if (upi[2L] < 0)
angle <- 180 - angle
upi <- abs(upi)
xd <- cos(angle/180 * pi) * upi[1L]
yd <- sin(angle/180 * pi) * upi[2L]
if (angle < 45 || angle > 135) {
if (angle < 45) {
  first.x <- max(x)
  last.x <- min(x)
}
else {
  first.x <- min(x)
  last.x <- max(x)
}
y.shift <- upi[2L]/density/abs(cos(angle/180 *
  pi))
x0 <- 0
y0 <- floor((min(y) - first.x * yd/xd)/y.shift) *
  y.shift
y.end <- max(y) - last.x * yd/xd
while (y0 < y.end) {
  polygon.onehatch(x, y, x0, y0, xd, yd, ..debug.hatch =
..debug.hatch,
...)
  y0 <- y0 + y.shift
}
}
else {
if (angle < 90) {
  first.y <- max(y)
  last.y <- min(y)
}
else {
  first.y <- min(y)
  last.y <- max(y)
}
x.shift <- upi[1L]/density/abs(sin(angle/180 *
  pi))
x0 <- floor((min(x) - first.y * xd/yd)/x.shift) *
  x.shift
y0 <- 0
x.end <- max(x) - last.y * xd/yd
 

Re: [R] Split a vector by NA's - is there a better solution then a loop ?

2010-04-29 Thread Tal Galili
Definitely Smarter,
Thanks!

Tal

Contact
Details:---
Contact me: tal.gal...@gmail.com |  972-52-7275845
Read me: www.talgalili.com (Hebrew) | www.biostatistics.co.il (Hebrew) |
www.r-statistics.com (English)
--




On Thu, Apr 29, 2010 at 10:56 AM, Romain Francois <
romain.franc...@dbmail.com> wrote:

> Maybe this :
>
> > foo <- function( x ){
> +   idx <- 1 + cumsum( is.na( x ) )
> +   not.na <- ! is.na( x )
> +   split( x[not.na], idx[not.na] )
> + }
> > foo( x )
>
> $`1`
> [1] 2 1 2
>
> $`2`
> [1] 1 1 2
>
> $`3`
> [1] 4 5 2 3
>
> Romain
>
> Le 29/04/10 09:42, Tal Galili a écrit :
>
>
>> Hi all,
>>
>> I would like to have a function like this:
>> split.vec.by.NA<- function(x)
>>
>> That takes a vector like this:
>> x<- c(2,1,2,NA,1,1,2,NA,4,5,2,3)
>>
>> And returns a list of length of 3, each element of the list is the
>> relevant
>> segmented vector, like this:
>>
>> $`1`
>> [1] 2 1 2
>> $`2`
>> [1] 1 1 2
>> $`3`
>> [1] 4 5 2 3
>>
>>
>> I found how to do it with a loop, but wondered if there is some smarter
>> (vectorized) way of doing it.
>>
>>
>>
>> Here is the code I used:
>>
>> x<- c(2,1,2,NA,1,1,2,NA,4,5,2,3)
>>
>>
>> split.vec.by.NA<- function(x)
>> {
>> # assumes NA are seperating groups of numbers
>> #TODO: add code to check for it
>>
>> number.of.groups<- sum(is.na(x)) + 1
>> groups.end.point.locations<- c(which(is.na(x)), length(x)+1) # This will
>> be
>> all the places with NA's + a nubmer after the ending of the vector
>>  group.start<- 1
>> group.end<- NA
>> new.groups.split.id<- x # we will replace all the places of the group
>> with
>> group ID, excapt for the NA, which will later be replaced by 0
>>  for(i in seq_len(number.of.groups))
>> {
>> group.end<- groups.end.point.locations[i]-1
>>  new.groups.split.id[group.start:group.end]<- i
>>  group.start<- groups.end.point.locations[i]+1 # make the new group start
>> higher for the next loop (at the final loop it won't matter
>>  }
>>  new.groups.split.id[is.na(x)]<- 0
>>  return(split(x, new.groups.split.id)[-1])
>> }
>>
>> split.vec.by.NA(x)
>>
>>
>>
>>
>> Thanks,
>> Tal
>>
>
> --
> Romain Francois
> Professional R Enthusiast
> +33(0) 6 28 91 30 30
> http://romainfrancois.blog.free.fr
> |- http://bit.ly/9aKDM9 : embed images in Rd documents
> |- http://tr.im/OIXN : raster images and RImageJ
> |- http://tr.im/OcQe : Rcpp 0.7.7
>
>
>

[[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.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] Split a vector by NA's - is there a better solution then a loop ?

2010-04-29 Thread Tal Galili
Hi all,

I would like to have a function like this:
split.vec.by.NA <- function(x)

That takes a vector like this:
x <- c(2,1,2,NA,1,1,2,NA,4,5,2,3)

And returns a list of length of 3, each element of the list is the relevant
segmented vector, like this:

$`1`
[1] 2 1 2
$`2`
[1] 1 1 2
$`3`
[1] 4 5 2 3


I found how to do it with a loop, but wondered if there is some smarter
(vectorized) way of doing it.



Here is the code I used:

x <- c(2,1,2,NA,1,1,2,NA,4,5,2,3)


split.vec.by.NA <- function(x)
{
# assumes NA are seperating groups of numbers
#TODO: add code to check for it

number.of.groups <- sum(is.na(x)) + 1
groups.end.point.locations <- c(which(is.na(x)), length(x)+1) # This will be
all the places with NA's + a nubmer after the ending of the vector
 group.start <- 1
group.end <- NA
new.groups.split.id <- x # we will replace all the places of the group with
group ID, excapt for the NA, which will later be replaced by 0
 for(i in seq_len(number.of.groups))
{
group.end <- groups.end.point.locations[i]-1
 new.groups.split.id[group.start:group.end] <- i
 group.start <- groups.end.point.locations[i]+1 # make the new group start
higher for the next loop (at the final loop it won't matter
 }
 new.groups.split.id[is.na(x)] <- 0
 return(split(x, new.groups.split.id)[-1])
}

split.vec.by.NA(x)




Thanks,
Tal




Contact
Details:---
Contact me: tal.gal...@gmail.com |  972-52-7275845
Read me: www.talgalili.com (Hebrew) | www.biostatistics.co.il (Hebrew) |
www.r-statistics.com (English)
--

[[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.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Can't load "doSMP" from REvolutionR in regular R2.11.0

2010-04-28 Thread Tal Galili
I get the same error and would be happy for a solution as well.

Thanks,
Tal

Contact
Details:---
Contact me: tal.gal...@gmail.com |  972-52-7275845
Read me: www.talgalili.com (Hebrew) | www.biostatistics.co.il (Hebrew) |
www.r-statistics.com (English)
--




On Thu, Apr 29, 2010 at 3:10 AM, Tao Shi  wrote:

>
> Hi list,
>
> I was testing out the "doSMP" package from REvolutionR in my regular
> R2.11.0 installation and I got the following error message.  Well, one
> obvious thing is that R2.11.0 was built using "i386-pc-mingw32" which is
> different from what revoIPC used.  I could just use REvolutionR, but all my
> R peripherals were set up to work
>  with the regular R2.11.0.  So, I really want to make this work.  Anyideas?
>
> Many thanks in advance!
>
> ...Tao
>
>
>
> > library(doSMP)
> Loading required package: foreach
> Loading required package: iterators
> Loading required package: codetools
> foreach: simple, scalable parallel programming from REvolution Computing
> Use REvolution R for scalability, fault tolerance and more.
> http://www.revolution-computing.com
> Loading required package: revoIPC
> Error: package 'revoIPC' was built for i386-pc-intel32
> > sessionInfo()
> R version 2.11.0 (2010-04-22)
> i386-pc-mingw32
>
> locale:
> [1] LC_COLLATE=English_United States.1252  LC_CTYPE=English_United
> States.1252LC_MONETARY=English_United States.1252
> [4] LC_NUMERIC=C   LC_TIME=English_United
> States.1252
>
> attached base packages:
> [1] grDevices datasets  splines   graphics  stats tcltk utils
> methods   base
>
> other attached packages:
> [1] foreach_1.3.0   codetools_0.2-2 iterators_1.0.3 svSocket_0.9-48
> TinnR_1.0.3 R2HTML_2.0.0Hmisc_3.7-0 survival_2.35-8
>
> loaded via a namespace (and not attached):
> [1] cluster_1.12.3 grid_2.11.0lattice_0.18-5 svMisc_0.9-57
> tools_2.11.0
>
>
> _
> The New Busy is not the too busy. Combine all your e-mail accounts with
> Hotmail.
>
> ID28326::T:WLMTAGL:ON:WL:en-US:WM_HMP:042010_4
> __
> 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.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>

[[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.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] multiple paired t-tests without loops

2010-04-27 Thread Tal Galili
Hi Matthew,

First - I fully support Greg Snow proposition.  Sampling is the way to go
here.

But besides that:
1) Try to avoid using data.frames as much as possible (use vectors and
matrixes instead - they are usually faster)
2) Since you are running on a loop, you can try running it in parallel (if
you have more then one core on your computer). I recently wrote how to do
this on Windows (here:
http://www.r-statistics.com/2010/04/parallel-multicore-processing-with-r-on-windows/)
, and there are other ways for doing it on other OS.

But again - sampling is probably going to be the only real solution...

Good luck,
Tal



Contact
Details:---
Contact me: tal.gal...@gmail.com |  972-52-7275845
Read me: www.talgalili.com (Hebrew) | www.biostatistics.co.il (Hebrew) |
www.r-statistics.com (English)
--




On Tue, Apr 27, 2010 at 1:09 AM, Matthew Finkbeiner <
matthew.finkbei...@maccs.mq.edu.au> wrote:

> Yes, I suspect that I will end up using a sampling approach, but I'd like
> to use an exact test if it's at all feasible.
>
> Here are two samples of data from 3 subjects:
> Sample  SubjC1  C2
> 44  1   0.0093  0.0077
> 44  2   0.0089  0.0069
> 44  3   0.051   0.0432
> 44  4   0.014   0.0147
> 44  5   0.0161  0.0117
> 45  1   0.0103  0.0086
> 45  2   0.0099  0.0078
> 45  3   0.0542  0.0458
> 45  4   0.0154  0.0163
> 45  5   0.0175  0.0129
>
>
> and then here is the script I've pieced together from things I've found on
> the web (sorry for not citing the snippets!).  any pointers on how to speed
> it up would be greatly appreciated.
>
> #--
> # Utility function
> # that returns binary representation of 1:(2^n) X SubjN
> binary.v <-
> function(n)
> {
>  x <- 1:(2^n)
>  mx <- max(x)
>  digits <- floor(log2(mx))
>  ans <- 0:(digits-1); lx <- length(x)
>  x <- matrix(rep(x,rep(digits, lx)),ncol=lx)
>  x <- (x %/% 2^ans) %% 2
> }
>
> library(plyr)
>
>
> #first some global variables
> TotalSubjects <- 5
> TotalSamples <- 2
> StartSample <- 44
> EndSample <- ((StartSample + TotalSamples)-1)
> maxTs <- NULL
> obsTs <- NULL
>
>
>
>
> #create index array that drives the permuations for all samples
> ind <- binary.v(TotalSubjects)
>
> #transpose ind so that the first 2^N items correspond to S1,
> #the second 2^N correspond to S2 and so on...
> transind <- t(ind)
>
> #get data file that is organized first by sample then by subj (e.g. sample1
> subject1
> # sample1 subject 2 ... sample 1 subject N)
> #sampledatafile <- file.choose()
>
> samples <- read.table(sampledatafile, header=T)
>
> #this is the progress bar
> pb <- txtProgressBar(min = StartSample, max = EndSample, style = 3)
> setTxtProgressBar(pb, 1)
>
> start.t <- proc.time()
>
> #begin loop that analyzes data sample by sample
> for (s in StartSample:EndSample) {
>
>S <- samples[samples$Sample==s,] #pick up data for current sample
>
>#reproduce data frame rows once for each permutation to be done
>expanddata <- S[rep(1:nrow(S), each = 2^TotalSubjects),]
>
>
>#create new array to hold the flipped (permuted) data
>permdata = expanddata
>
>#permute the data
>permdata[transind==1,3] <- expanddata[transind==1,4] #Cnd1 <- Cnd2
>permdata[transind==1,4] <- expanddata[transind==1,3] #Cnd2 <- Cnd1
>
>#create permutation # as a factor in dataframe
>PermN <- rep(rep(1:2^TotalSubjects, TotalSubjects),2)
>
>#create Sample# as a factor
>Sample <- rep(permdata[,1],2) #Sample# is in the 1st Column
>
>#create subject IDs as a factor
>Subj <- rep(permdata[,2],2) #Subject ID is in the 2nd Column
>
>#stack the permutated data
>StackedPermData <- stack(permdata[,3:4])
>
>#bind all the factors together
>StackedPermData <- as.data.frame(cbind(Sample, Subj, PermN,
> StackedPermData))
>
>
>#sort by perm
>sortedstack <-
> as.data.frame(StackedPermData[order(StackedPermData$PermN,
>StackedPermData$Sample),])
>
>
>#clear up some memory
>rm(expanddata, permdata, StackedPermData)
>
>#pull out data 1 perm at a time
>res<-ddply(sortedstack, c("Sample", "PermN"), function(.data){
>
># Type combinations by Class
>combs<-t(combn(sort(unique(.data[,5])),2))
>
># Applying the t-test for them
>aaply(combs,1, function(.r){
>x1<-.data[.data[,5]==.r[1],4] # select first column
>x2<-.data[.data[,5]==.r[2],4] # select first column
>
>tvalue <- t.test(x1,x2, paired = T)
>
>res <- c(tvalue$statistic,tvalue$parameter,tvalue$p.value)
>names(res) <- c('stat','df','pvalue')
>res
>}
>)
>}
>)
>
> # update progress bar
> setTxtProgressBar(pb, s)
>
> #get max T vals
> maxTs <- c(maxTs, tapply (res$stat,

Re: [R] Problem with 'lars' package

2010-04-26 Thread Tal Galili
The CRAN website is down, and will remain so for the next few hours, see
link for alternative images:
http://www.r-bloggers.com/r-project-websites-down/



Contact
Details:---
Contact me: tal.gal...@gmail.com |  972-52-7275845
Read me: www.talgalili.com (Hebrew) | www.biostatistics.co.il (Hebrew) |
www.r-statistics.com (English)
--




On Tue, Apr 27, 2010 at 1:58 AM,  wrote:

> Hi,
> I'm having trouble running 'lars'. When I install it I get the following
> warning:
>
> >install.packages('lars')
> Warning in install.packages("lars") :
>  argument 'lib' is missing: using
> 'C:\Users\Anna\Documents/R/win-library/2.10'
> --- Please select a CRAN mirror for use in this session ---
> trying URL
> 'http://cran.cnr.Berkeley.edu/bin/windows/contrib/2.10/lars_0.9-7.zip'
> Content type 'application/zip' length 211898 bytes (206 Kb)
> opened URL
> downloaded 206 Kb
>
> package 'lars' successfully unpacked and MD5 sums checked
>
> The downloaded packages are in
>C:\Users\Anna\AppData\Local\Temp\RtmpmRYoLn\downloaded_packages
> Warning message:
> In open.connection(con, "r") :
>  unable to connect to 'cran.r-project.org' on port 80.
>
>
> When I actually try to run it, it gives me the following message:
>
> Error: argument "Gram" is missing, with no default
>
> What is the problem?
> Thank you,
> Anna
>
> __
> 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.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>

[[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.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Bhapkar V test

2010-04-26 Thread Tal Galili
Hi Karl,
I don't think this is the solution, but just in case -
the coin package has a reference for the: "homogeneity statistic W of *
Bhapkar* (1966)"
Might it be related to V test ?

Best,
Tal


Contact
Details:---
Contact me: tal.gal...@gmail.com |  972-52-7275845
Read me: www.talgalili.com (Hebrew) | www.biostatistics.co.il (Hebrew) |
www.r-statistics.com (English)
--




On Tue, Apr 27, 2010 at 5:21 AM, Karl-Dieter Crisman wrote:

> Bhapkar V test

[[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.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Histogram not plotting correct breaks

2010-04-26 Thread Tal Galili
trying setting
br = 40
inside the hist, and check if that helps...
(breaks won't do it for you either way)

Tal

Contact
Details:---
Contact me: tal.gal...@gmail.com |  972-52-7275845
Read me: www.talgalili.com (Hebrew) | www.biostatistics.co.il (Hebrew) |
www.r-statistics.com (English)
--




On Tue, Apr 27, 2010 at 5:04 AM, burgundy  wrote:

>
> Hi,
>
> I'm using the hist function to plot the frequency of 21 variables, but it
> keeps starting the x-axis from 0 and adding variables 1 and 2 together (all
> other vairables have the correct frequencies). I suspect it adds 1 and 2
> together so that 0 can fit in with demarcations at intervals of 5. Using
> "xlim=c(1,21)" to specify that i don't want to include 0 and using the
> "breaks" command to specify 21 breaks doesn't help. Any advice?
> Thank you!!
> --
> View this message in context:
> http://r.789695.n4.nabble.com/Histogram-not-plotting-correct-breaks-tp2066057p2066057.html
> Sent from the R help mailing list archive at Nabble.com.
>
> __
> 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.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>

[[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.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] How do you change library location ? (in R under windows XP)

2010-04-26 Thread Tal Galili
Thank you Mike,
That is indeed what I used in the code eventually.
http://www.r-statistics.com/2010/04/changing-your-r-upgrading-strategy-and-the-r-code-to-do-it-on-windows/

Thanks for answering,
Tal

Contact
Details:---
Contact me: tal.gal...@gmail.com |  972-52-7275845
Read me: www.talgalili.com (Hebrew) | www.biostatistics.co.il (Hebrew) |
www.r-statistics.com (English)
--




On Mon, Apr 26, 2010 at 9:31 PM, Mike Prager  wrote:

> On Fri, 23 Apr 2010 15:22:45 +0300, Tal Galili 
> wrote:
>
> >Due to the new R 2.11 release, I want to implement Dirk's suggestion
> >here<
> http://stackoverflow.com/questions/1401904/painless-way-to-install-a-new-version-of-r
> >
> >.
> >
> >So for that I am asking - How can I (permanently) change R's library path?
> >(The best solution would be one that can be run from within R)
>
> To me, it seemed more straightforward to do this outside R.
>
> Just set the environment variable R_LIBS in Windows to something like
>
> R_LIBS=c:/R/Library
>
> Then, delete your R installation. Install the new version and all
> desired packages.  The add-on packages will be located according to
> your environment setting, and future updates will not require add-on
> packages to be copied or reloaded.
>
> HTH
>
> __
> 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.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>

[[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.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Why am I getting different results from cor VS ccf ?

2010-04-26 Thread Tal Galili
The dear mark leeds 
Has pointed me that the answer to my question was in the MASS book, in page
390
Where it is said that acf works by dividing the covariance with N instead of
N-t
so to insure that the covariance sequence is positive definite.

Although I am not sure if to my purposes it means I should use the one over
the other.

Thanks again to Mark,

Tal


Contact
Details:---
Contact me: tal.gal...@gmail.com |  972-52-7275845
Read me: www.talgalili.com (Hebrew) | www.biostatistics.co.il (Hebrew) |
www.r-statistics.com (English)
--




On Mon, Apr 26, 2010 at 8:49 PM, Tal Galili  wrote:

> Hi all,
>
> I am getting different results from ccf and cor,
> Here is a simple example:
>
> set.seed(100)
> N <- 100
> x1 <- sample(N)
> x2 <- x1 + rnorm(N,0,5)
> ccf(x1,x2)$acf[ccf(x1,x2)$lag == -1]
> cor(x1[-N], x2[-1])
>
>
> Results:
>
> > ccf(x1,x2)$acf[ccf(x1,x2)$lag == -1]
> [1] -0.128027
> > cor(x1[-N], x2[-1])
> [1] -0.1301427
>
>
> Thanks,
> Tal
>
>
>
>
> Contact
> Details:---
> Contact me: tal.gal...@gmail.com |  972-52-7275845
> Read me: www.talgalili.com (Hebrew) | www.biostatistics.co.il (Hebrew) |
> www.r-statistics.com (English)
>
> --
>
>
>

[[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.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] Why am I getting different results from cor VS ccf ?

2010-04-26 Thread Tal Galili
Hi all,

I am getting different results from ccf and cor,
Here is a simple example:

set.seed(100)
N <- 100
x1 <- sample(N)
x2 <- x1 + rnorm(N,0,5)
ccf(x1,x2)$acf[ccf(x1,x2)$lag == -1]
cor(x1[-N], x2[-1])


Results:

> ccf(x1,x2)$acf[ccf(x1,x2)$lag == -1]
[1] -0.128027
> cor(x1[-N], x2[-1])
[1] -0.1301427


Thanks,
Tal




Contact
Details:---
Contact me: tal.gal...@gmail.com |  972-52-7275845
Read me: www.talgalili.com (Hebrew) | www.biostatistics.co.il (Hebrew) |
www.r-statistics.com (English)
--

[[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.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] data frame

2010-04-26 Thread Tal Galili
you can do this:

a <- tapply(VAR, YEAR, prod)

The use "merge" to create a new variable of the length of your original VAR,
and just do
VAR/prod.VAR




Contact
Details:---
Contact me: tal.gal...@gmail.com |  972-52-7275845
Read me: www.talgalili.com (Hebrew) | www.biostatistics.co.il (Hebrew) |
www.r-statistics.com (English)
--




On Mon, Apr 26, 2010 at 6:07 PM, n.via...@libero.it wrote:

> PROD

[[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.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Finding First of a Type in a Sequence

2010-04-26 Thread Tal Galili
Try this:



func <- function(x)
{
which.negative <- which(x<0)
index.to.return <- which.negative[which.negative > which.max(x)][1]
return(index.to.return)
}

func(x)


Best,
Tal

Contact
Details:---
Contact me: tal.gal...@gmail.com |  972-52-7275845
Read me: www.talgalili.com (Hebrew) | www.biostatistics.co.il (Hebrew) |
www.r-statistics.com (English)
--




On Mon, Apr 26, 2010 at 7:29 PM, Su Chu  wrote:

> Hi there,
>
> I am working on a project that requires me to find the point at which
> values
> become negative in a sequence about the max.
>
> For example, say I have some sequence:
>
> x=c(-12, -2,-19, 0, -14, -2, 9,10,20,35,56,89,60,39,12,8,-5,-2,0,10)
>
> In this sequence, the max is 89, and I need to identify that -2 and -5 are
> the points at which the values* first *become negative about the max and
> retrieve their index values.
>
> I was hoping for some help in finding a way to automate this procedure, as
> I
> have over 100 vectors of this kind where I must find the two values about
> the max.
>
> Could anyone help? I would really, really appreciate it!
>
>
> Thank you so much!
>
> Best,
> Su
>
>[[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.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>

[[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.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] help on autocorrealtion time

2010-04-26 Thread Tal Galili
Do you mean

ccf

?




Contact
Details:---
Contact me: tal.gal...@gmail.com |  972-52-7275845
Read me: www.talgalili.com (Hebrew) | www.biostatistics.co.il (Hebrew) |
www.r-statistics.com (English)
--




On Mon, Apr 26, 2010 at 3:43 PM, netrunner  wrote:

>
> Hi,
> I would like to compute the autocorrelation time from my 2-D time series,
> but I cannot find how to do using R. I have found the fucntion acf and acf
> plot, but how can find the autocorrelation time?
>
> thanks
>
>
>
> --
> View this message in context:
> http://r.789695.n4.nabble.com/help-on-autocorrealtion-time-tp2065129p2065129.html
> Sent from the R help mailing list archive at Nabble.com.
>
> __
> 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.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>

[[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.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Cluster analysis: dissimilar results between R and SPSS

2010-04-26 Thread Tal Galili
Hi Jeoffrey,

How stable are the results in general ?
If you repeat the analysis in R several times, does it yield the same
results ?


Tal

Contact
Details:---
Contact me: tal.gal...@gmail.com |  972-52-7275845
Read me: www.talgalili.com (Hebrew) | www.biostatistics.co.il (Hebrew) |
www.r-statistics.com (English)
--




On Mon, Apr 26, 2010 at 3:37 PM, Jeoffrey Gaspard <
jeoffrey.gasp...@gmail.com> wrote:

> Hello everyone!
>
> My data is composed of 277 individuals measured on 8 binary variables
> (1=yes, 2=no).
>
> I did two similar cluster analyses, one on SPSS 18.0 and one on R 2.9.2.
> The
> objective is to have the means for each variable per retained cluster.
>
> 1) the R analysis ran as followed:
>
> > call data
> > dist=dist(data,method="euclidean")
> > cluster=hclust(dist,method="ward")
> > cluster
>
> Call:
> hclust(d = dist, method = "ward")
>
> Cluster method   : ward
> Distance : euclidean
> Number of objects: 277
>
> > plot(cluster)
> > rect.hclust(cluster, k=4, border="red")
> > x=rect.hclust(cluster, k=4, border="red")
> > sapply(x, function(i) colMeans(data[i,]))
> > round(sapply(x, function(i) colMeans(data[i,])),2)
>
> 2) The SPSS analysis ran as follows:
>
> Analysis --> Classify --> Hierarchical cluster analysis --> Cluster method=
> Ward's method and Distance measure= Interval:  Squared Euclidean distance.
> After that, I computed the means of each variable for each cluster.
>
> The problem is I have different results between the two analyses (different
> clusters and means).
>
> However, when I use the "Euclidean distance" (unsquared) in SPSS, I have
> the
> same results!
>
> I thought the R "euclidean" command meant the "usual square distance
> between
> the two vectors (2 norm)" as specified in the documentation, no the
> unsquared distance. Did it not?
>
> Thanks for the comment!
>
> Jeffrey
>
>
>
>[[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.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>

[[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.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] PDF text to work with maps.

2010-04-26 Thread Tal Galili
Have a look here:
http://www.r-bloggers.com/a-free-book-on-geostatistical-mapping-with-r/


Contact
Details:---
Contact me: tal.gal...@gmail.com |  972-52-7275845
Read me: www.talgalili.com (Hebrew) | www.biostatistics.co.il (Hebrew) |
www.r-statistics.com (English)
--




On Mon, Apr 26, 2010 at 5:04 AM, Francisco Silva  wrote:

> Hi all folks,
>
> I would like to know if somebody has a PDF text with the first steps
> to use maps in R, like: insert maps, open maps, create adjacency
> matrix, make the moran index, etc.
> If somebody can send me a material of it I will be very glad and thankful
>
> Thanks a lot,
> Gildemir Silba
>
> __
> 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.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>

[[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.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Using optim function for logistic model simulation

2010-04-26 Thread Tal Galili
mm...

I also noticed the function you wrote didn't use parenthesis, mixed b and c
and used different names for K.
Your code is a great exercise in debugging  (no offense intended :) )

Try using:

bird<-bird.density[0] # I assume this exists
eqn<- function(K1, b1 = 1.22, c1 = .55) {

   b<-1.22
   c<-0.55
   bird <- c1*bird + b1*bird*(1-b1*bird)*bird/K1
return(bird)
}

k1<-optim(c(0,10),eqn)




Contact
Details:---
Contact me: tal.gal...@gmail.com |  972-52-7275845
Read me: www.talgalili.com (Hebrew) | www.biostatistics.co.il (Hebrew) |
www.r-statistics.com (English)
--




On Mon, Apr 26, 2010 at 11:08 AM, Tal Galili  wrote:

> Hi Charlotte ,
>
> I can't reproduce your code, but skimming through it -
> It would appear that:
> 1) in
> eqn1<- function(K1, bird)
> you didn't define "bird" (you did define it before the function, so I'd
> suggest just removing it from the function call like this:
> eqn1<- function(K1)
>
> 2) you didn't "return" and value at the end of the function.
>
> 3) you use different name in optim then in the function you made.
>
> 4) I see no point for you to use the for loop.
>
>
>
> Consider trying the following code:
>
> b<-1.22
> c<-0.55
> bird<-bird.density[0] # I assume this exists
> eqn<- function(K1, bird) {
>
>b<-1.22
>c<-0.55
>bird <- 0.55*bird + b*bird*1-b*bird*bird/K
>  return(bird)
>  }
>
> k1<-optim(c(0,10),eqn)
>
>
>
> Contact
> Details:---
> Contact me: tal.gal...@gmail.com |  972-52-7275845
> Read me: www.talgalili.com (Hebrew) | www.biostatistics.co.il (Hebrew) |
> www.r-statistics.com (English)
>
> --
>
>
>
>
> On Mon, Apr 26, 2010 at 9:00 AM, Charlotte Chang wrote:
>
>> optim
>
>
>

[[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.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Using optim function for logistic model simulation

2010-04-26 Thread Tal Galili
Hi Charlotte ,

I can't reproduce your code, but skimming through it -
It would appear that:
1) in
eqn1<- function(K1, bird)
you didn't define "bird" (you did define it before the function, so I'd
suggest just removing it from the function call like this:
eqn1<- function(K1)

2) you didn't "return" and value at the end of the function.

3) you use different name in optim then in the function you made.

4) I see no point for you to use the for loop.



Consider trying the following code:

b<-1.22
c<-0.55
bird<-bird.density[0] # I assume this exists
eqn<- function(K1, bird) {
   b<-1.22
   c<-0.55
   bird <- 0.55*bird + b*bird*1-b*bird*bird/K
return(bird)
}

k1<-optim(c(0,10),eqn)



Contact
Details:---
Contact me: tal.gal...@gmail.com |  972-52-7275845
Read me: www.talgalili.com (Hebrew) | www.biostatistics.co.il (Hebrew) |
www.r-statistics.com (English)
--




On Mon, Apr 26, 2010 at 9:00 AM, Charlotte Chang wrote:

> optim

[[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.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Upgrading R using the "global library folder" strategy - what do you think about it?

2010-04-26 Thread Tal Galili
Hi Daniel,

Thanks for taking the time to go through this.

You wrote:

> "I don't see the advantage over using the R_LIBS environment variable"

You are correct - there is no advantage *over *doing that, because that is *
exactly* what my code is doing :)

You wrote:

> You need to initially copy current user installed librarys to

At this point is what I offer with the code I published, to automate the
work for the user.  Instead of the user manually:
1) copy his packages library to the new global library
2) create the "etc\Renviron.site" file and write what he needs in it
The code I wrote on my blog offers that for the user as a simple two line R
code to run.

If I failed at being clear (or just did something that was already done in
another way), please let me know.

Best,
Tal

Contact
Details:---
Contact me: tal.gal...@gmail.com |  972-52-7275845
Read me: www.talgalili.com (Hebrew) | www.biostatistics.co.il (Hebrew) |
www.r-statistics.com (English)
--




On Mon, Apr 26, 2010 at 7:21 AM, Daniel Nordlund wrote:

> R_LIBS

[[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.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Growth potential for open source math tools: 10 questions

2010-04-25 Thread Tal Galili
Maybe I missed something - but *why* should we do it?


Contact
Details:---
Contact me: tal.gal...@gmail.com |  972-52-7275845
Read me: www.talgalili.com (Hebrew) | www.biostatistics.co.il (Hebrew) |
www.r-statistics.com (English)
--




On Sun, Apr 25, 2010 at 11:14 PM,  wrote:

>   Is there an need for more open source math tools in
> for-profit companies?  If so, would targeted training and support help meet
> this need while benefiting the open source community?  Please share your
> opinions and reasoning by answering the survey questions below.
>
>
>
> I've invited you to fill out the form Growth potential for open source math
> tools: 10 questions. To fill it out, visit:
>
> http://spreadsheets.google.com/viewform?formkey=dEhfZmNXRTY2MjlfTXQ2SGphcWl3ekE6MQ
>
>
>
>[[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.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>

[[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.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] replace question mark with a dash

2010-04-25 Thread Tal Galili
Here you go :)


require(stringr)
t(
apply(mydf, 1, function(x) {str_replace(x, "\\?", "-)")})
)





Contact
Details:---
Contact me: tal.gal...@gmail.com |  972-52-7275845
Read me: www.talgalili.com (Hebrew) | www.biostatistics.co.il (Hebrew) |
www.r-statistics.com (English)
--




On Sun, Apr 25, 2010 at 9:21 PM, Felipe Carrillo
wrote:

> Hi:
> I have the following dataset in R( thanks Gabor for your help) but now
> the problem is that all the dashes are converted to questions marks ("?")
> I am trying to get the dashes back using:
>
> mydf <- data.frame(lapply(mydf,function(x) replace(mydf,"?"(x),"-")))
>
> but isn't working. I also tried:
>
> mydf <- replace(mydf,mydf=="?","-)")
>
> Thanks for any suggestions.
>
>
>
> mydf <-structure(list(IDDate = c("2/26/2010", "2/27/2010", "2/28/2010",
> "3/1/2010", "3/2/2010", "3/3/2010", "3/4/2010", "3/5/2010", "3/6/2010",
> "3/7/2010", "3/8/2010", "3/9/2010", "3/10/2010", "3/11/2010",
> "Biweekly Lower 90% Confidence Interval", "Biweekly Total", "Biweekly Upper
> 90% Confidence Interval",
> "Brood-year  Lower 90% Confidence Interval", "Brood Year Total",
> "Brood-year Upper 90% Confidence Interval"), First = c("0 ( ? )",
> "n (0 ? 0)", "357 (123 ? 123)", "144 (95 ? 152)", "73 (126 ? 152)",
> "43 (108 ? 108)", "n (0 ? 0)", "270 (101 ? 140)", "121 (111 ? 112)",
> "0 ( ? )", "34 (111 ? 111)", "102 (111 ? 140)", "0 ( ? )", "35 (125 ?
> 125)",
> "-537", "1425", "3388", "2578499", "4455877", "6333255"), Second = c("0 ( ?
> )",
> "n (0 ? 0)", "0 ( ? )", "99 (65 ? 71)", "0 ( ? )", "86 (66 ? 76)",
> "n (0 ? 0)", "0 ( ? )", "40 (66 ? 66)", "0 ( ? )", "33 (74 ? 74)",
> "0 ( ? )", "35 (66 ? 66)", "35 (70 ? 70)", "-549", "402", "1353",
> "74306", "314206", "541552"), Third = c("7,002 (33 ? 39)",
> "n (0 ? 0)", "130,342 (29 ? 57)", "22,741 (31 ? 56)", "8,365 (31 ? 53)",
> "5,962 (33 ? 60)", "n (0 ? 0)", "22,461 (30 ? 61)", "12,485 (31 ? 55)",
> "7,352 (31 ? 56)", "2,908 (32 ? 48)", "3,265 (27 ? 48)", "1,993 (30 ? 55)",
> "1,445 (33 ? 62)", "35097", "296085", "557074", "2249920", "7347719",
> "12058021"), Fourth = c("0 ( ? )", "n ( ? )", "0 ( ? )",
> "0 ( ? )", "0 ( ? )", "34 ( ? )", "0 ( ? )", "0 ( ? )", "0 ( ? )",
> "0 ( ? )", "0 ( ? )", "0 ( ? )", "0 ( ? )", "0 ( ? )", "-250",
> "40", "330", "98786", "225913", "353040"), Fifth = c("0 ( ? )",
> "n (0 ? 0)", "0 ( ? )", "0 ( ? )", "0 ( ? )", "0 ( ? )", "n (0 ? 0)",
> "0 ( ? )", "0 ( ? )", "0 ( ? )", "0 ( ? )", "0 ( ? )", "0 ( ? )",
> "0 ( ? )", "0", "0", "0", "-184", "977", "2138")), .Names = c("IDDate",
> "First", "Second", "Third", "Fourth", "Fifth"), class = "data.frame",
> row.names = c(NA,
> -20L))
> mydf
>
> Felipe D. Carrillo
> Supervisory Fishery Biologist
> Department of the Interior
> US Fish & Wildlife Service
> California, USA
>
>
>
>
> __
> 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.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>

[[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.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Image into Excel file from R

2010-04-25 Thread Tal Galili
Hi Harsh,
I don't know the answer,
But I would suggest you search and look at:
rcom



Contact
Details:---
Contact me: tal.gal...@gmail.com |  972-52-7275845
Read me: www.talgalili.com (Hebrew) | www.biostatistics.co.il (Hebrew) |
www.r-statistics.com (English)
--




On Sun, Apr 25, 2010 at 8:13 PM, Harsh  wrote:

> Hi useRs,
> I would like to know what R users are employing to get their
> images/plots created in R, into Excel sheets.
>
> I am aware of the various packages (xlsReadWrite, RODBC) to get data
> frames into R, but I would like to copy images too.
>
> Thank you for any help in solving this problem.
>
> Regards,
> Harsh Singhal
>
> __
> 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.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>

[[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.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] how to make read in a vector of 0s and 1s with no space between them

2010-04-25 Thread Tal Galili
*Solution:*
strsplit(c("10110100101001011101011"), "")

But make sure you change the output data type to the one you like (boolean,
numeric  and so on)



Contact
Details:---
Contact me: tal.gal...@gmail.com |  972-52-7275845
Read me: www.talgalili.com (Hebrew) | www.biostatistics.co.il (Hebrew) |
www.r-statistics.com (English)
--




On Sun, Apr 25, 2010 at 7:52 PM, Matthew Keller wrote:

> Hi all,
>
> Probably a rudimentary question. I have a flat file that looks like
> this (the real one has ~10e6 elements):
>
> 10110100101001011101011
>
> and I want to pull that into R as a vector, but with each digit being
> it's own element. There are no separators between the digits. How can
> I accomplish this? Thanks in advance!
>
> Matt
>
> --
> Matthew C Keller
> Asst. Professor of Psychology
> University of Colorado at Boulder
> www.matthewckeller.com
>
> __
> 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.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>

[[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.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] Upgrading R using the "global library folder" strategy - what do you think about it?

2010-04-25 Thread Tal Galili
Hello dear R-help mailing list,

The other day I published a blog post (with some R code) to help R-users who
want to implement a simpler upgrading strategy for R (under windows - but
probably the same will be true of mac OS, I am not sure about Linux).

This e-mail has 3 goals: (a) To share, (b) to get feedback, and (c) to
propose to implement this strategy to R's core.
*
*
*a) Share*
The idea of this upgrading strategy is to save steps in upgrading.  When one
wishes to upgrade R, instead of doing the following three steps:
1) download new R and install
2) copy the "library" content from the old R to the new R
3) upgrade all of the packages (in the library folder) to the new version of
R.
You could instead just have steps 1 and 3, and skip step 2.
How?
By using a "global" library which will reside outside (and besides) of the
normal R installation folder.
Here is the link to the post where I explain how to do this with R running
under windows (and also supplied some R code to help with this move):
http://www.r-statistics.com/2010/04/changing-your-r-upgrading-strategy-and-the-r-code-to-do-it-on-windows/
(Credit: this strategy was proposed by Dirk
Eddelbuettel,
to whom I give my thanks)

*b) Feedback*
I would love to know if someone here can suggest when this strategy might
not be the best one.
I also welcome any suggestions for improving the code I wrote for helping
users make the transition to this upgrading system.

*c) R core implementation ?!*
I hope I am not being rude (or jumping into any open doors) in asking this
but...
What do you think about implementing this strategy into the R basic
installation?



With honest respect and care,
Tal

Contact
Details:---
Contact me: tal.gal...@gmail.com |  972-52-7275845
Read me: www.talgalili.com (Hebrew) | www.biostatistics.co.il (Hebrew) |
www.r-statistics.com (English)
--

[[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.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] how to import a dataframe with mixed text and numbers

2010-04-25 Thread Tal Galili
I would try using something like
read.table
with
read.table(..., sep = "---")

And then clean the variables one by one (you'll need to search the mailing
list for help on time variables. And also for ways to search and replace
text - all exist as answers here)


Contact
Details:---
Contact me: tal.gal...@gmail.com |  972-52-7275845
Read me: www.talgalili.com (Hebrew) | www.biostatistics.co.il (Hebrew) |
www.r-statistics.com (English)
--




On Sat, Apr 24, 2010 at 10:11 PM, Felipe Carrillo
wrote:

> ---

[[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.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Noobie question on aggregate tapply and by

2010-04-25 Thread Tal Galili
Here is one solution for your question:

mean.data <- with(DF, tapply(data, years, mean, na.rm = T))
mean.data2 <- with(DF, tapply(data2, years, mean, na.rm = T))
cbind(mean.data , mean.data2)


Another one would be for you to read about the package plyr (which is better
for this job, actually)

And regarding the years being recoded, look at either:
?cut
or
?recode (from the car package)

Best,
Tal




Contact
Details:---
Contact me: tal.gal...@gmail.com |  972-52-7275845
Read me: www.talgalili.com (Hebrew) | www.biostatistics.co.il (Hebrew) |
www.r-statistics.com (English)
--




On Sun, Apr 25, 2010 at 9:29 AM, steven mosher wrote:

> I have a 43MB dataframe ( 5 variables) and I'm trying to summarize subsets
> of the data.
> I've RTFM ( not very clear) and looked at a variety of samples but cant
> seem
> to figure out
> how to make these functions work.
>
> A sample of what I want to do would be this:
>
> ids<-seq(1,50)
>  years<-c(rep(5,10),rep(6,10),rep(7,10),rep(8,20))
>  data<-c(rep(23.2,7),rep(14.2,17),rep(29.2,6),rep(13.4,10),rep(16.3,5), NA,
> rep(40,4))
> data2<-c(rep(22.2,5),rep(13.2,8),NA, rep(29.8,16),rep(12.4,10),rep(16.3,5),
> rep(38,5))
>  DF<-data.frame(ids,years,data,data2)
>
> That will give you a dataframe that is a good analog of what I have. i
> would like to calculate means
> ( with NA removed na.rm) for each level of years.
>
>  data  data2
> 5 xx. yy.
> 6 xx yz
> 7 ... ,,,
> 8 ..  ...
>
> And then things like this:
>
> 5-7 :   xx yy
> 8   :xy zz
>
>[[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.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>

[[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.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] After updating packages I got "Error in normalizePath(path) " for one of the packages

2010-04-23 Thread Tal Galili
Hi all,

The error I got was this:
Error in normalizePath(path) :
  path[1]="C:\Program Files\R\library/gdata": The system cannot find the
file specified
(after some other packages updated fine)

For running:
update.packages(checkBuilt=TRUE, ask=FALSE)


My sessionInfo ():


R version 2.11.0 (2010-04-22)
i386-pc-mingw32

locale:
[1] LC_COLLATE=English_United States.1252  LC_CTYPE=English_United
States.1252LC_MONETARY=English_United States.1252
[4] LC_NUMERIC=C   LC_TIME=English_United
States.1252

attached base packages:
[1] stats graphics  grDevices utils datasets  methods   base

loaded via a namespace (and not attached):
[1] tools_2.11.0





Contact
Details:---
Contact me: tal.gal...@gmail.com |  972-52-7275845
Read me: www.talgalili.com (Hebrew) | www.biostatistics.co.il (Hebrew) |
www.r-statistics.com (English)
--

[[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.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] I am failing to run the (windows) example in: help(Startup)

2010-04-23 Thread Tal Galili
Thanks Uwe.
Indeed - it now worked.





Contact
Details:---
Contact me: tal.gal...@gmail.com |  972-52-7275845
Read me: www.talgalili.com (Hebrew) | www.biostatistics.co.il (Hebrew) |
www.r-statistics.com (English)
--




2010/4/23 Uwe Ligges 

>
>
> Am 23.04.2010 14:54, schrieb Tal Galili:
>
>  Hi all,
>>
>> Inside:
>> help(Startup)
>>
>> There is an example suggesting:
>>
>> ## Example .Renviron on Windows
>> R_LIBS=C:/R/library
>>
>> If I update the file:
>> Rprofile.site
>> in "etc"
>>
>
>
> You probably meant to put it in Renviron.site rather than Rprofile.site ...
>
> Uwe Ligges
>
>
>  When I start R I get:
>>
>>
>> Error: 16:10: unexpected '/'
>> 16: R_LIBS=C:/
>>  ^
>>
>>
>> Of course, if I put it in quotes it works, But I was wondering if I am
>> missing something or is it a mistake in the example?
>>
>> Thanks,
>> Tal
>>
>>
>> Contact
>> Details:---
>> Contact me: tal.gal...@gmail.com |  972-52-7275845
>> Read me: www.talgalili.com (Hebrew) | www.biostatistics.co.il (Hebrew) |
>> www.r-statistics.com (English)
>>
>> --
>>
>>[[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.org/posting-guide.html
>> and provide commented, minimal, self-contained, reproducible code.
>>
>

[[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.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] I am failing to run the (windows) example in: help(Startup)

2010-04-23 Thread Tal Galili
Hi all,

Inside:
help(Startup)

There is an example suggesting:

## Example .Renviron on Windows
R_LIBS=C:/R/library

If I update the file:
Rprofile.site
in "etc"

When I start R I get:


Error: 16:10: unexpected '/'
16: R_LIBS=C:/
 ^


Of course, if I put it in quotes it works, But I was wondering if I am
missing something or is it a mistake in the example?

Thanks,
Tal


Contact
Details:---
Contact me: tal.gal...@gmail.com |  972-52-7275845
Read me: www.talgalili.com (Hebrew) | www.biostatistics.co.il (Hebrew) |
www.r-statistics.com (English)
--

[[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.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] How do you change library location ? (in R under windows XP)

2010-04-23 Thread Tal Galili
Due to the new R 2.11 release, I want to implement Dirk's suggestion
here
.

So for that I am asking - How can I (permanently) change R's library path?
(The best solution would be one that can be run from within R)
Thanks,
Tal


Contact
Details:---
Contact me: tal.gal...@gmail.com |  972-52-7275845
Read me: www.talgalili.com (Hebrew) | www.biostatistics.co.il (Hebrew) |
www.r-statistics.com (English)
--

[[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.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] index ordering

2010-04-22 Thread Tal Galili
Ah.
Close to what David suggested...
Try:

?which.max




Contact
Details:---
Contact me: tal.gal...@gmail.com |  972-52-7275845
Read me: www.talgalili.com (Hebrew) | www.biostatistics.co.il (Hebrew) |
www.r-statistics.com (English)
--




On Thu, Apr 22, 2010 at 10:57 PM, tamas barjak wrote:

> Of course!
>
> > max(dbinom(0:20, 20, 0.4))
> [1] 0.1797058
>
>
> I would like the place of the maximum for this. The value is found, I do
> not know it only which index belongs to.
>
>

[[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.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] R2.11.0 - rasterImage() and barplot fill-patterns

2010-04-22 Thread Tal Galili
Hello Peter,
Thank you, and the R core team, for the new release.


I see that in R 2.11.0 there is now support for rendering of raster (bitmap)
images through rasterImage().

I am wondering - can this be used to create a texture/fill-pattern for
hist()/barplot()  ?
(A request made several times throughout the years on the mailing list.
For example:
http://osdir.com/ml/lang.r.general/2005-07/msg00799.html
)

(I am also sending this e-mail to the maintainers of lattice, ggplot2 and
gplots in the hope for more perspectives)

With much respect,
Tal








Contact
Details:---
Contact me: tal.gal...@gmail.com |  972-52-7275845
Read me: www.talgalili.com (Hebrew) | www.biostatistics.co.il (Hebrew) |
www.r-statistics.com (English)
--




On Thu, Apr 22, 2010 at 12:01 PM, Peter Dalgaard  wrote:

> I've rolled up R-2.11.0.tar.gz a short while ago. This is a development
> release which contains a number of new features.
>
> Also, a number of mostly minor bugs have been fixed. See the full list
> of changes below.
>
> NOTE: The build platform has been changed for this release. Please watch
> out extra carefully for anomalies.
>
> You can get it from
>
> http://cran.r-project.org/src/base/R-2/R-2.11.0.tar.gz
>
> or wait for it to be mirrored at a CRAN site nearer to you.
>
> Binaries for various platforms will appear in due course.
>
>   For the R Core Team
>
>   Peter Dalgaard
>
> These are the md5sums for the freshly created files, in case you wish
> to check that they are uncorrupted:
>
> MD5 (AUTHORS) = ac9746b4845ae81f51cfc99262f5
> MD5 (COPYING) = eb723b61539feef013de476e68b5c50a
> MD5 (COPYING.LIB) = a6f89e2100d9b6cdffcea4f398e37343
> MD5 (FAQ) = 5b653442bedab476a4eff7468192fb5f
> MD5 (INSTALL) = 70447ae7f2c35233d3065b004aa4f331
> MD5 (NEWS) = 59017734fb8474f98f994c7a5a27f9fb
> MD5 (ONEWS) = a8c985af5ad5e9c7e0a9f502d07baeb4
> MD5 (OONEWS) = 4f004de59e24a52d0f500063b4603bcb
> MD5 (R-latest.tar.gz) = c6c1e866299f533617750889c729bfb3
> MD5 (README) = 433182754c05c2cf7a04ad0da474a1d0
> MD5 (RESOURCES) = 020479f381d5f9038dcb18708997f5da
> MD5 (THANKS) = f2ccf22f3e20ebaa86f8ee5cc6b0f655
> MD5 (R-2/R-2.11.0.tar.gz) = c6c1e866299f533617750889c729bfb3
>
> This is the relevant part of the NEWS file:
>
>CHANGES IN R VERSION 2.11.0
>
>
> SIGNIFICANT USER-VISIBLE CHANGES
>
>o   Packages must have been installed under R >= 2.10.0, as the
>current help system is the only one now supported.
>
>o   A port to 64-bit Windows is now available as well as binary
>package repositiories: see the 'R Administration and
>Installation Manual'.
>
>o   Argument matching for primitive functions is now done in the
>same way as for interpreted functions except for the deliberate
>exceptions
>
>call switch .C .Fortran .Call .External
>
>all of which use positional matching for their first argument,
>and also some internal-use-only primitives.
>
>o   The default device for command-line R at the console on Mac OS X
>is now quartz() and not X11().
>
>
> NEW FEATURES
>
>o   The 'open' modes for connections are now interpreted more
>consistently.  open = "r" is now equivalent to open = "rt" for
>all connections.  The default open = "" now means "rt" for all
>connections except the compressed file connections gzfile(),
>bzfile() and xzfile() for which it means "rb".
>
>o   R CMD INSTALL now uses the internal untar() in package utils:
>this ensures that all platforms can install bzip2- and
>xz-compressed tarballs.  In case this causes problems (as it
>has on some Windows file systems when run from Cygwin tools)
>it can be overridden by the environment variable
>R_INSTALL_TAR: setting this to a modern external tar program
>will speed up unpacking of large (tens of Mb or more)
>tarballs.
>
>o   help(try.all.packages = TRUE) is much faster (although the
>time taken by the OS to find all the packages the first time
>it is used can dominate the time).
>
>o   R CMD check has a new option '--timings' to record
>per-example timings in file .Rcheck/-Ex.timings.
>
>o   The TRE library has been updated to version 0.8.0 (minor bugfixes).
>
>o   grep[l], [g]sub and [g]regexpr now work in bytes in an 8-bit
>locales if there is no marked UTF-8 input string: this will be
>somewhat faster, and for [g]sub() give the result in the
>native encoding rather than in UTF-8 (which returns to the
>behaviour prior to R 2.10.0).
>
>o   A new argument 'skipCalls' has been added to browser() so that
>it can report the original context when called by other
>debugging functions.
>
>o   More validity checking of UTF-8 a

Re: [R] long output in R

2010-04-21 Thread Tal Galili
Not answering your question,

But if you where to ask this regarding plots, the answer would be to use:
par(ask = T)


Best,
Tal

Contact
Details:---
Contact me: tal.gal...@gmail.com |  972-52-7275845
Read me: www.talgalili.com (Hebrew) | www.biostatistics.co.il (Hebrew) |
www.r-statistics.com (English)
--




On Thu, Apr 22, 2010 at 1:01 AM, Mingfeng Lin wrote:

> Hello all:
>
> Is there a way to set up R such that, when you have a very long output
> from a command, it will pause when it has displayed one-screen of
> information and ask me to press a button to continue displaying? I
> happen to have one such command and the information I need is at the
> top of the output - and it's just nowhere to be seen.
>
> (If you are familiar with Stata, I'm looking for something equivalent
> to the -set more on- option there.
>
> Thanks a lot!
>
> Mingfeng
>
> __
> 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.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>

[[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.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] Community help: creating Syntax-Highlighter-brush for R and WordPress.com

2010-04-21 Thread Tal Galili
Hello dear R community,

*Background:*
Since I see more and more R users who blog about R opening their blogs in
WordPress.com, I contacted one of their workers asking if they could add
Syntax highlight support for R.
He replied to me saying that if there was a "Brush" for R, according to the
format given here:
http://joekuan.wordpress.com/2009/07/28/css-syntaxhighlighter-2-0-short-tutorial-on-how-to-create-your-own-syntax-highlighter/
He would add it to the WordPress.com service.

*My questions* are:
1) Is there already an R brush system that can be easily ported to the brush
syntax I linked to?
2) If not, will anyone here be willing to help in creating this brush? (we
need knowledge in regex and optionally css)
Here is a link to a bunch of already existing brushes (They have matlab
there - maybe that could help as a basis if nothing else exists)
http://www.undermyhat.org/blog/2009/09/list-of-brushes-syntaxhighligher/


Best,
Tal




Contact
Details:---
Contact me: tal.gal...@gmail.com |  972-52-7275845
Read me: www.talgalili.com (Hebrew) | www.biostatistics.co.il (Hebrew) |
www.r-statistics.com (English)
--

[[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.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Can I compare two clusters without using their distance-matrix (dist()) ?

2010-04-21 Thread Tal Galili
Wonderful Christian, thank you for the (*very*) helpful reply!

Best,
Tal

Contact
Details:---
Contact me: tal.gal...@gmail.com |  972-52-7275845
Read me: www.talgalili.com (Hebrew) | www.biostatistics.co.il (Hebrew) |
www.r-statistics.com (English)
--




On Wed, Apr 21, 2010 at 8:16 PM, Christian Hennig wrote:

> Dear Tal,
>
> I took the definition of the Hubert gamma- and Dunn-index from the Gordon
> book. They are actually not about comparing two clusters, at least not in
> that reference, and they require dissimilarities.
>
> The adjusted Rand index and Meila's VI, as implemented in cluster.stats,
> compare two clusterings. If you set compareonly=TRUE in cluster.stats, it
> only computes these two indexes, so it doesn't need the dissimilarity matrix
> in principle. I will probably in the next update
> change it so that in this case you don't need to provide a
> dissimilarity matrix.
>
> Until then, you can supply a noninformative matrix.
> Example:
> c1 <- sample(4,100,replace=TRUE)
> c2 <- sample(5,100,replace=TRUE)
> cs <- cluster.stats(d=matrix(0,ncol=100,nrow=100),c1,c2,compareonly=TRUE)
>
> cs$corrected.rand
> cs$vi
>
> Hope this helps,
> Christian
>
>
>
>
> On Wed, 21 Apr 2010, Tal Galili wrote:
>
>  Thanks for the fast reply Uwe.
>>
>> My hope in posting this was to find if anyone had already done work (in R)
>> in this direction.  So far I wasn't able to find any such relevant code,
>> so
>> I turned to the mailing list.
>>
>> Regarding new implementations - thanks for offering! - I have already came
>> around one such algorithm - I implemented it, and will probably publish it
>> on my blog <http://www.r-statistics.com/> in the near future.
>>
>>
>> If any one else has any reference to R implementation, it would be most
>> helpful,
>> Tal
>>
>>
>> Contact
>> Details:---
>> Contact me: tal.gal...@gmail.com |  972-52-7275845
>> Read me: www.talgalili.com (Hebrew) | www.biostatistics.co.il (Hebrew) |
>> www.r-statistics.com (English)
>>
>> --
>>
>>
>>
>>
>> 2010/4/21 Uwe Ligges 
>>
>>  On 21.04.2010 18:15, Tal Galili wrote:
>>>
>>>  Hello all,
>>>>
>>>> I would like to compare the similarity of two cluster solutions using a
>>>> validation criteria (such as Hubert's gamma coefficient, the Dunn index
>>>> the
>>>> corrected rand index and so on)
>>>>
>>>> I see (from here:http://www.statmethods.net/advstats/cluster.html) that
>>>> the function cluster.stats() in the fpc package provides a mechanism
>>>> for comparing 2 cluster solutions - *BUT* - it requires me to give the
>>>> the distance matrix among objects.
>>>>
>>>> *My question *is: What ways can you suggest for comparing two cluster
>>>> solutions, while using the cluster indicators only (i.e: a vector saying
>>>> to
>>>> which cluster each object belongs to), and WITHOUT asking to submit the
>>>> distance matrix between the objects.
>>>>
>>>>
>>> Don't know. If you have a theoretical solution and can provide the
>>> description of a method, there will be many people around happy to make
>>> an
>>> algorithm and implement it.
>>>
>>> Uwe Ligges
>>>
>>>
>>>
>>>  Thanks,
>>>
>>>> Tal
>>>>
>>>>
>>>>
>>>> Contact
>>>> Details:---
>>>> Contact me: tal.gal...@gmail.com |  972-52-7275845
>>>> Read me: www.talgalili.com (Hebrew) | www.biostatistics.co.il (Hebrew)
>>>> |
>>>> www.r-statistics.com (English)
>>>>
>>>>
>>>> --
>>>>
>>>>   [[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.org/posti

Re: [R] Can I compare two clusters without using their distance-matrix (dist()) ?

2010-04-21 Thread Tal Galili
Thanks for the fast reply Uwe.

My hope in posting this was to find if anyone had already done work (in R)
in this direction.  So far I wasn't able to find any such relevant code, so
I turned to the mailing list.

Regarding new implementations - thanks for offering! - I have already came
around one such algorithm - I implemented it, and will probably publish it
on my blog <http://www.r-statistics.com/> in the near future.

If any one else has any reference to R implementation, it would be most
helpful,
Tal


Contact
Details:---
Contact me: tal.gal...@gmail.com |  972-52-7275845
Read me: www.talgalili.com (Hebrew) | www.biostatistics.co.il (Hebrew) |
www.r-statistics.com (English)
--




2010/4/21 Uwe Ligges 

> On 21.04.2010 18:15, Tal Galili wrote:
>
>> Hello all,
>>
>> I would like to compare the similarity of two cluster solutions using a
>> validation criteria (such as Hubert's gamma coefficient, the Dunn index
>> the
>> corrected rand index and so on)
>>
>> I see (from here:http://www.statmethods.net/advstats/cluster.html) that
>> the function cluster.stats() in the fpc package provides a mechanism
>> for comparing 2 cluster solutions - *BUT* - it requires me to give the
>> the distance matrix among objects.
>>
>> *My question *is: What ways can you suggest for comparing two cluster
>> solutions, while using the cluster indicators only (i.e: a vector saying
>> to
>> which cluster each object belongs to), and WITHOUT asking to submit the
>> distance matrix between the objects.
>>
>
> Don't know. If you have a theoretical solution and can provide the
> description of a method, there will be many people around happy to make an
> algorithm and implement it.
>
> Uwe Ligges
>
>
>
>  Thanks,
>> Tal
>>
>>
>>
>> Contact
>> Details:---
>> Contact me: tal.gal...@gmail.com |  972-52-7275845
>> Read me: www.talgalili.com (Hebrew) | www.biostatistics.co.il (Hebrew) |
>> www.r-statistics.com (English)
>>
>> --
>>
>>[[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.org/posting-guide.html
>> and provide commented, minimal, self-contained, reproducible code.
>>
>

[[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.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] Can I compare two clusters without using their distance-matrix (dist()) ?

2010-04-21 Thread Tal Galili
Hello all,

I would like to compare the similarity of two cluster solutions using a
validation criteria (such as Hubert's gamma coefficient, the Dunn index the
corrected rand index and so on)

I see (from here:http://www.statmethods.net/advstats/cluster.html) that
the function cluster.stats() in the fpc package provides a mechanism
for comparing 2 cluster solutions - *BUT* - it requires me to give the
the distance matrix among objects.

*My question *is: What ways can you suggest for comparing two cluster
solutions, while using the cluster indicators only (i.e: a vector saying to
which cluster each object belongs to), and WITHOUT asking to submit the
distance matrix between the objects.

Thanks,
Tal



Contact
Details:---
Contact me: tal.gal...@gmail.com |  972-52-7275845
Read me: www.talgalili.com (Hebrew) | www.biostatistics.co.il (Hebrew) |
www.r-statistics.com (English)
--

[[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.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


<    1   2   3   4   5   6   7   8   >