Re: [R] About the interaction A:B

2010-03-05 Thread blue sky
ess '-1' is included. You may need to adjust your interpretation of A:B and A:B -1 in these cases. > dim(my_subset(model.matrix(Y ~ A:B - 1,fr))) [1] 12 12 > dim(my_subset(model.matrix(Y ~ A:B,fr))) [1] 12 13 > Note that you'll get quite different results if A and/or B are not f

Re: [R] Nonparametric generalization of ANOVA

2010-03-05 Thread blue sky
r than a mailing list: > > http://lmgtfy.com/?q=non-parametric+anova+R > > or > > http://www.justfuckinggoogleit.com/search.pl?query=non+parametric+anova+R > > Jeremy > > > On 5 March 2010 05:19, blue sky wrote: >> My interpretation of the relation between 1-way A

Re: [R] Nonparametric generalization of ANOVA

2010-03-05 Thread blue sky
On Fri, Mar 5, 2010 at 9:42 AM, David Winsemius wrote: > > On Mar 5, 2010, at 10:34 AM, Matthias Gondan wrote: > >>> This is your first of three postings in the last hour and they are all in >>> a category that could well be described as requests for tutoring in basic >>> statistical topics. I am

Re: [R] About the interaction A:B

2010-03-05 Thread blue sky
: > The way to understand this is to look at the output of model.matrix: > > model.matrix(fo, fr) > > for each formula you tried.  If your data is large you will have to > use a subset not to be overwhelmed with output. > > On Fri, Mar 5, 2010 at 9:08 AM, blue sky wrote

[R] About the interaction A:B

2010-03-05 Thread blue sky
Suppose, 'fr' is data.frame with columns 'Y', 'A' and 'B'. 'A' has levels 'Aa' 'Ab' and 'Ac', and 'B' has levels 'Ba', 'Bb', 'Bc' and 'Bd'. 'Y' columns are numbers. I tried the following three sets of commands. I understand that A*B is equivalent to A+B+A:B. However, A:B in A+B+A:B is different fr

[R] How to compute contrast between more than 2 cells? (in contrast package)

2010-03-05 Thread blue sky
I have contacted the author of the contrast package, but received no reply. Could somebody that I have the experience on this package give me some hint. In the vignette of the package, I only see example to compute contrasts between 2 cells. Is there a way to compute the contrast between more than

[R] Nonparametric generalization of ANOVA

2010-03-05 Thread blue sky
My interpretation of the relation between 1-way ANOVA and Wilcoxon's test (wilcox.test() in R) is the following. 1-way ANOVA is to test if two or multiple distributions are the same, assuming all the distributions are normal and have equal variances. Wilcoxon's test is to test two distributions ar

[R] binding multidimension array

2010-02-24 Thread blue sky
I don't find rbind, cbind or other bind that bind in other dimesions for multidimension array while keeping the result of the same dimension. For example, say, dim(x)=c(2,3,4), dim(y)=c(3,3,4). I want to have the result z, where dim(z)=c(2+3,3,4), when I bind x and y in the first dimenion. The bin

Re: [R] What is the difference between expression and quote whenused with eval()?

2010-02-20 Thread blue sky
On Sat, Feb 20, 2010 at 2:40 AM, Romain Francois wrote: > On 02/19/2010 10:31 PM, William Dunlap wrote: >> >>> -Original Message- >>> From: r-help-boun...@r-project.org >>> [mailto:r-help-boun...@r-project.org] On Behalf Of blue sky >>> Se

Re: [R] What is the difference between expression and quote when used with eval()?

2010-02-19 Thread blue sky
On Fri, Feb 19, 2010 at 12:39 PM, Peter Dalgaard wrote: > blue sky wrote: >> >> I made the following example to see what are the difference between >> expression and quote. But I don't see any difference when they are >> used with eval()? Could somebody le

[R] What is the difference between expression and quote when used with eval()?

2010-02-19 Thread blue sky
I made the following example to see what are the difference between expression and quote. But I don't see any difference when they are used with eval()? Could somebody let me know what the difference is between expression and quote? expr=expression(2*3) quo=quote(2*3) eval(expr) str(expr) class(

[R] How to check the two different nulls?

2010-02-15 Thread blue sky
x=list(a=1,b=NULL) is.null(x$b) is.null(x$c) Both the above two commands give me TRUE, but in the first one, b is NULL, in the second one, c doesn't exist. Are there functions that can help me distinguish the two different nulls? __ R-help@r-project.org

