Re: [R] variable selection when categorical variables are available
On Tue, 11 Apr 2006, Mike Wolfgang wrote: Probably it is not highly relevant question: Why do stepwise regression functions in R (step() or stepAIC()) add/delete categorical variables as a set? Yes, those two do. Others (e.g. in package leaps) may not. For example, I have a four-level factor variable d, so dummies are d1,d2,d3, as stepwise regression operates d, adding or removing, d1,d2,d3 are simultaneously added/removed. What's the concern here if operating dummies individually? Model interpretability or anything else? (it seems shrinkage methods can operate them one by one) -- Brian D. Ripley, [EMAIL PROTECTED] Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UKFax: +44 1865 272595 __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] long captions -- new issue
On Wed, 12 Apr 2006, Brian Quinif wrote: I have found out that the way to have a break apart a long caption in the way that one desires is to have a short caption for use in the list of tables that is not broken with \\ I can manually adjust the LaTeX output from the Hmisc function latex() to get the tables how I want them. However, I would like to automate the creation of these tables. Inside the latex() function, I tried this: caption='Estimated HOPE Effects on \\ Typical First-Year Students, 1990/1995 \\ (Robust Std. Errors in Parentheses)', caption.lot='HOPE Effects on Typical First-Year Students' The resulting latex output however, turns the \\ into \, which will not create the line breaks that I want. How can I remedy this? You inserted \ not \\ ! (Remember that R character strings use C-style escapes: see e.g. ?Quotes.) Use to insert \\ -- Brian D. Ripley, [EMAIL PROTECTED] Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UKFax: +44 1865 272595 __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] Time Series information in formulae
Dear List The UKgas data is stored as an object of class 'ts'. I am trying to use UKgas in a formula as argument to a function. However, I do not know how to access the 'time series' information in the response (such as start() end() etc.). Here is a boiled down example. ssm - function(formula, data = list(),subset=NULL) { cl - match.call() if (missing(data)) data - environment(formula) mf - match.call(expand.dots = FALSE) mf$drop.unused.levels - TRUE mf[[1]] - as.name(model.frame) mf - eval(mf, .GlobalEnv) mt - attr(mf, terms) y - model.response(mf, numeric) print(class(y)) } R class(UKgas) [1] ts R ssm(UKgas~1) [1] numeric R ssm(log10(UKgas)~1) [1] numeric I want the latter two to be ts. I have tried putting any in place of numeric in the call to model.response, but it does not change anything for me. How do I retrieve the response from a formula without loosing its ts status? Best, Claus Claus Dethlefsen, MSc, PhD Biostatistician at Center for Cardiovascular Research Aalborg Hospital, Aarhus University Hospital, Denmark __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] useR! 2006: April 15 regular registration deadline
Dear useRs, we would like to inform you that we are approaching the regular registration deadline (2006-04-15) of useR! 2006, the second R user conference taking place in Vienna on June 15-17. So if you plan to join the conference, this is the perfect time to register! The pre-conference tutorials, on June 14, already attracted a lot of interest, so make sure to book _now_ if you are planning to attend one or two of the tutorials given by prominent members of the R community. The scientific program, including all abstracts, is available from the conference Web page at http://www.R-project.org/useR-2006/ We are looking forward to meeting you in Vienna, The useR! 2006 organizing team. ___ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-announce __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] long captions -- new issue
I just found that out thanks to Frank Harrell. Thanks, though. 2006/4/12, Prof Brian Ripley [EMAIL PROTECTED]: On Wed, 12 Apr 2006, Brian Quinif wrote: I have found out that the way to have a break apart a long caption in the way that one desires is to have a short caption for use in the list of tables that is not broken with \\ I can manually adjust the LaTeX output from the Hmisc function latex() to get the tables how I want them. However, I would like to automate the creation of these tables. Inside the latex() function, I tried this: caption='Estimated HOPE Effects on \\ Typical First-Year Students, 1990/1995 \\ (Robust Std. Errors in Parentheses)', caption.lot='HOPE Effects on Typical First-Year Students' The resulting latex output however, turns the \\ into \, which will not create the line breaks that I want. How can I remedy this? You inserted \ not \\ ! (Remember that R character strings use C-style escapes: see e.g. ?Quotes.) Use to insert \\ -- Brian D. Ripley, [EMAIL PROTECTED] Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UKFax: +44 1865 272595 __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Time Series information in formulae
The problem here is that you called model.frame() with (I presume, the 'factory-fresh' default) na.action=na.omit, and model.frame is documented to remove tsp attributes in that case. Use model.frame(..., na.action = NULL), e.g. model.frame(~UKgas, na.action=NULL)[[1]] is a time series but model.frame(~UKgas, na.action=na.omit)[[1]] is not. See ?model.frame. On Tue, 11 Apr 2006, Claus Dethlefsen wrote: Dear List The UKgas data is stored as an object of class 'ts'. I am trying to use UKgas in a formula as argument to a function. However, I do not know how to access the 'time series' information in the response (such as start() end() etc.). Here is a boiled down example. ssm - function(formula, data = list(),subset=NULL) { cl - match.call() if (missing(data)) data - environment(formula) mf - match.call(expand.dots = FALSE) mf$drop.unused.levels - TRUE mf[[1]] - as.name(model.frame) mf - eval(mf, .GlobalEnv) mt - attr(mf, terms) y - model.response(mf, numeric) print(class(y)) } R class(UKgas) [1] ts R ssm(UKgas~1) [1] numeric R ssm(log10(UKgas)~1) [1] numeric I want the latter two to be ts. I have tried putting any in place of numeric in the call to model.response, but it does not change anything for me. How do I retrieve the response from a formula without loosing its ts status? Best, Claus Claus Dethlefsen, MSc, PhD Biostatistician at Center for Cardiovascular Research Aalborg Hospital, Aarhus University Hospital, Denmark __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html -- Brian D. Ripley, [EMAIL PROTECTED] Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UKFax: +44 1865 272595 __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] Kriging
Hi, Is there a function in R which can do kriging based on more than one semi-variogram ? Thanks in advance !! Guillaume __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] Variable Scope
Hi, I was wondering if there is a way to stop R looking outside the scope of a function, if it can't find the variable inside the function. I seem to waste hours debugging functions only to find I've used a wrong variable name somewhere, but the function still works because the variable exists higher up the hierachy. It seems it would be easier to debug if the function just went splat when it couldn't find the variable. Thanks James __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Variable Scope
Use local or codetools package as in: http://finzi.psych.upenn.edu/R/Rhelp02a/archive/69694.html http://finzi.psych.upenn.edu/R/Rhelp02a/archive/69695.html On 4/12/06, James Kirkby [EMAIL PROTECTED] wrote: Hi, I was wondering if there is a way to stop R looking outside the scope of a function, if it can't find the variable inside the function. I seem to waste hours debugging functions only to find I've used a wrong variable name somewhere, but the function still works because the variable exists higher up the hierachy. It seems it would be easier to debug if the function just went splat when it couldn't find the variable. Thanks James __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Variable Scope
On Wed, 12 Apr 2006, James Kirkby wrote: Hi, I was wondering if there is a way to stop R looking outside the scope of a function, if it can't find the variable inside the function. I seem to waste hours debugging functions only to find I've used a wrong variable name somewhere, but the function still works because the variable exists higher up the hierachy. It seems it would be easier to debug if the function just went splat when it couldn't find the variable. Sounds as if codetools (http://www.stat.uiowa.edu/~luke/R/codetools) would help. (You don't want to stop this in general, but this will tell you if symbols in your functions will not be visible locally.) -- Brian D. Ripley, [EMAIL PROTECTED] Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UKFax: +44 1865 272595 __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Time Series information in formulae
You might want to look at the dyn package. It allows time series in model formulae, e.g. this aligns UKgas and diff(UKgas) properly: dyn$lm(UKgas ~ diff(UKgas)) dyn$ transforms the above to dyn(lm(dyn(UKgas ~ diff(UKgas and the inner dyn adds class dyn to the formula's class vector so that subsequently model.formula.dyn will intercept it and pick off the class of the response and add some additional info to the result including the class. This leaves na.action= open for the usual uses.Modifying your example, by removing the last two lines (but otherwise leaving it unchanged): ssm - function(formula, data = list(),subset=NULL) { cl - match.call() if (missing(data)) data - environment(formula) mf - match.call(expand.dots = FALSE) mf$drop.unused.levels - TRUE mf[[1]] - as.name(model.frame) mf - eval(mf, .GlobalEnv) } library(dyn) out - dyn$ssm(UKgas ~ 1) attr(out, .Class) # ts # the same out - ssm(dyn(UKgas ~ 1)) attr(out, .Class) # ts On 4/12/06, Prof Brian Ripley [EMAIL PROTECTED] wrote: The problem here is that you called model.frame() with (I presume, the 'factory-fresh' default) na.action=na.omit, and model.frame is documented to remove tsp attributes in that case. Use model.frame(..., na.action = NULL), e.g. model.frame(~UKgas, na.action=NULL)[[1]] is a time series but model.frame(~UKgas, na.action=na.omit)[[1]] is not. See ?model.frame. On Tue, 11 Apr 2006, Claus Dethlefsen wrote: Dear List The UKgas data is stored as an object of class 'ts'. I am trying to use UKgas in a formula as argument to a function. However, I do not know how to access the 'time series' information in the response (such as start() end() etc.). Here is a boiled down example. ssm - function(formula, data = list(),subset=NULL) { cl - match.call() if (missing(data)) data - environment(formula) mf - match.call(expand.dots = FALSE) mf$drop.unused.levels - TRUE mf[[1]] - as.name(model.frame) mf - eval(mf, .GlobalEnv) mt - attr(mf, terms) y - model.response(mf, numeric) print(class(y)) } R class(UKgas) [1] ts R ssm(UKgas~1) [1] numeric R ssm(log10(UKgas)~1) [1] numeric I want the latter two to be ts. I have tried putting any in place of numeric in the call to model.response, but it does not change anything for me. How do I retrieve the response from a formula without loosing its ts status? Best, Claus Claus Dethlefsen, MSc, PhD Biostatistician at Center for Cardiovascular Research Aalborg Hospital, Aarhus University Hospital, Denmark __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html -- Brian D. Ripley, [EMAIL PROTECTED] Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UKFax: +44 1865 272595 __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Variable Scope
On 4/12/2006 5:49 AM, James Kirkby wrote: Hi, I was wondering if there is a way to stop R looking outside the scope of a function, if it can't find the variable inside the function. I seem to waste hours debugging functions only to find I've used a wrong variable name somewhere, but the function still works because the variable exists higher up the hierachy. It seems it would be easier to debug if the function just went splat when it couldn't find the variable. You don't want to do this, because very little in R is built-in to the language, many things (e.g. +, if, etc.) are functions stored in some environment outside your function. Duncan Murdoch __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] Error with 'var' in JGR
R-Users, I had a strange occurrence this AM I could use some help with. 'var' seems to have ceased to work for me when I used JGR 1.3 interface. So, I ran a quick test (following pg 57 of Dalgaard) in both the basic RGui and JGR interface (see below). I have re-installed R 2.2.1 and JGR 1.3 but had no luck so far figuring this out? Anyone have a suggestion? Or did I just make a mistake somewhere (which is more than likely). Thanks, Bret TX AM Output from RGui: x-rnorm(50) x [1] -1.016219752 0.940801964 0.168647573 0.328696253 -0.600957761 [6] -0.420394338 -1.140567123 -0.755041336 0.907831188 0.198247025 [11] -0.065116449 0.732841048 -0.400194138 -1.490167845 -1.488611328 [16] 0.311665408 -1.534002497 -1.094357124 -1.717282302 0.217445299 [21] -1.878605987 -0.214200092 -0.096099830 -0.357325121 -0.118191356 [26] -0.214543361 -0.399768989 0.235104678 -0.363194200 -0.275338828 [31] -0.336677033 -0.009178995 1.294139880 1.442454681 1.192023689 [36] -0.521847342 -1.070860356 -0.756584142 0.747503883 0.939960584 [41] -1.444890590 1.218499328 0.343071542 1.303250666 -0.603718755 [46] 0.979527031 -3.709878278 -0.051090815 -0.452191654 -0.206564681 mean(x) [1] -0.226039 sd(x) [1] 0.9917835 var(x) [1] 0.9836345 Output from JGR: x-rnorm(50) x [1] 0.79961648 -0.72223557 -0.10589876 [4] -0.25367834 -0.53518039 0.18296671 [7] 0.33981503 0.29208966 1.15002574 [10] 0.84356083 -0.87841050 0.31345819 [13] 0.61348608 1.13257372 -0.14366714 [16] -1.28563266 1.39519683 -0.85124979 [19] -1.65043342 0.93956978 1.36692691 [22] 0.81240164 -0.44326482 0.20741846 [25] 0.38536713 -0.57994109 1.10457148 [28] -0.99307813 -2.31580515 -1.61582072 [31] 1.63273805 -1.49289425 -1.33675463 [34] -1.17789478 -0.42209334 -0.21208394 [37] -2.21572873 0.35724725 -0.24758106 [40] 0.60470892 1.71646244 1.02161560 [43] 2.93773901 -0.92356017 -0.38588476 [46] -0.08622336 -0.09622387 -0.91419002 [49] 0.93453732 -0.25280526 mean(x) [1] -0.02108243 sd(x) [1] 1.077132 var(x) Error in get(x, envir, mode, inherits) : variable var was not found version platform i386-pc-mingw32 arch i386 os mingw32 system i386, mingw32 status major2 minor2.1 year 2005 month12 day 20 svn rev 36812 language R __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] factor analysis backwards
Hello! How can I do a factor analysis backwards to get an arbitrary covarianz matrix out of an arbitrary number of generated random variables that have a correlation near zero. Or the same question shorter: How to generate random variables that have a spezial correlation pattern. I would like to be able to do this to generate arbitrary data structures for simulation purpose sincerely stefan __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] factor analysis backwards
RSiteSearch(simulate specified covariance) will bring you to mvrnorm() in MASS. Please try to use R's built-in search capabilities first before posting. I realize that keywords can be hard to guess, but you may find that when the hits are **not** what you want, you need to refine your question more, as described in the posting guide (have you read it?) -- Bert Gunter -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Stefan Premke Sent: Wednesday, April 12, 2006 6:52 AM To: r-help@stat.math.ethz.ch Subject: [R] factor analysis backwards Hello! How can I do a factor analysis backwards to get an arbitrary covarianz matrix out of an arbitrary number of generated random variables that have a correlation near zero. Or the same question shorter: How to generate random variables that have a spezial correlation pattern. I would like to be able to do this to generate arbitrary data structures for simulation purpose sincerely stefan __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] factor analysis backwards
Stefan Premke wrote: Hello! How can I do a factor analysis backwards to get an arbitrary covarianz matrix out of an arbitrary number of generated random variables that have a correlation near zero. Or the same question shorter: How to generate random variables that have a spezial correlation pattern. I would like to be able to do this to generate arbitrary data structures for simulation purpose I'm not sure what you mean by arbitrary, but have a look at mvrnorm() in packages MASS. For example: library(MASS) cor(mvrnorm(n = 300, mu=rep(0,4), Sigma=diag(4))) [,1][,2][,3][,4] [1,] 1. -0.00524425 -0.04464669 -0.01223580 [2,] -0.00524425 1. -0.08920532 -0.10521937 [3,] -0.04464669 -0.08920532 1. -0.05316380 [4,] -0.01223580 -0.10521937 -0.05316380 1. sincerely stefan __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html -- Chuck Cleland, Ph.D. NDRI, Inc. 71 West 23rd Street, 8th floor New York, NY 10010 tel: (212) 845-4495 (Tu, Th) tel: (732) 512-0171 (M, W, F) fax: (917) 438-0894 __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Error with 'var' in JGR
It works well for me. x-rnorm(50) var(x) [1] 0.6998658 version _ platform i386-pc-mingw32 arch i386 os mingw32 system i386, mingw32 status major2 minor2.1 year 2005 month12 day 20 svn rev 36812 language R JRG:1.3 version 2006/4/12, Bret Collier [EMAIL PROTECTED]: R-Users, I had a strange occurrence this AM I could use some help with. 'var' seems to have ceased to work for me when I used JGR 1.3 interface. So, I ran a quick test (following pg 57 of Dalgaard) in both the basic RGui and JGR interface (see below). I have re-installed R 2.2.1 and JGR 1.3 but had no luck so far figuring this out? Anyone have a suggestion? Or did I just make a mistake somewhere (which is more than likely). Thanks, Bret TX AM Output from RGui: x-rnorm(50) x [1] -1.016219752 0.940801964 0.168647573 0.328696253 -0.600957761 [6] -0.420394338 -1.140567123 -0.755041336 0.907831188 0.198247025 [11] -0.065116449 0.732841048 -0.400194138 -1.490167845 -1.488611328 [16] 0.311665408 -1.534002497 -1.094357124 -1.717282302 0.217445299 [21] -1.878605987 -0.214200092 -0.096099830 -0.357325121 -0.118191356 [26] -0.214543361 -0.399768989 0.235104678 -0.363194200 -0.275338828 [31] -0.336677033 -0.009178995 1.294139880 1.442454681 1.192023689 [36] -0.521847342 -1.070860356 -0.756584142 0.747503883 0.939960584 [41] -1.444890590 1.218499328 0.343071542 1.303250666 -0.603718755 [46] 0.979527031 -3.709878278 -0.051090815 -0.452191654 -0.206564681 mean(x) [1] -0.226039 sd(x) [1] 0.9917835 var(x) [1] 0.9836345 Output from JGR: x-rnorm(50) x [1] 0.79961648 -0.72223557 -0.10589876 [4] -0.25367834 -0.53518039 0.18296671 [7] 0.33981503 0.29208966 1.15002574 [10] 0.84356083 -0.87841050 0.31345819 [13] 0.61348608 1.13257372 -0.14366714 [16] -1.28563266 1.39519683 -0.85124979 [19] -1.65043342 0.93956978 1.36692691 [22] 0.81240164 -0.44326482 0.20741846 [25] 0.38536713 -0.57994109 1.10457148 [28] -0.99307813 -2.31580515 -1.61582072 [31] 1.63273805 -1.49289425 -1.33675463 [34] -1.17789478 -0.42209334 -0.21208394 [37] -2.21572873 0.35724725 -0.24758106 [40] 0.60470892 1.71646244 1.02161560 [43] 2.93773901 -0.92356017 -0.38588476 [46] -0.08622336 -0.09622387 -0.91419002 [49] 0.93453732 -0.25280526 mean(x) [1] -0.02108243 sd(x) [1] 1.077132 var(x) Error in get(x, envir, mode, inherits) : variable var was not found version platform i386-pc-mingw32 arch i386 os mingw32 system i386, mingw32 status major2 minor2.1 year 2005 month12 day 20 svn rev 36812 language R __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html -- 黄荣贵 Deparment of Sociology Fudan University __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] subset a matrix
Dear friends, I have a (20*30) matrix,and want to get a subset of it like the following: The original matrix: rows:1,2,3,20; columns:1,2,3,30 I want to get my subset of The original matrix and delete others: rows:1,3,5,7,...19; columns:1,3,5.29 -- Kind Regards,Zhi Jie,Zhang ,PHDDepartment of EpidemiologySchool of Public HealthFudan UniversityTel:86-21-54237149 [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] subset a matrix
Assuming that you want odd-numbered rows/cols, the seq() function is handy, as in: mat - matrix(1:(20*30), nr = 20) mat1 - mat[seq(1, 19, by = 2), seq(1, 29, by = 2)] Peter Ehlers zhijie zhang wrote: Dear friends, I have a (20*30) matrix,and want to get a subset of it like the following: The original matrix: rows:1,2,3,20; columns:1,2,3,30 I want to get my subset of The original matrix and delete others: rows:1,3,5,7,...19; columns:1,3,5.29 -- Kind Regards,Zhi Jie,Zhang ,PHDDepartment of EpidemiologySchool of Public HealthFudan UniversityTel:86-21-54237149 [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] subset a matrix
x=matrix(rnorm(20*30),20) y=x[seq(1,20,by=2),seq(1,30,by=2)] 2006/4/12, zhijie zhang [EMAIL PROTECTED]: Dear friends, I have a (20*30) matrix,and want to get a subset of it like the following: The original matrix: rows:1,2,3,20; columns:1,2,3,30 I want to get my subset of The original matrix and delete others: rows:1,3,5,7,...19; columns:1,3,5.29 -- Kind Regards,Zhi Jie,Zhang ,PHDDepartment of EpidemiologySchool of Public HealthFudan UniversityTel:86-21-54237149 [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html -- 黄荣贵 Deparment of Sociology Fudan University __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] S4 method dispatch matrixOrArray
I have some code where the primary dispatching is on other parameters so I'd like not to have to create a set of functions for matrix and another duplicate set for array. But the class union technique isn't working as implemented below and I don't have my Green book with me. How do I fix my infinite recursion problem? ## library(methods) setGeneric(foo, function(A, ...) { cat(generic, match.call()[[1]], \n) standardGeneric(foo) }) setMethod(foo, signature(A = vector), function(A, ...) { callGeneric(matrix(A, nrow = 1), ...) }) setClassUnion(matrixOrArray, c(matrix, array)) setMethod(foo, signature(A = matrixOrArray), function(A, ...) { cat(A =, A, \n) }) ## Test foo(1:4) foo(matrix(1:4, 1, 4)) foo(array(1:4, c(1, 4, 1))) -- SIGSIG -- signature too long (core dumped) __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] memory limit on windows 64 edition
Hi everyone, Does anyone know if the 2Gb limit for R processes in windows is still present using a 64 bit edition of windows? From what I read, compiling a 64bit version of R on windows isn't possible yet, but that limitation was more OS-related. We have large datasets which generally use over 2Gb of memory with Linux, and it would make our life easier if the windows-users would be able to run those on their own computers. Francois ps, I'm not on r-help, so please include my address in the reply. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] how to interpret the results of a simint call
Hi all, I've done some anovas, found some significance and proceeded to do the post hoc tests to determine the source of the significance. I used the multcmp package as suggested by Andy Liaw (thank you). I am, however, unsure how to interpret the results of the call to simint. Could someone help me with this? I've attached the code and the results it produced. There are 3 groups (ctrl,long,short) and I'm trying to see if the data in the Mean_12 column (in the example below) differs based on group membership. for (meanCol in meanColumns) { roi.err.aov-aov(eval(parse(text=meanCol)) ~ Group, data=roi.errs); HSD.err-simint(eval(parse(text=meanCol)) ~ Group, data=roi.errs, type=Tukey); cat(\n); cat(### Summary of AOV for , meanCol, cluster: , i, \n); print(summary(roi.err.aov)) print(summary(HSD.err)) i-i+1; } ### Summary of AOV for Mean_12 cluster: 12 Df Sum Sq Mean Sq F value Pr(F) Group2 6368494 3184247 8.8536 0.001627 ** Residuals 21 7552730 359654 --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Simultaneous 95% confidence intervals: Tukey contrasts Call: simint.formula(formula = eval(parse(text = meanCol)) ~ Group, data = roi.stops, type = Tukey) Tukey contrasts for factor Group Contrast matrix: Groupctrl Grouplong Groupshort Grouplong-Groupctrl 0-1 1 0 Groupshort-Groupctrl 0-1 0 1 Groupshort-Grouplong 0 0-1 1 Absolute Error Tolerance: 0.001 95 % quantile: 2.519 Coefficients: Estimate2.5 % 97.5 % t value Std.Err. p raw p Bonf Grouplong-Groupctrl -134.246 -930.286 661.794 -0.425 316.076 0.675 1.000 Groupshort-Groupctrl 978.056 182.016 1774.097 3.094 316.076 0.005 0.016 Groupshort-Grouplong 1112.303 400.303 1824.303 3.934 282.707 0.001 0.002 p adj Grouplong-Groupctrl 0.906 Groupshort-Groupctrl 0.015 Groupshort-Grouplong 0.002 Thanks in advance, Regards, Colm. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] unable to open connection
Dear R users I am having a problem unable to open connection and don't know why. using debian testing, R Version 2.2.1 [EMAIL PROTECTED]:~/R$ ls -l -rwxr-xr-x 1 fred fred 11599 2006-04-13 02:12 r.R getwd() [1] /home/fred/R source(r.R) Error in file(file, r) : unable to open connection In addition: Warning message: cannot open file 'data/pathtofile/041006', reason 'No such file or directory' thank you __ [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] Lattice, panel.grid and groups
Hello, Given the following plot, which shows following data: a - c(8.976000, 8.976000, 8.856000, 8.856000, 8.756000, 8.756000, 8.771000, 8.751000, 8.856000, 8.856000, 16.812000, 16.80, 8.845000, 9.032000, 8.706000, 9.636000, 9.032000, 16.802000, 8.726000, 8.779000, 8.779000, 8.856000, 8.856000, 8.534000, 8.534000, 8.764000, 8.646000, 8.856000, 8.856000, 13.081000, 10.76, 8.60, 8.627000, 8.543000, 8.762000, 8.627000, 10.146000, 8.547000, 8.518000, 8.518000, 8.856000, 8.856000, 8.454000, 8.454000, 8.499000, 8.488000, 8.856000, 8.856000, 11.567000, 10.772000, 8.506000, 8.395000, 8.426000, 8.582000, 8.395000, 10.144000, 8.407000 ,11.801051, 11.055339, 9.708079, 9.175891, 11.216250, 10.219728, 10.075000, 7.859582, 11.470972, 9.162232, 10.395510, 10.886422, 11.201043, 11.316806, 9.806960) dat - data.frame(number=rep(2:9,1,each=9), algo=rep(c(one,two,three),8,each=3), distance=rep(c(d1,d2,d3),24), value=a) print(xyplot( value ~ number | algo , data=dat, groups=distance, type=l, auto.key = list(space = top, points = FALSE, lines = TRUE, cex=1.4), layout=c(length(unique(c(dat$algo)))+1,1), ylab=value, xlab=number, scales = list(cex=1.2) )) # I will add some grid lines (ablines) to this plot. To add such lines, I must add a panel.grid as argument in the xyplot function and also panel.xyplot function. The following code visualise this, but now the lines are not allocated in the right way. I have played around with the panel.groups argument of panel.superpose, but without success. print(xyplot( value ~ number | algo , data=dat, groups=distance, type=l, auto.key = list(space = top, points = FALSE, lines = TRUE, cex=1.4), layout=c(length(unique(c(dat$algo)))+1,1), panel = function(x, y) { panel.grid(h=-1, v=-1) panel.xyplot(x, y, type=l) panel.superpose(x,y,groups=dat[,distance],subscripts=1:dim(dat)[1],pan el.groups=panel.xyplot, cex=0.7,fontfamily=sans) }, ylab=value, xlab=number, scales = list(cex=1.2) )) Can anybody give me a hint, please? Best regards, Matthias __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Lattice, panel.grid and groups
On 4/12/06, TEMPL Matthias [EMAIL PROTECTED] wrote: Hello, Given the following plot, which shows following data: a - c(8.976000, 8.976000, 8.856000, 8.856000, 8.756000, 8.756000, 8.771000, 8.751000, 8.856000, 8.856000, 16.812000, 16.80, 8.845000, 9.032000, 8.706000, 9.636000, 9.032000, 16.802000, 8.726000, 8.779000, 8.779000, 8.856000, 8.856000, 8.534000, 8.534000, 8.764000, 8.646000, 8.856000, 8.856000, 13.081000, 10.76, 8.60, 8.627000, 8.543000, 8.762000, 8.627000, 10.146000, 8.547000, 8.518000, 8.518000, 8.856000, 8.856000, 8.454000, 8.454000, 8.499000, 8.488000, 8.856000, 8.856000, 11.567000, 10.772000, 8.506000, 8.395000, 8.426000, 8.582000, 8.395000, 10.144000, 8.407000 ,11.801051, 11.055339, 9.708079, 9.175891, 11.216250, 10.219728, 10.075000, 7.859582, 11.470972, 9.162232, 10.395510, 10.886422, 11.201043, 11.316806, 9.806960) dat - data.frame(number=rep(2:9,1,each=9), algo=rep(c(one,two,three),8,each=3), distance=rep(c(d1,d2,d3),24), value=a) print(xyplot( value ~ number | algo , data=dat, groups=distance, type=l, auto.key = list(space = top, points = FALSE, lines = TRUE, cex=1.4), layout=c(length(unique(c(dat$algo)))+1,1), ylab=value, xlab=number, scales = list(cex=1.2) )) # I will add some grid lines (ablines) to this plot. To add such lines, I must add a panel.grid as argument in the xyplot function and also panel.xyplot function. The following code visualise this, but now the lines are not allocated in the right way. I have played around with the panel.groups argument of panel.superpose, but without success. Does type = c(g, l) do what you want? (It may not if your lattice is old, but you haven't told us your version.) Deepayan __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Lattice, panel.grid and groups
Yes, now it works perfect. Sorry, I was really blind for a couple of hours. Thank you! Matthias On 4/12/06, TEMPL Matthias [EMAIL PROTECTED] wrote: Hello, Given the following plot, which shows following data: a - c(8.976000, 8.976000, 8.856000, 8.856000, 8.756000, 8.756000, 8.771000, 8.751000, 8.856000, 8.856000, 16.812000, 16.80, 8.845000, 9.032000, 8.706000, 9.636000, 9.032000, 16.802000, 8.726000, 8.779000, 8.779000, 8.856000, 8.856000, 8.534000, 8.534000, 8.764000, 8.646000, 8.856000, 8.856000, 13.081000, 10.76, 8.60, 8.627000, 8.543000, 8.762000, 8.627000, 10.146000, 8.547000, 8.518000, 8.518000, 8.856000, 8.856000, 8.454000, 8.454000, 8.499000, 8.488000, 8.856000, 8.856000, 11.567000, 10.772000, 8.506000, 8.395000, 8.426000, 8.582000, 8.395000, 10.144000, 8.407000 ,11.801051, 11.055339, 9.708079, 9.175891, 11.216250, 10.219728, 10.075000, 7.859582, 11.470972, 9.162232, 10.395510, 10.886422, 11.201043, 11.316806, 9.806960) dat - data.frame(number=rep(2:9,1,each=9), algo=rep(c(one,two,three),8,each=3), distance=rep(c(d1,d2,d3),24), value=a) print(xyplot( value ~ number | algo , data=dat, groups=distance, type=l, auto.key = list(space = top, points = FALSE, lines = TRUE, cex=1.4), layout=c(length(unique(c(dat$algo)))+1,1), ylab=value, xlab=number, scales = list(cex=1.2) )) # I will add some grid lines (ablines) to this plot. To add such lines, I must add a panel.grid as argument in the xyplot function and also panel.xyplot function. The following code visualise this, but now the lines are not allocated in the right way. I have played around with the panel.groups argument of panel.superpose, but without success. Does type = c(g, l) do what you want? (It may not if your lattice is old, but you haven't told us your version.) Deepayan __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] S4 method dispatch matrixOrArray
I think its good enough to just define an array method, i.e. you don't need the matrix method or the matrixOrArray class, and the vector method can call foo(matrix(A,1), ...) so: setGeneric(foo, function(A, ...) { cat(generic, match.call()[[1]], \n) standardGeneric(foo) }) setMethod(foo, signature(A = array), function(A, ...) { cat(A =, A, \n) }) setMethod(foo, signature(A = vector), function(A, ...) { foo(matrix(A, nrow = 1), ...) }) ## Test foo(1:4) foo(matrix(1:4, 1, 4)) foo(array(1:4, c(1, 4, 1))) On 4/12/06, Paul Roebuck [EMAIL PROTECTED] wrote: I have some code where the primary dispatching is on other parameters so I'd like not to have to create a set of functions for matrix and another duplicate set for array. But the class union technique isn't working as implemented below and I don't have my Green book with me. How do I fix my infinite recursion problem? ## library(methods) setGeneric(foo, function(A, ...) { cat(generic, match.call()[[1]], \n) standardGeneric(foo) }) setMethod(foo, signature(A = vector), function(A, ...) { callGeneric(matrix(A, nrow = 1), ...) }) setClassUnion(matrixOrArray, c(matrix, array)) setMethod(foo, signature(A = matrixOrArray), function(A, ...) { cat(A =, A, \n) }) ## Test foo(1:4) foo(matrix(1:4, 1, 4)) foo(array(1:4, c(1, 4, 1))) -- SIGSIG -- signature too long (core dumped) __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] logistic regression model with non-integer weights
At 17:12 09/04/06, Ramón Casero Cañas wrote: I have not seen a reply to this so far apologies if I missed something. When fitting a logistic regression model using weights I get the following warning data.model.w - glm(ABN ~ TR, family=binomial(logit), weights=WEIGHT) Warning message: non-integer #successes in a binomial glm! in: eval(expr, envir, enclos) Details follow *** I have a binary dependent variable of abnormality ABN = T, F, T, T, F, F, F... and a continous predictor TR = 1.962752 1.871123 1.893543 1.685001 2.121500, ... As the number of abnormal cases (ABN==T) is only 14%, and there is large overlapping between abnormal and normal cases, the logistic regression found by glm is always much closer to the normal cases than for the abnormal cases. In particular, the probability of abnormal is at most 0.4. Coefficients: Estimate Std. Error z value Pr(|z|) (Intercept) 0.7607 0.7196 1.057 0.2905 TR2 -1.4853 0.4328 -3.432 0.0006 *** --- I would like to compensate for the fact that the a priori probability of abnormal cases is so low. I have created a weight vector I am not sure what the problem you really want to solve is but it seems that a) abnormality is rare b) the logistic regression predicts it to be rare. If you want a prediction system why not try different cut-offs (other than 0.5 on the probability scale) and perhaps plot sensitivity and specificity to help to choose a cut-off? WEIGHT - ABN WEIGHT[ ABN == TRUE ] - 1 / na / 2 WEIGHT[ ABN == FALSE ] - 1 / nn / 2 so that all weights add up to 1, where ``na'' is the number of abnormal cases, and ``nn'' is the number of normal cases. That is, normal cases have less weight in the model fitting because there are so many. But then I get the warning message at the beginning of this email, and I suspect that I'm doing something wrong. Must weights be integers, or at least greater than one? Regards, -- Ramón Casero Cañas http://www.robots.ox.ac.uk/~rcasero/wiki http://www.robots.ox.ac.uk/~rcasero/blog Michael Dewey http://www.aghmed.fsnet.co.uk __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] using GDD fonts
Hi I was searching for some X replacement for my job in R and i found the GDD I installed it and I match all the system requirements. My problem (maybe a dumb one) is that every plot comes with no font and i cant find a simgle example of a plot WITH FONT DETAIL in the list can anybody help me? a simple example: library(GDD) GDD(something.png, type=png, width = 700, height = 500) par(cex.axis=0.65,lab=c(12,12,0),mar=c(2.5, 2.5, 2.5, 2.5)) plot(rnorm(100)) mtext(Something,side=3,padj=-0.33,cex=1) dev.off() thanks in advance! -- Luiz Rodrigo Lins Tozzi [EMAIL PROTECTED] (21)91318150 http://luizrodrigotozzi.multiply.com/ http://www.flogao.com.br/luizrodrigotozzi __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] Solution: Making RNetCDF work on Fedora Linux
Dear R users who might like to use the package RNetCDF on Fedora Linux: Fedora (versions 4 and 5) users might have noticed that the default install of the netcdf and netcdf-devel packages from the Fedora Extra archive is inconsistent with the R package RNetCDF. The attempt to install RNetCDF results in a failure in the configure stage because the header library info for netcdf cannot be found. In here, http://pj.freefaculty.org/software/PolsFC5Updates/ I just deposited an updated set of RPMS for netcdf version 3.6.1. You need the netcdf and netcdf-devel packages in order to install the RNetCDF package inside R. You don't need debuginfo, unless you are trying to use the GNU debugger to find bugs in netcdf itself. The problem installing RNetCDF was caused by the Fedora-Extras package maintainer's use of the install directory /usr/include/netcdf-3 rather than /usr/include. I had several very productive emails with RNetCDF's packager Pavel Michna michna at giub.unibe.ch and after a while, I concluded that the Fedora-Extras packaging is just wrong, and there's no point in trying to hack RNetCDF to work around it. So I removed the unusual packaging. While I was in the repackaging mood, I built the RPMS for the netcdf version 3.6.1, one notch newer than Fedora-extra currently offers. If you install these instead of the netcdf that Fedora extras provides, then it will work fine to do the RNetCDF install. Ordinarily, you would face the trouble that the automatic updates for Fedora (via yum) might obliterate the netcdf that I give you. You could exclude netcdf in your global yum settings, but in this case you might not have to worry. The package version I give is 3.6.1, whereas the Extras has only 3.6.0, and I gave the package release number 10. So until the extras folk get up to 3.6.1 and release 10, I think your yum updates will leave this one alone. Of course, if they package up 3.6.2, which is supposed to be released soon, then you will be in trouble. I've posted the SPEC file and SRPM file in case you want to build your own RPMS. Its fun! -- Paul E. Johnson email: [EMAIL PROTECTED] Dept. of Political Sciencehttp://lark.cc.ku.edu/~pauljohn 1541 Lilac Lane, Rm 504 University of Kansas Office: (785) 864-9086 Lawrence, Kansas 66044-3177 FAX: (785) 864-5700 __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] unable to open connection
On 4/12/2006 12:40 PM, Fred J. wrote: Dear R users I am having a problem unable to open connection and don't know why. using debian testing, R Version 2.2.1 [EMAIL PROTECTED]:~/R$ ls -l -rwxr-xr-x 1 fred fred 11599 2006-04-13 02:12 r.R getwd() [1] /home/fred/R source(r.R) Error in file(file, r) : unable to open connection In addition: Warning message: cannot open file 'data/pathtofile/041006', reason 'No such file or directory' Does /home/fred/R/data/pathtofile/041006 exist, and do you have read permission on it? It doesn't look like it, from the ls above. Duncan Murdoch __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] S4 method dispatch matrixOrArray
On Wed, 12 Apr 2006, Gabor Grothendieck wrote: On 4/12/06, Paul Roebuck [EMAIL PROTECTED] wrote: I have some code where the primary dispatching is on other parameters so I'd like not to have to create a set of functions for matrix and another duplicate set for array. But the class union technique isn't working as implemented below and I don't have my Green book with me. How do I fix my infinite recursion problem? ## library(methods) setGeneric(foo, function(A, ...) { cat(generic, match.call()[[1]], \n) standardGeneric(foo) }) setMethod(foo, signature(A = vector), function(A, ...) { callGeneric(matrix(A, nrow = 1), ...) }) setClassUnion(matrixOrArray, c(matrix, array)) setMethod(foo, signature(A = matrixOrArray), function(A, ...) { cat(A =, A, \n) }) ## Test foo(1:4) foo(matrix(1:4, 1, 4)) foo(array(1:4, c(1, 4, 1))) I think its good enough to just define an array method, i.e. you don't need the matrix method or the matrixOrArray class, and the vector method can call foo(matrix(A,1), ...) so: setGeneric(foo, function(A, ...) { cat(generic, match.call()[[1]], \n) standardGeneric(foo) }) setMethod(foo, signature(A = array), function(A, ...) { cat(A =, A, \n) }) setMethod(foo, signature(A = vector), function(A, ...) { foo(matrix(A, nrow = 1), ...) }) Something didn't seem right here. That was pretty close to what I had started with, before trying to go the classUnion route. Matter of fact, the vector method can retain use of callGeneric. The solution has to do with the order in which calls to setMethod are made. Adding foo-vector after foo-array works fine; the other way around causes infinite recursion. -- SIGSIG -- signature too long (core dumped) __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] [Q] Bayeisan Network with the deal package
Dear R-users I am looking for a help in using the deal package. I followed the manual and paper from the author's web site to learn it, as shown below, but I could not figure out how to access the local and posterior probability of the nodes in the constructed network. library(deal) data(ksl) ksl.nw - network(ksl) ksl.prior - jointprior(ksl.nw) banlist - matrix(c(5,5,6,6,7,7,9, 8,9,8,9,8,9,8), ncol = 2) ksl.nw$banlist - banlist ksl.nw - learn(ksl.nw, ksl, ksl.prior)$nw According to the manual, the local prior and posterior can be accessed for each node using localprior() and localposterior(). However, I got null from localprior(ksl.nw$nodes[1]) and localposterior(ksl.nw$nodes[1]). Can anyone tell me what I should do to access the local prior and posterior? Any help would be appreciated. Thanks in advance. Young-Jin [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] using GDD fonts
Luiz Rodrigo Tozzi wrote: Hi I was searching for some X replacement for my job in R and i found the GDD I installed it and I match all the system requirements. My problem (maybe a dumb one) is that every plot comes with no font and i cant find a simgle example of a plot WITH FONT DETAIL in the list can anybody help me? a simple example: library(GDD) GDD(something.png, type=png, width = 700, height = 500) par(cex.axis=0.65,lab=c(12,12,0),mar=c(2.5, 2.5, 2.5, 2.5)) plot(rnorm(100)) mtext(Something,side=3,padj=-0.33,cex=1) dev.off() thanks in advance! This might help - we found that we needed to install the MS TT fonts and make sure that GDD can find them, as per the README. : Simon Urbanek [EMAIL PROTECTED] wrote: Tim, On Jun 9, 2005, at 3:51 AM, Tim CHURCHES wrote: I tried GDD 0.1-7 with Lattice graphs in R 2.1.0 (on Linux). It doesn't segfault now but it is still not producing any usable output - the output png file is produced but nly with a few lines on it. Still the alpha channel problem? Have you been able to produce any Lattice graphs with it? I know of no such problem, I tested a few lattice graphics and they worked. Can you, please, send me reproducible example and your output? Also send me, please output of library(GDD) .Call(gdd_look_up_font, NULL) Sorry, my laziness. GDD was unable to find any fonts. After I installed the MS TT fonts and set their location as per the GDD README, it worked perfectly with both old-style R graphics and lattice graphics. The output looks very nice indeed. We'll do a bit more testing (and let you know if we find any problems), but it looks like we can at last drop the requirement for Xvfb when using R in a Web application. Great work! From our point of view, GDD solves one the biggest problem with R for Web applications. Cheers, Tim C __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] help on ARIMA
Pradeep Gunda wrote: I am using R for prediction. I want to use VARIMA. I could not not find any package which would provide multivariate ARIMA that is VARIMA. I looked at the list of CRAN packages and found DSE package and also fracdiff package but they do not contain VARIMA modeling function. DSE had only VAR models but not VARIMA. Not true. The ARMA models in dse are multivariate, they are just not called VARIMA. Could anybody inform me the package and funcitons I need not use. Thanks, Pradeep __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html La version française suit le texte anglais. This email may contain privileged and/or confidential inform...{{dropped}} __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] ARS
Hello everyone. I would like to know if there is any R library to perform adaptive rejection sampling. Thanks in advance. *** Antonio Paredes USDA- Center for Veterinary Biologics Biometrics Unit 510 South 17th Street, Suite 104 Ames, IA 50010 (515) 232-5785 [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] Newbie question: setting rgl.surface plot attributes
I don't seem to be able to label the x, y or z axis when creating a 3d chart using rgl.surface. I'd like to have them parallel to the axis line and move with the graph when rotated. Can this be done? Many thanks, J. Retzer [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] extremely simple for loop question
I am sorry to ask such a simple question, but my knowledge of programming language is extremely limited, and I couldn't find the answer in any of the normal resources. I want to do a for loop in which m takes on the values 1, 5, 10, 15, 20. What is the syntax for doing that? I had been doing a loop for m in 1:20, but I only want those values above. Thanks, Brian __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] extremely simple for loop question
On Wed, 12 Apr 2006, Brian Quinif wrote: I want to do a for loop in which m takes on the values 1, 5, 10, 15, 20. What is the syntax for doing that? I had been doing a loop for m in 1:20, but I only want those values above. ?seq -- SIGSIG -- signature too long (core dumped) __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] ARS
In package HI there is a function to perform arms (adaptive rejection Metropolis sampling). Giovanni Date: Wed, 12 Apr 2006 15:49:18 -0500 From: [EMAIL PROTECTED] Sender: [EMAIL PROTECTED] Precedence: list Hello everyone. I would like to know if there is any R library to perform adaptive rejection sampling. Thanks in advance. *** Antonio Paredes USDA- Center for Veterinary Biologics Biometrics Unit 510 South 17th Street, Suite 104 Ames, IA 50010 (515) 232-5785 [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] Pipe delimiter ( | ) in read.delim
Hi R folks, Can anyone tell me how to read in a pipe (|) delimited text file? I've tried the following: read.delim(c:/junk/junk.txt,sep=|, skip=7, check.names=FALSE,quote = , header=F) The file looks something like the following: RD|I|04|013|9997|68103|5|7|017|830|2221|00:00|12.6||6| RD|I|04|013|9997|68103|5|7|017|830|2227|00:00|4.1||6| RD|I|04|013|9997|68103|5|7|017|830|2304|00:00|8.7||6| RD|I|04|013|9997|68103|5|7|017|830|2310|00:00|9.3||6| RC|I|04|013|9997|68103|5|7|017|830|2316|00:00|17.0||6| While I'm at it, the S-PLUS import GUI has a FilterExpression that will limit what it imports. So if I wanted to limit the data above to those records beginning with an RD the filter expression would be Col1= =\RD\ . Is there something similar to this in R? Thank you, Zev -- Zev Ross *ZevRoss Spatial Analysis* 303 Fairmount Ave Ithaca, NY 14850 (607) 277-0004 (phone) (866) 877-3690 (fax toll-free) [EMAIL PROTECTED] www.zevross.com __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Pipe delimiter ( | ) in read.delim
For the lines you posted this read them in successfully: read.table(clipboard, sep = |) To extract the RD lines you will need two passes: L - readLines(clipboard) L - grep(^RD, L, value = TRUE) read.table(textConnection(L), sep = |) or you can use read.table(pipe(...), sep = |) where ... is a suitable command depending on your OS, i.e. grep, awk/gawk or findstr but that won't be portable. On 4/12/06, Zev Ross [EMAIL PROTECTED] wrote: Hi R folks, Can anyone tell me how to read in a pipe (|) delimited text file? I've tried the following: read.delim(c:/junk/junk.txt,sep=|, skip=7, check.names=FALSE,quote = , header=F) The file looks something like the following: RD|I|04|013|9997|68103|5|7|017|830|2221|00:00|12.6||6| RD|I|04|013|9997|68103|5|7|017|830|2227|00:00|4.1||6| RD|I|04|013|9997|68103|5|7|017|830|2304|00:00|8.7||6| RD|I|04|013|9997|68103|5|7|017|830|2310|00:00|9.3||6| RC|I|04|013|9997|68103|5|7|017|830|2316|00:00|17.0||6| While I'm at it, the S-PLUS import GUI has a FilterExpression that will limit what it imports. So if I wanted to limit the data above to those records beginning with an RD the filter expression would be Col1= =\RD\ . Is there something similar to this in R? Thank you, Zev -- Zev Ross *ZevRoss Spatial Analysis* 303 Fairmount Ave Ithaca, NY 14850 (607) 277-0004 (phone) (866) 877-3690 (fax toll-free) [EMAIL PROTECTED] www.zevross.com __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] unable to open connection
Duncan what does the permission needs to look like in your opinion? the way it is now, on both the data file and the R batch file r.R seem to have all the read permission there is, for the user, group and others, unless you wanted to say write permission for group and others which are the only lacking from what I see from -rwxr-xr-x Duncan Murdoch [EMAIL PROTECTED] wrote: On 4/12/2006 12:40 PM, Fred J. wrote: Dear R users I am having a problem unable to open connection and don't know why. using debian testing, R Version 2.2.1 [EMAIL PROTECTED]:~/R$ ls -l -rwxr-xr-x 1 fred fred 11599 2006-04-13 02:12 r.R getwd() [1] /home/fred/R source(r.R) Error in file(file, r) : unable to open connection In addition: Warning message: cannot open file 'data/pathtofile/041006', reason 'No such file or directory' Does /home/fred/R/data/pathtofile/041006 exist, and do you have read permission on it? It doesn't look like it, from the ls above. Duncan Murdoch - [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] unable to open connection
Fred J. wrote: Duncan what does the permission needs to look like in your opinion? the way it is now, on both the data file and the R batch file r.R seem to have all the read permission there is, for the user, group and others, unless you wanted to say write permission for group and others which are the only lacking from what I see from -rwxr-xr-x I don't think there is any problem with r.R. The problem appears to be in one of the commands that is contained in it, where it tries to open data/pathtofile/041006 but that file does not appear to exist. My guess is that the data directory lies below your home directory, but your working directory is /home/fred/R so it is looking for it in the wrong place. Duncan Murdoch Duncan Murdoch [EMAIL PROTECTED] wrote: On 4/12/2006 12:40 PM, Fred J. wrote: Dear R users I am having a problem unable to open connection and don't know why. using debian testing, R Version 2.2.1 [EMAIL PROTECTED]:~/R$ ls -l -rwxr-xr-x 1 fred fred 11599 2006-04-13 02:12 r.R getwd() [1] /home/fred/R source(r.R) Error in file(file, r) : unable to open connection In addition: Warning message: cannot open file 'data/pathtofile/041006', reason 'No such file or directory' Does /home/fred/R/data/pathtofile/041006 exist, and do you have read permission on it? It doesn't look like it, from the ls above. Duncan Murdoch - Blab-away for as little as 1¢/min. Make PC-to-Phone Calls using Yahoo! Messenger with Voice. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] question about source package
Hi, Just a silly question about R source package: I downloaded some source package of R and found there are some source codes written in C, is this true for all the R packages? but it seems that not all the functions described in the package are contained in the source package written in C. Could anybody explain to me the structure of the source package and how it is created? Thanks. James - [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Newbie question: setting rgl.surface plot attributes
Joseph Retzer wrote: I don't seem to be able to label the x, y or z axis when creating a 3d chart using rgl.surface. I'd like to have them parallel to the axis line and move with the graph when rotated. Can this be done? rgl.surface is a low level function for drawing a surface. It's more like the lines() or points() functions in standard R graphics than like persp(). With the current release of rgl, you can get scales using the rgl.bbox function, but you'll need to manually label the axes yourself. However, this situation will change soon. I've been adding a number of features to rgl, so there's now a persp3d() function in the unreleased version. I'm not sure when the release date will be, but hopefully not too far in the future. If you want to test an unreleased version, contact me off-list. Duncan Murdoch __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] extremely simple for loop question
On 4/12/06, Paul Roebuck [EMAIL PROTECTED] wrote: I want to do a for loop in which m takes on the values 1, 5, 10, 15, 20. What is the syntax for doing that? I had been doing a loop for m in 1:20, but I only want those values above. ?seq ... which doesn't handle the 1 in that sequence very elegantly. You can do this for (m in c(1, seq(5, 20, 5))) for the general case, but for the specific circumstance I'd do for (m in c(1, 5, 10, 15, 20)) -- Chris __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] S4 method dispatch matrixOrArray
This is surprising. I would have thought that the parent/child relationships determine the order that dispatched methods are invoked, not the order that the setMethod commands are issued in. On 4/12/06, Paul Roebuck [EMAIL PROTECTED] wrote: On Wed, 12 Apr 2006, Gabor Grothendieck wrote: On 4/12/06, Paul Roebuck [EMAIL PROTECTED] wrote: I have some code where the primary dispatching is on other parameters so I'd like not to have to create a set of functions for matrix and another duplicate set for array. But the class union technique isn't working as implemented below and I don't have my Green book with me. How do I fix my infinite recursion problem? ## library(methods) setGeneric(foo, function(A, ...) { cat(generic, match.call()[[1]], \n) standardGeneric(foo) }) setMethod(foo, signature(A = vector), function(A, ...) { callGeneric(matrix(A, nrow = 1), ...) }) setClassUnion(matrixOrArray, c(matrix, array)) setMethod(foo, signature(A = matrixOrArray), function(A, ...) { cat(A =, A, \n) }) ## Test foo(1:4) foo(matrix(1:4, 1, 4)) foo(array(1:4, c(1, 4, 1))) I think its good enough to just define an array method, i.e. you don't need the matrix method or the matrixOrArray class, and the vector method can call foo(matrix(A,1), ...) so: setGeneric(foo, function(A, ...) { cat(generic, match.call()[[1]], \n) standardGeneric(foo) }) setMethod(foo, signature(A = array), function(A, ...) { cat(A =, A, \n) }) setMethod(foo, signature(A = vector), function(A, ...) { foo(matrix(A, nrow = 1), ...) }) Something didn't seem right here. That was pretty close to what I had started with, before trying to go the classUnion route. Matter of fact, the vector method can retain use of callGeneric. The solution has to do with the order in which calls to setMethod are made. Adding foo-vector after foo-array works fine; the other way around causes infinite recursion. -- SIGSIG -- signature too long (core dumped) __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] latex-like array in Rd documents
Hi all. Is it possible to use something like latex array environments in Rd files? This is just for typesetting a formula of the type: something=a if TRUE, b if FALSE in two lines instead of one line. Any suggestion is wellcome. Antonio, Fabio Di Narzo. [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] question about source package
The minimum you need is to have a single file, DESCRIPTION, plus R and man directories/folders which contain your .R and .Rd files respectively. A package need not use C and I suspect most don't. On 4/12/06, James Anderson [EMAIL PROTECTED] wrote: Hi, Just a silly question about R source package: I downloaded some source package of R and found there are some source codes written in C, is this true for all the R packages? but it seems that not all the functions described in the package are contained in the source package written in C. Could anybody explain to me the structure of the source package and how it is created? Thanks. James - [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] S4 class slot names
Hi, Why doesn't this work? setClass(test,representation(names=character)) tmp - new(test) [EMAIL PROTECTED] - a Error in slot-(object, name, TRUE, value) : 'names' attribute [1] must be the same length as the vector [0] Why does this work (replace names with name)? setClass(test,representation(name=character)) tmp - new(test) [EMAIL PROTECTED] - a I looked at the help for setClass, representation, and slot and found no restriction on the slot names other than that they be any non-empty string, but if the name is not made up of letters, numbers, and '.', it needs to be quoted. Thanks, Steve [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] unable to open connection
aha, thank you, I added ../ or ~/ before the path and it fixed it. Duncan Murdoch [EMAIL PROTECTED] wrote: Fred J. wrote: Duncan what does the permission needs to look like in your opinion? the way it is now, on both the data file and the R batch file r.R seem to have all the read permission there is, for the user, group and others, unless you wanted to say write permission for group and others which are the only lacking from what I see from -rwxr-xr-x I don't think there is any problem with r.R. The problem appears to be in one of the commands that is contained in it, where it tries to open data/pathtofile/041006 but that file does not appear to exist. My guess is that the data directory lies below your home directory, but your working directory is /home/fred/R so it is looking for it in the wrong place. Duncan Murdoch Duncan Murdoch wrote: On 4/12/2006 12:40 PM, Fred J. wrote: Dear R users I am having a problem unable to open connection and don't know why. using debian testing, R Version 2.2.1 [EMAIL PROTECTED]:~/R$ ls -l -rwxr-xr-x 1 fred fred 11599 2006-04-13 02:12 r.R getwd() [1] /home/fred/R source(r.R) Error in file(file, r) : unable to open connection In addition: Warning message: cannot open file 'data/pathtofile/041006', reason 'No such file or directory' Does /home/fred/R/data/pathtofile/041006 exist, and do you have read permission on it? It doesn't look like it, from the ls above. Duncan Murdoch - - [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] question about source package
On Wed, 12 Apr 2006, James Anderson wrote: Hi, Just a silly question about R source package: I downloaded some source package of R and found there are some source codes written in C, is this true for all the R packages? but it seems that not all the functions described in the package are contained in the source package written in C. Could anybody explain to me the structure of the source package and how it is created? The package structure is described in the Writing R Extensions manual, and each package has a set of subdirectories. All packages should have a man/ subdirectory with help files and nearly all will have an R/ directory with R code. Many packages also have compiled code in C or Fortran, which will be in a src/ subdirectory. Other important directories are tests/, data/, and inst/doc/ (where vignettes live). One way to do some of the set-up automatically is with the package.skeleton function. -thomas Thomas Lumley Assoc. Professor, Biostatistics [EMAIL PROTECTED] University of Washington, Seattle __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] extremely simple for loop question
On Wed, 12 Apr 2006, Brian Quinif wrote: I am sorry to ask such a simple question, but my knowledge of programming language is extremely limited, and I couldn't find the answer in any of the normal resources. I want to do a for loop in which m takes on the values 1, 5, 10, 15, 20. What is the syntax for doing that? I had been doing a loop for m in 1:20, but I only want those values above. Thanks, Brian An easy one that doesn't need an answer from Gabor for (m in c(1,5,10,15,20)){ print(m) } or for (m in c(1,5*(1:4))){ print(m) } David Scott _ David Scott Department of Statistics, Tamaki Campus The University of Auckland, PB 92019 AucklandNEW ZEALAND Phone: +64 9 373 7599 ext 86830 Fax: +64 9 373 7000 Email: [EMAIL PROTECTED] Graduate Officer, Department of Statistics ASC/NZSA 2006: Statistical Connections The joint conference of the Statistical Society of Australia Inc. and the New Zealand Statistical Association, July 3--6, 2006 in Auckland. Go to: http://www.statsnz2006.com/ __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Reshaping genetic data from long to wide
Farrel Buchinsky [EMAIL PROTECTED] wrote: 2)Storing all the SNP data as a string seems quite clever and a space-saving way of doing it. However, if you were to analyze a whole chromosome at a time you would still be creating one almighty big table albeit only temporarily. Do you use R to run TDT analyses? If so, how are you setting up your data frames and then what commands do you issue to analyze what is in your dataframes? A lot of how I do this is tied to how we've set up our genotype database so it would be hard to describe briefly and probably not much use to you. I often work with larger data sets (i.e., 200K SNPs and 1000 individuals) where I really don't want to try to manipulate the entire data set in memory at once. Instead I'll analyze the data in chunks and store those results back into the database. I haven't specifically done TDT in R though I know there is code out there to do that. Currently I have my data such that I can access it from R through an ODBC connection to Microsoft Access which in turn has an ODBC connection to the Sybase database. Whether I go through strings or not, I still need to find a way that I can assemble it so that a program can systematically run a TDT analysis on all the loci. I can see how strings help me in my storing of the data but that is already a fait acomplis. Can you explain to me how it would help me with sequential analysis of each locus? Do you have any history files so that I can see what you were doing? I don't think a history file would be very helpful here since what I do is mostly buried in libraries that are dependent on our database system. Basically, I first build up a data frame of sample details, and a second data frame with SNP information that also contains a column of genotype strings. Then I do an lapply() on that genotype column, calling a function that unpacks the genotypes, appends them as a new column to the sample details table, and then scores that SNP. So something like: samples - load.sample.info() snps - load.snp.data() fn - function(str) { g - strsplit(str, )[[1]] g - factor(g, levels=1:3, labels=c(AA, AB, BB)) samples$genotype - g m1 - lm(height~age+gender*genotype, samples) m2 - lm(height~age+gender, samples) anova(m1,m2) } results - lapply(snps$genotypes, fn) (here I've coded the genotypes as a string like '121231012310' where 1..3 are genotypes AA, AB, BB and 0 is missing data, and if I actually cared about what nucleotides correspond to alleles 'A' and 'B', I would have columns for that in the SNP table) If you are doing haplotype analysis and need to manipulate data for multiple SNPs at once, then this would get more complicated, but I still think the string format is a convenient one, and is quicker to reshape into other formats than the long format. -- Dave __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] extremely simple for loop question
Thanks. The c(...) is what i was missing. BQ 2006/4/12, David Scott [EMAIL PROTECTED]: On Wed, 12 Apr 2006, Brian Quinif wrote: I am sorry to ask such a simple question, but my knowledge of programming language is extremely limited, and I couldn't find the answer in any of the normal resources. I want to do a for loop in which m takes on the values 1, 5, 10, 15, 20. What is the syntax for doing that? I had been doing a loop for m in 1:20, but I only want those values above. Thanks, Brian An easy one that doesn't need an answer from Gabor for (m in c(1,5,10,15,20)){ print(m) } or for (m in c(1,5*(1:4))){ print(m) } David Scott _ David Scott Department of Statistics, Tamaki Campus The University of Auckland, PB 92019 AucklandNEW ZEALAND Phone: +64 9 373 7599 ext 86830 Fax: +64 9 373 7000 Email: [EMAIL PROTECTED] Graduate Officer, Department of Statistics ASC/NZSA 2006: Statistical Connections The joint conference of the Statistical Society of Australia Inc. and the New Zealand Statistical Association, July 3--6, 2006 in Auckland. Go to: http://www.statsnz2006.com/ __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] using GDD fonts
Hi Tim, It really worked!! thanks! now my only problem is about the image size, that is huge! im using the type=png and switching to png8 does not reduce the color depth.. do you know something about is? 2006/4/12, Tim Churches [EMAIL PROTECTED]: Luiz Rodrigo Tozzi wrote: Hi I was searching for some X replacement for my job in R and i found the GDD I installed it and I match all the system requirements. My problem (maybe a dumb one) is that every plot comes with no font and i cant find a simgle example of a plot WITH FONT DETAIL in the list can anybody help me? a simple example: library(GDD) GDD(something.png, type=png, width = 700, height = 500) par(cex.axis=0.65,lab=c(12,12,0),mar=c(2.5, 2.5, 2.5, 2.5)) plot(rnorm(100)) mtext(Something,side=3,padj=-0.33,cex=1) dev.off() thanks in advance! This might help - we found that we needed to install the MS TT fonts and make sure that GDD can find them, as per the README. : Simon Urbanek [EMAIL PROTECTED] wrote: Tim, On Jun 9, 2005, at 3:51 AM, Tim CHURCHES wrote: I tried GDD 0.1-7 with Lattice graphs in R 2.1.0 (on Linux). It doesn't segfault now but it is still not producing any usable output - the output png file is produced but nly with a few lines on it. Still the alpha channel problem? Have you been able to produce any Lattice graphs with it? I know of no such problem, I tested a few lattice graphics and they worked. Can you, please, send me reproducible example and your output? Also send me, please output of library(GDD) .Call(gdd_look_up_font, NULL) Sorry, my laziness. GDD was unable to find any fonts. After I installed the MS TT fonts and set their location as per the GDD README, it worked perfectly with both old-style R graphics and lattice graphics. The output looks very nice indeed. We'll do a bit more testing (and let you know if we find any problems), but it looks like we can at last drop the requirement for Xvfb when using R in a Web application. Great work! From our point of view, GDD solves one the biggest problem with R for Web applications. Cheers, Tim C -- Luiz Rodrigo Lins Tozzi [EMAIL PROTECTED] (21)91318150 http://luizrodrigotozzi.multiply.com/ http://www.flogao.com.br/luizrodrigotozzi __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] about McNemar
Hello sir: How can I perform McNemar (paired chi square test) by using R? Thanks! -- *** Xin Meng Capitalbio Corporation National Engineering Research Center for Beijing Biochip Technology BioPharma-informatics Software Dept. Research Engineer Tel: +86-10-80715888/80726868-6438 Fax: +86-10-80726790 [EMAIL PROTECTED] Address:18 Life Science Parkway, Changping District, Beijing 102206, China __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] number of matches when using Match()
To anyone who uses the Match() function in the Matching library... How do you go about deciding how many matches you will use? With my data, my standard errors generally get smaller if I use more matches. Speaking of standard errors, when correcting for heteroscedasticity, how many matches do you use (this is the Var.cal option). It seems to me that it might make sense to use the same number of matches as above, but that's just a guess... One more question about Match()... I am calculating a number of SATT's that all have the same covariates (X's) and treatment variables (Tr's). I would like to take advantage of the matching that I do the first time to then quickly calculate the SATT for various different Y's? How can I do that? It would save serious computational time. In case I'm not explaining myself well, in the example below, I would like to calculate satt.Y2 without having to perform the matching all over again, since with more data, the process can be very slow. #make up some data X - matrix(rnorm(1000*5), ncol=5) Tr - c(rep(1,500),rep(0,500)) Y1 - as.vector(rnorm(1000)) Y2 - as.vector(rnorm(1000)) satt.Y1 - Match(Y=Y1, X=X1, Tr=Tr, M=1) satt.Y2 - Match(Y=Y2, X=X1, Tr=Tr, M=1) Thanks, BQ __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] about McNemar
Please consider using R's built-in help capabilities before posting a question. help.search(McNemar) RSiteSearch(McNemar) Regards Francisco From: XinMeng [EMAIL PROTECTED] Reply-To: XinMeng [EMAIL PROTECTED] To: r-help@stat.math.ethz.ch Subject: [R] about McNemar Date: Thu, 13 Apr 2006 10:50:26 +0800 Hello sir: How can I perform McNemar (paired chi square test) by using R? Thanks! -- *** Xin Meng Capitalbio Corporation National Engineering Research Center for Beijing Biochip Technology BioPharma-informatics Software Dept. Research Engineer Tel: +86-10-80715888/80726868-6438 Fax: +86-10-80726790 [EMAIL PROTECTED] Address:18 Life Science Parkway, Changping District, Beijing 102206, China __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] using GDD fonts
Luiz Rodrigo Tozzi wrote: Hi Tim, It really worked!! thanks! now my only problem is about the image size, that is huge! im using the type=png and switching to png8 does not reduce the color depth.. do you know something about is? I've hacked around on the GDD code before. From what I remember, all png files are created in true color. 2006/4/12, Tim Churches [EMAIL PROTECTED]: Luiz Rodrigo Tozzi wrote: Hi I was searching for some X replacement for my job in R and i found the GDD I installed it and I match all the system requirements. My problem (maybe a dumb one) is that every plot comes with no font and i cant find a simgle example of a plot WITH FONT DETAIL in the list can anybody help me? a simple example: library(GDD) GDD(something.png, type=png, width = 700, height = 500) par(cex.axis=0.65,lab=c(12,12,0),mar=c(2.5, 2.5, 2.5, 2.5)) plot(rnorm(100)) mtext(Something,side=3,padj=-0.33,cex=1) dev.off() thanks in advance! This might help - we found that we needed to install the MS TT fonts and make sure that GDD can find them, as per the README. : Simon Urbanek [EMAIL PROTECTED] wrote: Tim, On Jun 9, 2005, at 3:51 AM, Tim CHURCHES wrote: I tried GDD 0.1-7 with Lattice graphs in R 2.1.0 (on Linux). It doesn't segfault now but it is still not producing any usable output - the output png file is produced but nly with a few lines on it. Still the alpha channel problem? Have you been able to produce any Lattice graphs with it? I know of no such problem, I tested a few lattice graphics and they worked. Can you, please, send me reproducible example and your output? Also send me, please output of library(GDD) .Call(gdd_look_up_font, NULL) Sorry, my laziness. GDD was unable to find any fonts. After I installed the MS TT fonts and set their location as per the GDD README, it worked perfectly with both old-style R graphics and lattice graphics. The output looks very nice indeed. We'll do a bit more testing (and let you know if we find any problems), but it looks like we can at last drop the requirement for Xvfb when using R in a Web application. Great work! From our point of view, GDD solves one the biggest problem with R for Web applications. Cheers, Tim C -- Luiz Rodrigo Lins Tozzi [EMAIL PROTECTED] (21)91318150 http://luizrodrigotozzi.multiply.com/ http://www.flogao.com.br/luizrodrigotozzi __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html -- Jeffrey Horner Computer Systems Analyst School of Medicine 615-322-8606 Department of Biostatistics Vanderbilt University __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html