similar to: tapply and any

Displaying 20 results from an estimated 10000 matches similar to: "tapply and any"

2006 Jun 20
3
Create variables with common values for each group
Dear all, sorry, this is for sure really basic, but I searched a lot in the internet, and just couldn't find a solution. The problem is to create new variables from a data frame which contains both individual and group variables, such as mean age for an household. My data frame: df hhid h.age 1 10010020 23 2 10010020 23 3 10010126 42 4 10010126 60 5 10010142
2009 Jun 25
4
Using by() and stacking back sub-data frames to one data frame
Dear all, I have a code where I subset a data frame to match entries within levels of an factor (actually, the full script uses three difference factors do do that). I'm very happy with the precision with which I can work with R, but since I loop over factor levels, and the data frame is big, the process is slow. So I've been trying to speed up the process using by(), but I got stuck at
2009 Jan 19
2
Using apply to generate matrix from rows?
Dear all, I have a simple question which I unfortunately do not seem to be able to solve myself. I have a (NxK) matrix and want to generate a new matrix by multiplying each row with itself such that the new matrix has dimension ((N*K)xK) (or better, generate an array with dimension (K,K,N)). I tried apply, but that did not work. Any suggestions? Thanks! Stephan ## Here is a simple
2009 Aug 15
1
System is computationally singular and scale of covariates
Dear all, I'm running a self-written numerical optimization routine (hazard model) which includes computing the inverse of the outer product of the score. I have been getting the above error message ("System is computationally singular"), and after some tweaking, I realized that these variables have some high numbers and the problem could be circumvented by scaling them down (i.e.
2009 Mar 30
1
Importing csv file with character values into sqlite3 and subsequent problem in R / RSQLite
Dear all, I'm trying to import a csv file into sqlite3 and from there into R. Everything looks fine exepct that R outputs the character values in an odd fashion: they are shown as "\"CHARACTER\"" instead of "CHARACTER", but only if I show the character variable as a vector. Does someone know why this happens? Below is a sample code. The first part is written in
2009 Sep 20
1
Computing the sum of cross products of rows of a matrix
Hi everyone, I would like to compute the sum of cross products of rows of a matrix. Does anyone know how to do this without an explicit loop for computational efficiency? Below is a code example. Thanks! Stephan # I.e., if I have a matrix like this x <- matrix(rep(c(1,2,3),3),ncol=3) ## > x ## [,1] [,2] [,3] ## [1,] 1 1 1 ## [2,] 2 2 2 ## [3,] 3 3
2009 Apr 02
2
Selecting all rows of factors which have at least one positive value?
Dear all, I'm trying to select from a dataframe all rows which correspond to a factor (the id variable) for which there exists at least one positive value of a certain variable. As an example: x <- data.frame(matrix(c(rep(11,4),rep(12,3),rep(13,3),rep(0,3),1,rep(0,4),rep(1,2)),ncol=2)) > x X1 X2 1 11 0 2 11 0 3 11 0 4 11 1 5 12 0 6 12 0 7 12 0 8 13 0 9 13 1 10
2006 Feb 11
2
aggregate vs tapply; is there a middle ground?
Dear all, I'm wanting to do a series of comparisons among 4 categorical variables: a <- aggregate(y, list(var1, var2, var3, var4), sum) This gets me a very nice 2-dimensional data frame with one column per variable, BUT, as help for aggregate says, <<empty subsets are removed>>. I don't see in help(aggregate) how I can change this. In contrast, a <- tapply(y,
2006 Jul 04
1
using weights in lrm
Dear all, just a quick question regarding weights in logistic regression. I do results <- lrm(y.js ~ h.hhsize + h.death1 + h.ill1 + h.ljob1 + h.fin1 + h.div1 + h.fail1 + h.sex + h.ch.1
2009 Jan 22
2
Converting ddf/dct/sas data definition file to R
Dear all, I was wondering whether anyone knows about a program which converts (part of) a data definition file (such as a .dct file for stata, or .sas file for sas) into an R-script. Here is an example with a .sas file: <-- snipp VALUE HTYPE (default=32) 0 = "Not in household" 1 = "Married couple family household" 2 =
2006 Oct 22
1
Problem with installing Hmisc and Design: gfrotran: error
cannot exec 'f951': No such file or directory Reply-To: Hi all, I'm using R on an Suse Linux system. Since Hmisc and Design need both fortran, I installed gfortran (through rpm). However, I still get an error message, namely: gfrotran: error cannot exec 'f951': No such file or directory And the installation is cancelled. I tried solving the problem through googling it, and
2003 Apr 17
3
accessing current factor in tapply
G'Day, I want to access in a function called from tapply the current factor. In my example below, all I want to do is to write the current factor on each histogram. Needless to say my example does not work. I would be grateful for pointers in the right direction. Many thanks Bernie McConnell Sea Mammal Reserach Unit cc <- 1:10 ff <- rep(c("a","b"),5) pp<-
2003 Jan 03
4
factor analysis (pca): how to get the 'communalities'?
Dear expe-R-ts, I try some test data for a factorAnalysis (resp. pca) in the sense of Prof. Ripley's MASS ? 11.1, p. 330 ff., just to prepare myself for an analysis of my own empirical data using R (instead of SPSS). 1. the data. ## The test data is (from the book of Backhaus et al.: Multivariate ## Analysemethoden. Springer 2000 [9th ed.], p. 300 ff):
2003 May 11
1
Mac OS X canonically decomposed UTF-16 filenames
Hi. I'd like to find some way for Samba to convert the filenames created by Macintosh OS X into something windows can use. According to their docs: http://developer.apple.com/techpubs/macosx/Essentials/SystemOverview/FileSystem/chapter_9_section_13.html filenames are stored as canonically decomposed Unicode 2.1 in UTF-16 format (a sequence of 16-bit codes) Samba running on a
2008 Aug 01
3
Newbie question: How to use tapply() on several vectors simultaneously
Dear R users, I have a newbie-question that I couldn't resolve after reading through several pieces of documentation and searching the archive. I have a data.frame containing experimental data from a group experiment in psychology. Each line represents a single participant, but participants were assigned to groups of three or four persons. One variable indicates each participants'
2004 Aug 06
2
pull relay problems
i was using multiple ports because that's how i figured i'd have to do it. o, mounting the remote source locally? i'm not familiar with how to do this. i'm also not seeing how to do this in the docs. how would i go about mounting a remote stream? -a.j. On Fri, 27 Apr 2001, Jack Moffitt wrote: > Why are you using multiple ports at all? That's what mountpoints are >
2004 Mar 30
1
RHEL 3 and OCFS 1.0.9-12 / 1.0.11-1
Is the following statement still valid for either OCFS 1.0.9-12 or OCFS 1.0.11-1? The following is from one of the questions put forward by Derek Suzuki on Ocfs-users "A couple more minor questions about OCFS and RHEL3" > Next, I saw a Metalink thread which suggests that async I/O is not > supported on OCFS with RHAS 2.1. It doesn't say anything about RHEL3. > We've
2001 Oct 08
1
Package Install Problem under Win98
Hi, I have tried to install 'tensor' as a new package in these phases: 1. via 'Install package from local Zip-File' in Rgui/Windows98: install.packages("D:/R/_Pakets12MB/tensor.zip", .lib.loc[1], CRAN = NULL) 2. Looking at the library folder, there was now a new entry 'tensor' including some files e.g. \library\tensor\R\tensor.R 3. Then I have done
2002 May 14
2
tapply and empty subsets
I am using tapply to compute means by group, as in > tapply(y, z, mean) 1 2 3 21.00757 20.50031 NA where y is a vector and z a factor with levels 1:3. I would like to get a zero instead of the NA I get when a subset is empty. The problem is that FUN is not applied to empty cells of the ragged array. (Of course I am willing to define a function my.mean that returns
2004 Aug 06
2
pull relay problems
heya... i'm extremely new to the list (10 minutes), and i have a burnin' question that i was hopin' you folks could help me out with. i'm running beos as an encoder box, with two streams (8000 and 8001) hosted on it. the idea is to use my redhat box to relay those streams to the public using icecast, allowing the be machines cpu cycles to focus solely on encoding. anyway, i