Re: [R] Find multiple elements in a vector

2009-07-23 Thread Philip Twumasi-Ankrah
This should work which((x==2)|(x==3)) --Quotable Quotes- A Smile costs Nothing But Rewards Everything   - Anonymous Happiness is not perfected until it is shared  

[R] "rbinom" not using probability of success right

2008-05-28 Thread Philip Twumasi-Ankrah
I am trying to simulate a series of ones and zeros (1 or 0) and I am using "rbinom" but realizing that the number of successes expected is not accurate. Any advice out there. This is the example: N<-500 status<-rbinom(N, 1, prob = 0.15) count<-sum(status) 15 percent of 500 should be 75 but wha

Re: [R] "rbinom" : Does randomness preclude precision?

2008-05-28 Thread Philip Twumasi-Ankrah
e eventual nature of the distribution. I mean if I simulated a Normal (0, 1) and got a Normal(1.5, 2) these would be very different distributions. It is the same with simulating a Binomial(1, p=0.15) and getting Binomial(1, 0.154) [EMAIL PROTECTED] wrote: On 28-May-08 12:53:26, Philip Twum

[R] "& not meaningful for factors"

2008-06-04 Thread Philip Twumasi-Ankrah
I am trying to define groupings from levels of factor variables and this the warning message that R give "& not meaningful for factors". The nature of my task is this. I have a variable stage which has the levels (1B, 2A, 2B) - these are the AJCC TNM stages of cancer, and another variable di

Re: [R] "& not meaningful for factors

2008-06-04 Thread Philip Twumasi-Ankrah
ying to do a logical operation ("&") between two factors and that operation is not defined. This is what the error message is saying. Also you first attempt is probably missing a comma: node1 <- data.trt[data.trt$stage=="1B" & data.trt$diameter=="

Re: [R] How to solve empty cells in the contingency table?

2008-06-25 Thread Philip Twumasi-Ankrah
I think not considering the zero cells compromises the estimates you derive from you analysis. For instance, what will be the value of N used in the MLE estimation? You can ZIP - Zero Inflated Poisson which should provide you with the means to account for the zeros. R has funstions to do that.

[R] R alternative to SAS PROC REPORT

2008-06-25 Thread Philip Twumasi-Ankrah
R has wonderful graphics but I am wondering whether there is anything in R to provide customization of tables like PROC Report does in SAS. A Smile costs Nothing  But Rewards Everything Happiness is not perfected until it is shared   

Re: [R] finding the suitable distribution

2008-06-27 Thread Philip Twumasi-Ankrah
I think a first step in getting some help is to summarize your data for easy evaluation. Model fitting (?) will require some information providing some information like; 1. What is the response variable here 2. What are the covariates (cofactors and possibly the levels of factors) Then the dat

Re: [R] Change name of a specific column of a data frame

2008-07-01 Thread Philip Twumasi-Ankrah
Try require(gregmisc) rename(data, from="old_name", to="new_name") A Smile costs Nothing  But Rewards Everything Happiness is not perfected until it is shared   -Jane Porter   --- On Tue, 7/1/08, [EMAIL PROTECTED] <[EMAI

[R] Help on nested FOR loops

2008-05-19 Thread Philip Twumasi-Ankrah
I am new to more radical programming in R. I am trying to write a nested 'for' loop to produce output that takes subscripts like: for i taking values 1,2,3,4,5 and j taking values 1,2,3 I want to output for a computation using the combination values of i and j a value x like this; i j

Re: [R] asscii2netcdf]

2008-09-05 Thread Philip Twumasi-Ankrah
Hi Marshall, This link provides very good directions and examples you can use. http://www.image.ucar.edu/GSP/Software/Netcdf/ A Smile costs Nothing  But Rewards Everything Happiness is not perfected until it is shared   -Jane Por

Re: [R] odds ratio: how to create reference

2008-09-23 Thread Philip Twumasi-Ankrah
To select another reference level from the default that R chooses you can use the "relevel" function example; Reorder Levels of Factorwarpbreaks$tension <- relevel(warpbreaks$tension, ref="M") summary(lm(breaks ~ wool + tension, data=warpbreaks)) function findlink(pkg, fn) { var Y, link; Y =

[R] Help with Forest Plots

2009-01-21 Thread Philip Twumasi-Ankrah
I will really appreciate help with plotting some forest plots. I am trying to show disparities in hazard ratios (and confidence intervals) for a set of covariates for 2 treatments (A and B say). I will to be able to keep the column of text (covariate names) but plot the 2 forest plots on an ex

Re: [R] how to label the branches of a tree

2009-02-25 Thread Philip Twumasi-Ankrah
You may have to change/scale the sizes of the font by using "cex" and then to keep all labels within the plotting window, use "xpd=TRUE". Like in text(fit, use.n=TRUE, cex=0.8, xpd=TRUE) Philip -- A Smile costs Nothing But Rewards Everything  

Re: [R] read multiplan or sylk files in R

2009-02-25 Thread Philip Twumasi-Ankrah
According to the microsoft site "http://support.microsoft.com/kb/323626";, SYLK files are ordinary text or csv files with a peculiar character in that the first two characters of the file are the uppercase letters. For example for a csv file, the first column may contain the v

[R] Help needed with Waterfall plot

2008-10-31 Thread Philip Twumasi-Ankrah
Hi friends, I need suggestions/directions on how to producing a waterfall plot for present extend of change in tumour size for a set of respondents in a study.  Example of use of waterfall plot is in the following slides presented at ASCO 2007 by Axel Grothey. Link is http://media.asco.org/pla

Re: [R] read SAS file

2008-11-12 Thread Philip Twumasi-Ankrah
If you are using the windows version, installing packages can be done easily from the prompt in the R work space by the following statement: install.packages("name_of_package", dep=TRUE) the part of dep=TRUE is to allow associated dependencies of packages tp be installed along side. This saves