similar to: Using 'sapply' and 'by' in one function

Displaying 20 results from an estimated 9000 matches similar to: "Using 'sapply' and 'by' in one function"

2008 Feb 11
0
Testing for differecnes between groups, need help to find the right test in R. (Kes Knave)
-----Original Message----- From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-project.org] On Behalf Of r-help-request at r-project.org Sent: Monday, February 11, 2008 12:00 PM To: r-help at r-project.org Subject: R-help Digest, Vol 60, Issue 11 Send R-help mailing list submissions to r-help at r-project.org To subscribe or unsubscribe via the World Wide Web, visit
2010 Nov 29
3
data.frame and formula classes of aggregate
Hi - I apologize for the 2nd post, but I think my question from a few weeks ago may have been overlooked on a Friday afternoon. I might be missing something very obvious, but is it widely known that the aggregate function handles missing values differently depending if a data frame or a formula is the first argument ? For example, (d<- data.frame(sex=rep(0:1,each=3),
2008 Jul 20
2
fill in area between 2 lines with a color
Hi - I'd like to have the area between 2 lines on a x-y plot be filled with grey, but I haven't had any luck using polygon or rect. (In reality, I'd like to do this for twice - once for a low group and once for a high group - and then I'd like to plot a set of data points for a 'normal' group together with these 2 grey areas.) Here's a simple example of the 2 lines:
2010 Feb 04
1
replace a for loop with lapply or relative
Dear helpers. I often need to make dichotomous variables out of continuous ones (yes, I realize the problems with throwing away much of the information), but I then like to check the min and max of each category. I have the following simple code to do this that cuts each variable (x1,x2,x3) at the 90th percentile, and then prints the min and max of each category:
2009 May 01
2
sequence number for 'long format'
Dear R-help list, I've got a data set in long format - each subject can have several (varying in number) measurements, with each record representing one measurement. I want to assign a sequence number to each measurement, starting at 1 for a person's first measurement. I can do this with the by function, but there must be an easier way. Here's my code - id is id number, age is
2010 Apr 27
5
get means of elements of 5 matrices in a list
I've got a list of 5 matrices that are each 5 x 6. I'd like to end up with a 5 x 6 matrix that contains the mean value of the 5 original matrices. I can do this by brute force, but there must be a better way than making each matrix into a vector and then remaking a matrix thanks very much for any help david freedman ll=list(structure(c(9.7, 17.6, 20.8, 24.1, 33.8, 14.5, 25.7, 29.8,
2009 May 25
3
long format - find age when another variable is first 'high'
Dear R, I've got a data frame with children examined multiple times and at various ages. I'm trying to find the first age at which another variable (LDL-Cholesterol) is >= 130 mg/dL; for some children, this may never happen. I can do this with transformBy and ddply, but with 10,000 different children, these functions take some time on my PCs - is there a faster way to do this in R?
2010 May 20
2
Svy function doesn't work nested in user-defined function
Hi R-help, I posted about this late yesterday but got no response. I may have put TMI in the original request. Not to mention I couldn't cut and paste yesterday because I was working R off a non-network computer while asking for help on a network computer. Essentially, I have this user-defined function: test <- function(X){ chisq <- svychisq(~X
2011 Oct 17
1
Build 64-bit R Solaris 10 Sparc
Hello All, Has anyone had success building 64-bit R on Solaris 10 Sparc with the Oracle Studio Compiler suite? Could anyone start give me a clue. I have tried to no avail. Thanks, Nynese Nynese Tinsley, BSEE, MSCIS UNIX Systems Analyst Harvard School of Public Health Center for Biostatistics in AIDS Research 651 Huntington Ave, FXB 614 Boston, MA 02115 617-432-3244 office#
2011 Nov 14
1
Problem with edit()
Since installing R 2.14.0 on my Mac (a Mac Pro running 10.6.8) an issue has arisen when using the vi editor in conjunction with the edit() command. More specifically, commented lines disappear from edited functions when using [functionname.R] <- edit(). That is, if you have created a function called “test.func” as such: function () { # This is a test ex _ 4 duh <- seq(1, 10) fuh
2012 Dec 06
1
Fuction Error
I'm calling a list of symbols and then using a function to build a data frame from that symbol list. It works great until I introduce this index symbol from yahoo '^GSPC'. When and index symbol is introduced I get and error which is below. > Data <- symbolFrame(symbols) Error in get(S) : object '^GSPC' not found Since R does not like the ^ in front of a name it
2010 May 02
3
percent by subset
Suppose my data looks like this: Obs, Male, Female, Height 1, T, F, 66 2, F, T, 64 3, T, F, 59 4, T, F, 55 5, F, T, 62 6, T, F, 67 7, T, F, 58 8,
2002 Mar 01
3
Setting working directory (PR#1338)
Full_Name: Jeffrey M. Freedman Version: 1.4.1 OS: Mac OSX Submission from: (NULL) (169.226.200.51) I'm running R version 1.4.1 (NOT DARWIN VERSION) and it crashes every time I set a working directory (either from the menu or using setwd) to a path that is longer than a certain number of characters. This was not a problem in version 1.3.1. Thank you.
2004 Dec 16
1
Problem with postscript graphics device driver
I recently installed R version 2.01 for OS X (version 10.3.6). I now get the following error message when I try to use the postscript function: Error in get(name.opt, envir = envir) : Object ".PSenv" not found This did not happen in previous versions of R (i.e. 1.9). I do not get this error message when using the pdf graphics device driver. Thanks, Jeff Freedman
2009 Mar 07
2
piecewise linear regression
Hi - I'd like to construct and plot the percents by year in a small data set (d) that has values between 1988 and 2007. I'd like to have a breakpoint (buy no discontinuity) at 1996. Is there a better way to do this than in the code below? > d year percent se 1 1988 30.6 0.32 2 1989 31.5 0.31 3 1990 30.9 0.30 4 1991 30.6 0.28 5 1992 29.3 0.25 6 1994 30.3
2009 Sep 18
1
Within-group correlation confidence intervals
I'm trying to obtain within-group correlations on a subset of variables. I first selected my variables using the following command: mydata$x<-mydata[c("iq","education","achievement")] I'd like to look at correlations among those variables separately for men and women. My gender variable in mydata is coded 1 (women) and 0 (men). I have successfully used
2010 May 06
4
sample size for survival curves
Dear R users, I am not asking questions specifically on R, but I know there are many statistical experts here in the R community, so here it goes my questions: Freedman (1982) propose an approximation of sample size/power calculation based on log-rank test using the formula below (This is what nQuery does): (Z(1-?/side)+Z(power))^2*(hazard.ratio+1)^2 N =
2006 May 06
1
Fwd: Fun with TrippLite
Hi Charles and Jonathan, I am going through my over 300 unread NUT messages, and I just discovered this one from mid-December. At the time, I was trying to clean up the tripplite subdriver of newhidups, but never got the information I needed. I have enabled this driver now, but it is marked "experimental". The driver is still incomplete, in the sense that there are many unmapped device
2010 Oct 06
2
A problem --thank you
dear:teacher i have a problem which about the polr()(package "MASS"), if the response must have 3 or more levels? and how to fit the polr() to 2 levels? thank you. turly yours [[alternative HTML version deleted]]
2009 Jan 07
12
glusterfs alternative ? :P
I know that this is not the appropriate place :). You know someone can alternative to gluserfs ?:) -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://supercolony.gluster.org/pipermail/gluster-users/attachments/20090107/63b68a0d/attachment.html>