similar to: problem with FUN in Hmisc::summarize

Displaying 20 results from an estimated 11000 matches similar to: "problem with FUN in Hmisc::summarize"

2010 Apr 13
0
Hmisc::summarize with a dataframe as input?
Hi all, I'm looking for a function with the same functionalities as Hmisc::summarize but accepting a dataframe as input (not just a vector or a matrix). I'd like to compute the correlation between two variables in my dataframe, grouped according to other variables in the same dataframe. For exemple, consider the following dataframe D: V1 V2 V3 A 1 -1 A 1 1 A -1 -1
2006 Dec 28
2
Aggregation using list with Hmisc summarize function
Hi All, I'm using the Hmisc summarize function and used list instead of llist to provide the by variables. It generated an error message. Is this a bug, or do I misunderstand how Hmisc works with lists? The program below demonstrates the error message. Thanks, Bob x<-1:8 group <- c(1,1,1,1,2,2,2,2) gender<- c(1,2,1,2,1,2,1,2) mydata<-data.frame(x,group,gender)
2009 Jun 13
1
Hmisc summarize() with level "" in by variable
I was using summarize() in a data set in which one of the levels of the by variable was "". The summary statistic was consistently off by one level and the "" level was not in the output data frame. I tried to report it as a bug, but I could not log into the Hmisc bug reporting website to do so. I searched for this in the email archives. If it's there, I failed to find
2005 Dec 21
2
Newbie - Summarize function
Dear R Users, I have searched through the archives but I am still struggling to find a way to process the below dataset. I have a dataset that has stratum and plot identifier. Within each plot there is variable (Top) stating the number of measurments that should be used to to calculate the mean to the largest "top" elements within one of the vectors (X). I would like to process
2006 Apr 19
1
Hmisc + summarize + quantile: Why only quantiles for first variable in data frame?
Hi, I'm working on a data set that contains a couple of factors and a number of dependent variables. From all of these dependent variables I would like to calculate mean, standard deviation and quantiles. With the function FUN I get all the means and stdev that I want but quantiles are only calculated for the first of the dependent variables (column 8 in the summarize command). What do I
2005 May 13
5
Conflict between xtable and Hmisc when using Sweave?
Dear R users, The Sweave code below runs fine, as it is. However, an error occurs when the line 'library(xtable)' is uncommented: Error: chunk 1 Error in "label<-"(`*tmp*`, value = "month") : no applicable method for "label<-" Is anybody aware of this and knows a workaround? Thanks, Sander. *******************
2009 Sep 14
2
Function "Varcov" in Design (Ver. 2.2-0) package
Hi, I'm running into an error message for the "anova"-function I never got before with the Design (Version 2.2-0) package. There seems to be a missing function "Varcov", please check my function calls (it's in german but I think you get the error): > library(Design) ## attaching Design package and dependent packages Lade n?tiges Paket: Hmisc ## loading
2004 Jul 13
2
Is there a statistics that can summarize the correlation for more than two random variables?
Hi, R people, I wonder if there is a statistics than can measure the correlation for more than two random variables, instead of computing the correlation coefficient matrix. If so, what R package should I use? Right now I can only think of the mean of all pair-wise correlation coefficients, e.g., (corr(x,y) + corr(x,z) + corr(y,z)) / 3 for three random variables (x, y, z). Thanks a
2010 Jun 08
2
problem with if else statement
Dear colleagues, What did I not understand ? ->my intention I want to create a new variable: In plain language: If someone is taking anithypertensive treatment (med.hyper==1) table(med.hyper) med.hyper 0 1 472 97 I want to subtract 5 mmHg (rr.dia.2m-5) from the measured diastolic blood pressure (rr.dia.2m) if not treated - the value of the measured diastolic blood pressure should
2009 Apr 24
0
By= levels with the Hmisc summarize function.
Hi, All I have a data frame as follows: > attach(mf) > names(mf) [1] "centre" "complex" "appl" "pool" "month" "alloc_gb" I want to summarize this as follows: agg<-summarize(alloc_gb,by=llist(centre,complex,appl,month),FUN=sum, na.rm=TRUE) That seems to run fine but there something odd about the output. The
2007 Oct 17
1
passing arguments to functions within functions
Dear R Users, I am trying to write a wrapper around summarize and xYplot from Hmisc and am having trouble understanding how to pass arguments from the function I am writing to the nested functions. There must be a way, but I have not been able to figure it out. An example is below. Any advice would be greatly appreciated. Thanks, Dan # some example data df=expand.grid(rep=1:4,
2003 Jul 31
1
help with tapply and weighted.mean
Hello! I have data frame with 'weights' in one of the columns. I need to compute weighted mean on another column other factor variable and i am trying to: res<-tapply(data$k,list(data$model),weighted.mean,w=data$w,na.rm=T) and i get: Warning messages: 1: longer object length is not a multiple of shorter object length in: x * w 2: longer object length is not a multiple of shorter
2009 May 20
1
sem with categorical data
I am trying to run a confirmatory factor analysis using the SEM package. My data are ordinal. I have read http://socserv.mcmaster.ca/jfox/Misc/sem/SEM-paper.pdf. When I apply the hetcor function, I receive the following error: Error in checkmvArgs(lower = lower, upper = upper, mean = mean, corr = corr, : at least one element of 'lower' is larger than 'upper' Example:
2004 Jul 13
0
Is there a statistics that can summarize the correlation formore than two random variables?
This seems more like a STATS question than an R question - asking on a list like STAT-L or ALLSTAT may result in more replies Nevertheless, it seems to me that you need to describe (and maybe decide) what you mean by 'summarize' the correlations. Certainly the mean DOES summarize them, but is it the summary you want? Maybe, maybe not. Perhaps the median? Or a trimmed mean? Do you want
2010 Sep 30
7
how to make list() return a list of *named* elements
If I combine elements into a list b <- c(22.4, 12.2, 10.9, 8.5, 9.2) my.c <- sample.int(round(2*mean(b)), 5) my.list <- list(b, my.c) the names of the elements seems to get lost in the process: > str(my.list) List of 2 $ : num [1:5] 22.4 12.2 10.9 8.5 9.2 $ : int [1:5] 11 8 6 9 20 If I explicitly name the elements at list-creation, I get what I want: my.list <- list(b=b,
2007 May 14
1
Nicely formatted summary table with mean, standard deviation or number and proportion
Dear all, The incredibly useful Hmisc package provides a method to generate summary tables that can be typeset in latex. The Alzola and Harrell book "An introduction to S and the Hmisc and Design libraries" provides an example that generates mean and quartiles for continuous variables, and numbers and percentages for count variables: summary() with method = 'reverse'. I
2005 Jul 08
2
missing data imputation
Dear R-help, I am trying to impute missing data for the first time using R. The norm package seems to work for me, but the missing values that it returns seem odd at times -- for example it returns negative values for a variable that should only be positive. Does this matter in data analysis, and/or is there a way to limit the imputed values to be within the minimum and maximum of the actual
2006 Mar 01
3
How to do a "proc summary" in R?
Hi, I'm a SAS user trying to convert myself to R but I still have problems with some pretty simple commands. First I wanted to add up a number of red-tailed hawks seen per day (julian day) per year. So I tried: RTyrday <- tapply(RThr,list(year,julian),sum) And then I tried the following regression: mod1 <- glm(RTyrday~julian+year, family=gaussian (link=identity),data=RT) Wich
2011 Apr 09
3
In need of help with correlations
I am in need of someone's help in correlating gene expression. I'm somewhat new to R, and can't seem to find anyone local to help me with what I think is a simple problem. I need to obtain pearson and spearman correlation coefficients, and corresponding p-values for all of the genes in my dataset that correlate to one specific gene of interest. I'm working with mouse Affymetrix
2003 Jun 22
1
Using weighted.mean() in aggregate()
Dear R users, I have a question on using weighted.mean() while aggregating a data frame. I have a data frame with columns Sub, Length and Slope: > x[1:5,] Sub Length Slope 1 2 351.547 0.0025284969 2 2 343.738 0.0025859390 3 1 696.659 0.0015948968 4 2 5442.338 0.0026132544 5 1 209.483 0.0005304225 and I would like to calculate the weighted.mean of Slope, using Length