[R] [R-pkgs] New Package on Lancet Surveys of Iraq Mortality

2007-06-06 Thread David Kane
Hello, I have placed a package on CRAN about two surveys of mortality in Iraq that were published in the Lancet. http://cran.at.r-project.org/src/contrib/Descriptions/lancet.iraqmortality.html > install.packages("lancet.iraqmortality") ... > library(lancet.iraqmortality) Loading required packa

[R] Showing NAs when using table()

2007-05-23 Thread David Kane
I want to use table() to show NA values with factor variables. Using the set up from the help page, I have: > b <- factor(rep(c("A","B","C"), 10)) > d <- factor(rep(c("A","B","C"), 10), levels=c("A","B","C","D","E")) > is.na(d) <- 3:4 > table(b, d) d bA B C D E A 9 0 0 0 0 B 0

[R] Determining response variable in a formula

2005-07-12 Thread David Kane
I have a formula from which I want to deduce the name of the response variable. One way of doing so is as follows: > my.form <- as.formula("y ~ x + z") > all.vars(my.form)[1] [1] "y" > Is there a better way and/or preferrred method of determining "y" from my.form than this one? In messing around

[R] summary statistics for lists of matrices or dataframes

2005-05-10 Thread David Kane
Is there a simple way to calculate summary statistics for all the matrices or dataframes in a list? For example: > z <- list(matrix(c(2,2,2,2), ncol = 2), matrix(c(4,4,4,4), ncol = 2)) > z [[1]] [,1] [,2] [1,]22 [2,]22 [[2]] [,1] [,2] [1,]44 [2,]44 > I w

Re: [R] Developing R classes

2004-12-29 Thread David Kane
Gilvan Justino writes: > Hi, > > I´m trying to write some R classes but I din´t find documentation > enought to develop them. I have faced a similar problem. Here is the summary of what I have been able to find (including some of the responses that you have already received) with a focus on

[R] replacing NA's with 0 in a dataframe for specified columns

2004-09-15 Thread David Kane
I know that there must be a cool way of doing this, but I can't think of it. Let's say I have an dataframe with NA's. > x <- data.frame(a = c(0,1,2,NA), b = c(0,NA,1,2), c = c(NA, 0, 1, 2)) > x a b c 1 0 0 NA 2 1 NA 0 3 2 1 1 4 NA 2 2 > I know it is easy to replace all the NA's wit

[R] printing POSIXct values in table labels

2003-03-05 Thread David Kane
Hi, I think that there is something that I am misunderstanding in creating tables using dates that are of class POSIXct. Consider: > x <- data.frame(date = as.POSIXct(strptime(c(rep("2002-10-17", 4), rep("1999-12-08", > 2)), format = "%Y-%m-%d"))) > x date 1 2002-10-17 2 2002-10-17 3 200

[R] Summary: Warnings with no INDEX file in a package

2003-01-23 Thread David Kane
ut, since R CMD build creates the index for me, I can now run R CMD check and get no warnings. My mistake was to interpret: "* creating new 'INDEX'" to mean: "Making an INDEX file and putting it in your .gz file while leaving your original package unchanged." Than

[R] Warnings with no INDEX file in a package.

2003-01-09 Thread David Kane
language R > -- David Kane Geode Capital Management 617-563-0122 [EMAIL PROTECTED] Please avoid sending me Word or PowerPoint attachments. See http://www.fsf.org/philosophy/no-word-attachments.html __ [EMA