[R] Which method is called when print(a_list)?

2010-02-15 Thread blue sky
I don't find print.list. Could somebody let me know which method is called when I run command print(a_list), where a_list is a list? Is 'print.default' used for printing a list? __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r

[R] Which method is called in command like "class(x)='something'"?

2010-02-15 Thread blue sky
> x=3 > `class<-`(x,'something')#this command prints [1] 3 attr(,"class") [1] "something" > x=3 > class(x)='something'#this command doesn't print anything The first of the above two commands print the content of 'x' but the second doesn't, although both of them set the argument 'x'. I'm wondering

[R] NextMethod() example from S Programming by Venables and Ripley (page 78)

2010-02-13 Thread blue sky
S Programming by Venables and Ripley (page 78) has the example listed at the end of this email. However, I get the following error when I try the example. I don't understand the descriptions of NextMethod on its help page. Could somebody let me know how to fix the error of this example? > test(x)

Re: [R] How to source files from a search path?

2010-02-12 Thread blue sky
On Fri, Feb 12, 2010 at 11:41 PM, blue sky wrote: > On Fri, Feb 12, 2010 at 6:11 PM, Don MacQueen wrote: >> Well, you still will need Sys.getenv() to get the value of the environment >> variable into R. >> >> Are you familiar with the function named list.files()

Re: [R] How to source files from a search path?

2010-02-12 Thread blue sky
On Fri, Feb 12, 2010 at 6:11 PM, Don MacQueen wrote: > Well, you still will need Sys.getenv() to get the value of the environment > variable into R. > > Are you familiar with the function named list.files() ? > > This may do the job: > >   source( list.files( Sys.getenv('SOMEENVVAR'), pattern='myf

Re: [R] How to source files from a search path?

2010-02-12 Thread blue sky
useful if I want to make such a function myself. But my question was to look for a better version of source(). Are you clear about my question now? > -Original Message- > From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On > Behalf Of blue sky > Sent: Fr

[R] How to source files from a search path?

2010-02-12 Thread blue sky
Suppose some environment variable (say MY_R_INC) has a number of paths. I want to source some file relative to some path in $MY_R_INC (just as #include in C++ does, which looks for header file in a number of directories). I RSiteSearch'ed, but I don't find any function that satisfies my need. Could

[R] Why double quote is preferred?

2010-02-12 Thread blue sky
?'`' shows the following: "Single and double quotes delimit character constants. They can be used interchangeably but double quotes are *preferred* (and character constants are printed using double quotes), so single quotes are normally only used to delimit character constants containing double qu

Re: [R] Is there a way to figure out what nonlocal variables and functions have been used in a function?

2010-02-12 Thread blue sky
On Fri, Feb 12, 2010 at 1:36 PM, Sharpie wrote: > > > blue sky wrote: >> >> x=10 >> f=function() {print('in f')} >> g=function() {f(); print(x)} >> g() >> >> Suppose I have the above code, I want to know what functions and >> var

Re: [R] How to get the source code for the assignment of a variable?

2010-02-12 Thread blue sky
On Fri, Feb 12, 2010 at 1:38 AM, Sharpie wrote: > > > djhurio wrote: >> >> I believe there is not such thing as source code for a variable. I believe >> if you define x=y*y, x is keeping only the values of y*y, but not how they >> were computed. Am I right? >> > > In general yes.  Basic variables

[R] Is there a way to figure out what nonlocal variables and functions have been used in a function?

2010-02-12 Thread blue sky
x=10 f=function() {print('in f')} g=function() {f(); print(x)} g() Suppose I have the above code, I want to know what functions and variables have been used in the function g (in this case, f and x). Is there a function to do so? __ R-help@r-project.org

[R] How to get the source code for the assignment of a variable?

2010-02-11 Thread blue sky
'get' can give me the source code for a function. Is there a way to get the source code for a variable? In the following example, the source code for x is 'y*y'. Is there a way to get it using the string 'x'? > f=function(){print('xx')} > get('f') function(){print('xx')} > y=3 > x=y*y > get('x')

[R] How to use a string to refer a function?

2010-02-11 Thread blue sky
> f=function(){ print('in f')} > attr(f, 'source') [1] "function(){ print('in f')}" I have the above simple function. I can use the variable f to refer to the function and get the function source. Suppose that I have 'f' as a string (say I get it from ls()), could somebody let me know how to get