Re: [R] barplot x-axis problem

2007-01-26 Thread Lauri Nikkinen
Thank you very much, Marc! That was exactly the solution I was looking for! Regards, Lauri 2007/1/26, Marc Schwartz [EMAIL PROTECTED]: On Thu, 2007-01-25 at 22:23 +0200, Lauri Nikkinen wrote: Hi R-users, I'm new to R and I'm trying to make a barplot combined with two lines (refering

[R] replicating the odds ratio from a published study

2007-01-26 Thread Bob Green
I wanted to compare odds ratio across studies and tried to replicate the results from a study but have not been able to determine how to do this in R. The study reported a sample of 961 men, of whom 41 had a disorder. The reported raw odds ratio was 6.52 (4.70-9.00) I did a search of the

[R] Using functions within functions (environment problems)

2007-01-26 Thread Colin Beale
Hi everyone, I've been having difficulty writing wrapper functions for some functions where those same functions include other functions with eval() calls where the environment is specified. A very simple example using function lmer from lme4: lmerWrapper - function(formula, data, family =

Re: [R] %*% in Matrix objects

2007-01-26 Thread Martin Maechler
Jose == Jose Quesada [EMAIL PROTECTED] on Fri, 26 Jan 2007 05:24:12 +0100 writes: Jose Dear R users, Jose I need to normalize a bunch of row vectors. At a certain point I need to divide a matrix by a vector of norms. I find that the behavior of Matrix objects differs from normal

Re: [R] Using functions within functions (environment problems)

2007-01-26 Thread Gabor Grothendieck
Check out this post and the entire thread to which it belongs: http://finzi.psych.upenn.edu/R/Rhelp02a/archive/67474.html On 1/26/07, Colin Beale [EMAIL PROTECTED] wrote: Hi everyone, I've been having difficulty writing wrapper functions for some functions where those same functions include

[R] constrained simulated annealing

2007-01-26 Thread Mollet, Fabian
Hello! I try to fit a non linear model. It is a quite complex (4 parameters) biological model and therefore the optimization surface is probably very rough, i.e. there are several optima. The optimum being found by the algorithm depends thus on the starting values I feed in. I have seen the SANN

Re: [R] Using functions within functions (environment problems)

2007-01-26 Thread Prof Brian Ripley
I don't think your subject line is relevant. You do not have 'functions within functions': lmerFrames is not within lmer. (You seem to be confusing functions within and calls from.) Your example does not work (did you test it?). When the erroneous runif call is corrected (it gives a result

Re: [R] replicating the odds ratio from a published study

2007-01-26 Thread Michael Dewey
At 09:04 26/01/2007, Bob Green wrote: I wanted to compare odds ratio across studies and tried to replicate the results from a study but have not been able to determine how to do this in R. The study reported a sample of 961 men, of whom 41 had a disorder. The reported raw odds ratio was 6.52

[R] defining function into another function

2007-01-26 Thread domenico pestalozzi
If I define my function that includes others internal functions, how can I define the parameter's functions? That is: myfunc-function(y){... func.int1- function(x){ sum(x}} func.int2-function(z){funct.int1(z)^2} . } Is it possible to use func.int1 into

[R] Bayesian inference: Poisson distribution with normal (!) prior

2007-01-26 Thread Carsten Steinhoff
Hello, for a frequency modelling problem I want to combine expert knowledge with incoming real-life data (which is not available up to now). The frequency has to be modelled with a poisson distribution. The parameter lambda has to be normal distributed (for certain reasons we did not NOT choose

Re: [R] replicating the odds ratio from a published study

2007-01-26 Thread Peter Dalgaard
Michael Dewey wrote: At 09:04 26/01/2007, Bob Green wrote: I wanted to compare odds ratio across studies and tried to replicate the results from a study but have not been able to determine how to do this in R. The study reported a sample of 961 men, of whom 41 had a disorder. The

Re: [R] summary of the effects after logistic regression model

2007-01-26 Thread Frank E Harrell Jr
andrea evangelista wrote: Dear all, my aim is to estimate the efficacy over time of a treatment for headache prevention. Data consist of long sequences of repeated binary outcomes (1 if the subject has at least 1 episode of headache , 0 otherwise) on subjects randomized to placebo or

Re: [R] Bayesian inference: Poisson distribution with normal (!) prior

2007-01-26 Thread Vincent Goulet
Le Vendredi 26 Janvier 2007 08:56, Carsten Steinhoff a écrit : Hello, for a frequency modelling problem I want to combine expert knowledge with incoming real-life data (which is not available up to now). The frequency has to be modelled with a poisson distribution. The parameter lambda has to

Re: [R] unique/subset problem

2007-01-26 Thread lalitha viswanath
Hi The pruned dataset has 8 unique genomes in it while the dataset before pruning has 65 unique genomes in it. However calling unique on the pruned dataset seems to return 65 no matter what. Any assistance in this matter would be appreciated. Thanks Lalitha --- Weiwei Shi [EMAIL PROTECTED]

[R] Use a text variable's value to specify another varaible?

2007-01-26 Thread Ben Fairbank
Greetings guRus -- If a variable, e.g., 'varname', is a character string, e.g. varname - datavector, and I want to apply a function, such as table(), to datavector, what syntax or method will do so using only the variable varname? This seems similar to indirect addressing, but I have not seen

Re: [R] Use a text variable's value to specify another varaible?

2007-01-26 Thread Marc Schwartz
On Fri, 2007-01-26 at 09:48 -0600, Ben Fairbank wrote: Greetings guRus -- If a variable, e.g., 'varname', is a character string, e.g. varname - datavector, and I want to apply a function, such as table(), to datavector, what syntax or method will do so using only the variable varname? This

[R] how to create daily / weekly ts object?

2007-01-26 Thread Wensui Liu
Dear All, Monthly and Quarterly ts obj. is easy to understand. But I couldn't find an example in R manual how to create daily or weekly ts object. Could you please shed some light on it? I really appreciate it. __ R-help@stat.math.ethz.ch mailing list

[R] enumerates all possible combinations

2007-01-26 Thread ken knoblauch
does expand.grid do what you want? expand.grid(c(0, 1), c(0, 1), c(0, 1)) Var1 Var2 Var3 1000 2100 3010 4110 5001 6101 7011 8111 Hi all R users, I want to create a matrix having n columns and

[R] strange behaviour with equality after simple subtraction

2007-01-26 Thread martin sikora
hello, today while trying to extract data from a list for subsequent analysis, i stumbled upon this funny behavior on my system: x-c(0.1,0.9) 1-x[2] [1] 0.1 x[1] [1] 0.1 x[1]==1-x[2] [1] FALSE x[1]1-x[2] [1] TRUE x-c(0.3,0.7) x[1] [1] 0.3 x[2] [1] 0.7 1-x[2] [1]

Re: [R] unique/subset problem

2007-01-26 Thread Sarah Goslee
Without knowing more about your data, it is hard to say for certain, but might you be confusing unique _values_ with _factor levels_? mydata - as.factor(sort(rep(1:5, 2))) # mydata has 10 values, 5 unique values, and 5 factor levels mydata [1] 1 1 2 2 3 3 4 4 5 5 Levels: 1 2 3 4 5

[R] enumerates all possible combinations

2007-01-26 Thread Zhiliang Ma
Hi all R users, I want to create a matrix having n columns and 2^n rows, and all its entries are only 0 or 1. In each row, column i is 0 means dimension i is chosen, 0 means not. The matrix will contains all the possible combination of those n dimensions. Here is an example, if n = 3, the matrix

Re: [R] Use a text variable's value to specify another varaible?

2007-01-26 Thread Erik Iverson
Can I ask why you aren't just passing in the object to your function, but instead a text name for that object? Ben Fairbank wrote: Greetings guRus -- If a variable, e.g., 'varname', is a character string, e.g. varname - datavector, and I want to apply a function, such as table(), to

Re: [R] how to create daily / weekly ts object?

2007-01-26 Thread Gabor Grothendieck
If you want the dates to show up as such you are better off using a zooreg object with times of class Date from the zoo package. You can always use as.ts on it if you require a ts object. library(zoo) zd - zooreg(1:10, start = Sys.Date()) zd as.ts(zd) plot(zd) zw - zooreg(1:10, start =

Re: [R] strange behaviour with equality after simple subtraction

2007-01-26 Thread Mike Prager
martin sikora [EMAIL PROTECTED] wrote: today while trying to extract data from a list for subsequent analysis, i stumbled upon this funny behavior on my system: x-c(0.1,0.9) 1-x[2] [1] 0.1 x[1] [1] 0.1 x[1]==1-x[2] [1] FALSE x[1]1-x[2] [1] TRUE Not at all

[R] plotting results from tapply

2007-01-26 Thread Michael Rennie
Hi, there I'm trying to plot what is returned from a call to tapply, and can't figure out how to do it. My guess is that it has something to do with the inclusion of row names when you ask for the values you're interested in, but if anyone has any ideas on how to get it to work, that would be

Re: [R] enumerates all possible combinations

2007-01-26 Thread Zhiliang Ma
Thanks a lot! That's exactly what I need. On 1/26/07, ken knoblauch [EMAIL PROTECTED] wrote: does expand.grid do what you want? expand.grid(c(0, 1), c(0, 1), c(0, 1)) Var1 Var2 Var3 1000 2100 3010 4110 5001 6101

Re: [R] enumerates all possible combinations

2007-01-26 Thread Weiwei Shi
a little improvement on ken knoblauch's method by adding the variable n so, n - 3 expand.grid(lapply(1:n, function(i) (c(0,1 HTH, weiwei On 1/26/07, Zhiliang Ma [EMAIL PROTECTED] wrote: Hi all R users, I want to create a matrix having n columns and 2^n rows, and all its entries are

Re: [R] unique/subset problem

2007-01-26 Thread Weiwei Shi
Then you need to provide more details about the calls you made and your dataset. For example, you can tell us by str(prunedrelatives, 1) how did you call unique on prunedrelative and so on? I made a test data it gave me what you wanted (omitted here). On 1/26/07, lalitha viswanath [EMAIL

Re: [R] [BioC] problem with biomaRt getHomolog function

2007-01-26 Thread Kimpel, Mark William
Steffen, When the new biomaRt tries to load it errors out because I do not have RMySQL installed. There is not a Windows binary for RMySQL and it does contain C code that I do not know how to build. I do not use the MySQL option in biomaRt. Does RMySQL need to be a required dependency? Below is

Re: [R] strange behaviour with equality after simple subtraction

2007-01-26 Thread Benilton Carvalho
In addition to Mike's comment: x-c(0.1,0.9) 1-x[2] [1] 0.1 x[1]==1-x[2] [1] FALSE all.equal(x[1], 1-x[2]) [1] TRUE b On Jan 26, 2007, at 11:40 AM, Mike Prager wrote: Not at all strange, an expected property of floating-point arithmetic and one of the most frequently asked questions

[R] spss.get. Warning with SPSS 14 dataset

2007-01-26 Thread John Kane
I am using spss.get to import an SPSS database Data.sav, created with SPSS 14 : df1 - spss.get(C:/temp/Data.sav , lowernames=TRUE, datevars = c(dateinte)) I am getting this warning. I get the same warning with read.spss. Warning message: C:/temp/Data.sav: Unrecognized record type

[R] R crash with modified lmer code

2007-01-26 Thread Colin Beale
Hi all, I've now got a problem with some modified lmer code (function lmer1 pasted at end) - I've made only three changes to the lmer code (marked), and I'm not really looking for comments on this function, but would like to know why execution of the following commands that use it almost

Re: [R] strange behaviour with equality after simple subtraction

2007-01-26 Thread Bert Gunter
FAQ on R 7.31. ?all.equal ?identical Have you read these? Bert Gunter Genentech Nonclinical Statistics South San Francisco, CA 94404 -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Mike Prager Sent: Friday, January 26, 2007 8:41 AM To:

Re: [R] plotting results from tapply

2007-01-26 Thread Marc Schwartz
On Fri, 2007-01-26 at 11:50 -0500, Michael Rennie wrote: Hi, there I'm trying to plot what is returned from a call to tapply, and can't figure out how to do it. My guess is that it has something to do with the inclusion of row names when you ask for the values you're interested in, but

[R] Using tapply to create a new table

2007-01-26 Thread Kalish, Josh
All, I'm sure that this is covered somewhere, but I can't seem to find a good explanation. I have an existing table that contains information grouped by date. This is as so: Day NumberOfCustomers NumberOfComplaints 2006051210040 40

Re: [R] Using tapply to create a new table

2007-01-26 Thread Marc Schwartz
On Fri, 2007-01-26 at 12:39 -0500, Kalish, Josh wrote: All, I'm sure that this is covered somewhere, but I can't seem to find a good explanation. I have an existing table that contains information grouped by date. This is as so: Day NumberOfCustomers

Re: [R] Using tapply to create a new table

2007-01-26 Thread Kalish, Josh
Marc, Thanks for pointing out the merge function. That gets me part of the way there. The only thing is that I can't get the tapply() results into a format that merge() will take. For example: merge( set1 , tapply( set2$f1 , set2$commonField, mean ) , by=commonField ) Gives me Error in

Re: [R] Using tapply to create a new table

2007-01-26 Thread Marc Schwartz
Josh, As per the Value section of ?tapply, it returns a single atomic value for each cell. This is easily viewed by using: tapply(set2$f1, set2$commonField, mean) in a stand alone fashion or: str(tapply(set2$f1, set2$commonField, mean)) which will display the internal structure of the

[R] Residual variance from rlm?

2007-01-26 Thread Talbot Katz
Hi. This is a real basic question about results from rlm. I want to compute the properly scaled residual variance. Suppose M is my rlm result object; my example regression is against two variables, and based on 225 observations. summary(M) tells me that Residual standard error: 0.0009401 on

[R] Why do return or visible don´t return my obj ekt?

2007-01-26 Thread Christoph Heibl
Dear Rlist! I´ve got two lists which contain sets of DNA-sequences. They look something like this: List of 33 $ Cunonia_atrorubens : chr [1:247] t t n t ... $ Cunonia_balansae : chr [1:254] t c c c ... $

Re: [R] Why do return or visible don´t return my o bjekt?

2007-01-26 Thread Marc Schwartz
On Fri, 2007-01-26 at 20:23 +0100, Christoph Heibl wrote: Dear Rlist! Ruh-Ro ;-) I´ve got two lists which contain sets of DNA-sequences. They look something like this: List of 33 $ Cunonia_atrorubens : chr [1:247] t t n t ... $

[R] bootstrap bca confidence intervals for large number of statistics in one model; library(boot)

2007-01-26 Thread Jacob Wegelin
Sometimes one might like to obtain pointwise bootstrap bias-corrected, accelerated (BCA) confidence intervals for a large number of statistics computed from a single dataset. For instance, one might like to get (so as to plot graphically) bootstrap confidence bands for the fitted values in a

Re: [R] Why do return or visible don´t return my obj ekt?

2007-01-26 Thread Weiwei Shi
?invisible if you return in this function with invisible, then you need to assign like this x0 - lapply(1:3, function(i) (c(0,1))) names(x0) - c(a, b, c) x0 $a [1] 0 1 $b [1] 0 1 $c [1] 0 1 x1 - lapply(1:3, function(i) (c(2,3))) names(x1) - c(a, b, c) x2 - interleave(x0, x1) x2 $a [1]

Re: [R] Why do return or visible don´t return my obj ekt?

2007-01-26 Thread Christoph Heibl
Dear Marc, dear Weiwei, Thanks a lot! As I now see me question was quite silly, but we´re always much smarter with hindsight... : ) Best, Christoph On 26.01.2007, at 21:16, Marc Schwartz wrote: On Fri, 2007-01-26 at 20:23 +0100, Christoph Heibl wrote: Dear Rlist!

Re: [R] unique/subset problem

2007-01-26 Thread lalitha viswanath
Hi I read in my dataset using dt read.table(filename) calling unique(levels(dt$genome1)) yields the following aero aful aquae atum_D bbur bhal bmel bsub [9] buch cace ccre cglu cjej cper cpneuAcpneuC [17] cpneuJ

Re: [R] Using tapply to create a new table

2007-01-26 Thread Kalish, Josh
Ok, Thanks. I wasn't sure what the actual output of a tapply was. -Original Message- From: Marc Schwartz [mailto:[EMAIL PROTECTED] Sent: Friday, January 26, 2007 1:47 PM To: Kalish, Josh Cc: 'r-help@stat.math.ethz.ch' Subject: Re: [R] Using tapply to create a new table Josh, As per

Re: [R] unique/subset problem

2007-01-26 Thread Weiwei Shi
check ?read.table and add as.is=T in the option. So you read string as character now and avoid the factor things. Then repeat your work. For example x0 - read.table(~/Documents/tox/noodles/four_sheets_orig/reg_r2.txt, sep=\t, nrows=10) str(x0,1) `data.frame': 10 obs. of 7 variables: $

Re: [R] unique/subset problem

2007-01-26 Thread Weiwei Shi
oh, i forgot, you can also convert factor into string like dataset$genome1 - as.character(dataset$genome1) so you don't have to use as.numeric(dataset$score) if you use as.is=T when you read.table HTH, weiwei On 1/26/07, Weiwei Shi [EMAIL PROTECTED] wrote: check ?read.table and add as.is=T

[R] Form of the equation produced by a GLM with Poisson family and log link function

2007-01-26 Thread Marianne Gilbert
Hi everyone, My background is not math and I am trying to figure out exactly what equation to use to map a response variable in GIS based on the coefficients obtained from the GLM and the values of the independent variables in each grid cell of my study area. Most specifically, I want to know

Re: [R] replicating the odds ratio from a published study

2007-01-26 Thread Bob Green
Peetr Michael, I now see my description may have confused the issue. I do want to compare odds ratios across studies - in the sense that I want to create a table with the respective odds ratio for each study. I do not need to statistically test two sets of odds ratios. What I want to do is

[R] Package for phylogenetic tree analyses

2007-01-26 Thread lalitha viswanath
Hi I am looking for a package that 1. reads in a phylogenetic tree in NEXUS format 2. given two members/nodes on the tree, can return the distance between the two using the tree. I came across the following packages on CRAN ouch, ape, apTreeShape, phylgr all of which seem to provide extensive

Re: [R] replicating the odds ratio from a published study- post # 2

2007-01-26 Thread Bob Green
Peter Michael, I just came across the following on another mailing list and realized that my use (and the authors of the article use of the term 'odds ratio' ) is probably incorrect. I believe my interest is in the 'odds' of schizophrenia among the population of homicide, rather than a

Re: [R] replicating the odds ratio from a published study

2007-01-26 Thread Peter Dalgaard
Bob Green wrote: Peetr Michael, I now see my description may have confused the issue. I do want to compare odds ratios across studies - in the sense that I want to create a table with the respective odds ratio for each study. I do not need to statistically test two sets of odds ratios.

Re: [R] CGIwithR and visible output of 'invisible(capture.output(library(...)))'

2007-01-26 Thread Eric
library(R2HTML, verbose = FALSE) Leo Gürtler wrote: Dear alltogether, I want to use CGIwithR in conjunction with R2HTML. A small example called 'test.R': # #! /usr/bin/R invisible(capture.output(library(R2HTML))) HTML(summary(as.numeric(scanText(formData$numbers))), file=stdout())

[R] customizing covariance matrices

2007-01-26 Thread Kelly Lee
Hello R-users, Does anyone know how to customize a corStruct object to be used in gls? I would either like to create the covariance matrix from scratch, or alter the diagonal elements of an existing corStruct object and pass that to gls. Any ideas would be appreciated!

Re: [R] defining function into another function

2007-01-26 Thread talepanda
First question: Yes Second question: z in func.int2 is z in myfunc (z=y^3). You can easily test: f0-function(){ z-1 f1-function()print(f1) f2-function(z){f1();print(z)} f2(z) } z-0 f0() R language definition may be helpful

[R] Does inverse function exist in R

2007-01-26 Thread Patrick Wang
Hi, I wrote a simple derivative program (ftest=deriv(y~x^2, c(x), function(x){} )) I put (ftest=deriv(y~x^2, c(x), function(x){} ))(1) which return 2 which is correct. however, if I want the output to be 0 and hopefully a new inverse function can take in output (2) and return x=1. Can this be

Re: [R] Form of the equation produced by a GLM with Poisson family and log link function

2007-01-26 Thread Prof Brian Ripley
Have you looked at the references on ?glm ? They will all explain this to you (the first and last are simpler than the other two). The short answer is that predictions from the linear part of your model are for the natural log of the mean response. That is the default option for predict() on