similar to: Extract specific rows from matrix

Displaying 20 results from an estimated 10000 matches similar to: "Extract specific rows from matrix"

2009 Sep 21
2
cox memory
Hi there, I have a rather large data set and perform the following cox model: test1 <- list(tstart,tstop,death1,chemo1,radio1,horm1) out1<-coxph( Surv(tstart,tstop, death1) ~ chemo1+chemo1:log(tstop+1)+horm1+horm1:log(tstop+1)+age1+grade1+grade1:log(tstop+1)+positive1+positive1:log(tstop+1)+size1+size1:log(tstop+1), test1) out1 Up to here everything works fine (with each covariate
2010 Jan 04
4
function in aggregate applied to specific columns only
I want to use aggregate with the mean function on specific columns gender <- factor(c("m", "m", "f", "f", "m")) student <- c(0001, 0002, 0003, 0003, 0001) score <- c(50, 60, 70, 65, 60) basicSub <- data.frame(student, gender, score) basicSubMean <- aggregate(basicSub, by=list(basicSub$student), FUN=mean, na.rm=TRUE) This
2011 Aug 24
2
data manipulation and summaries with few million rows
I have a data set with about 6 million rows and 50 columns. It is a mixture of dates, factors, and numerics. What I am trying to accomplish can be seen with the following simplified data, which is given as dput output below. > head(myData) mydate gender mygroup id 1 2012-03-25 F A 1 2 2005-05-23 F B 2 3 2005-09-08 F B 2 4 2005-12-07 F B 2
2002 Aug 02
4
extracting data from a dataframe
Hi everyone, Here's a question about extracting data from a dataframe: Let's say I've got a dataframe with two vectors, TEST and GENDER. GENDER contains a 1 for males and 2 for females. I want to separate the results of TEST by GENDER so I can compare their means. What's the most efficient way to do this with R? -Tim -- Tim Wilson | Visit Sibley online: | Check out:
2009 May 21
3
index to select rows of a large matrix
Dear R Users, I have created a 1500 x 20000 data frame - DataSeq. Each of the 1500 rows represents a data sequence. I have another data frame iData that stores the information of these 1500 data sequences in the same order, for example, condition, gender, etc. If I use "subset" to select certain groups within iData according to some criteria that I have set, e.g. condition, gender Then
2009 Feb 18
2
[package-car:Anova] extracting residuals from Anova for Type II/III Repeated Measures ?
Hello dear R members. I have been learning the Anova syntax in order to perform an SS type III Anova with repeated measures designs (thank you Prof. John Fox!) And another question came up: where/what are the (between/within) residuals for my model? ############ Play code: phase <- factor(rep(c("pretest", "posttest", "followup"), c(5, 5, 5)),
2006 Feb 15
1
no convergence using lme
Hi. I was wondering if anyone might have some suggestions about how I can overcome a problem of "iteration limit reached without convergence" when fitting a mixed effects model. In this study: Outcome is a measure of heart action Age is continuous (in weeks) Gender is Male or Female (0 or 1) Genotype is Wild type or knockout (0 or 1) Animal is the Animal ID as a factor
2005 Apr 19
1
How to make combination data
Dear R-user, I have a data like this below, age <- c("young","mid","old") married <- c("no","yes") income <- c("low","high","medium") gender <- c("female","male") I want to make some of combination data like these, age.income.dat <- expand.grid(age,
2008 Dec 03
2
changing colnames in dataframes
dear all, I'm building new dataframes from bigger one's using e.g. columns F76, F83, F90: JJ<-data.frame( c( as.character(rep( gender,3))) , c( F76,6- F83, F90) ) Looking into JJ one has: c.as.character.rep.gender..8... c.6...F73..F78..F79..F82..6...F84..F94..F106..F109 1 w 2 2 w
2006 Jun 04
1
Nested and repeated effects together?
Dear R people, I am having a problem with modeling the following SAS code in R: Class ID Gr Hemi Region Gender Model Y = Gr Region Hemi Gender Gr*Hemi Gr*Region Hemi*Region Gender*Region Gender*Hemi Gr*Hemi*Region Gender*Hemi*Region Gr*Gender*Hemi*Region Random Intercept Region Hemi /Subject = ID (Gr Gender) I.e., ID is a random effect nested in Gr and Gender, leading to ID-specific
2010 Jan 21
1
Simple effects with Design / rms ols() function
Hi everyone, I'm having some difficulty getting "simple effects" for the ols() function in the rms package. The example below illustrates my difficulty -- I'll be grateful for any help. #make up some data exD <- structure(list(Gender = structure(c(1L, 2L, 1L, 2L, 1L, 1L, 1L, 2L, 1L, 2L, 2L, 2L, 1L, 2L), .Label = c("F", "M"), class = "factor"),
2017 Oct 19
2
Select part of character row name in a data frame
Dear R contributors, I have a problem in selecting in an efficient way, rows of a data frame according to a condition, which is a part of a row name of the table. The data frame is made of 64 rows and 2 columns, but the row names are very long but I need to select them according to a small part of it and perform calculations on the subsets. This is the example: X Y "Unique to
2007 Mar 08
1
how to assign fixed factor in lm
Hi there, > Value=c(709,679,699,657,594,677,592,538,476,508,505,539) > Lard=rep(c("Fresh","Rancid"),each=6) > Gender=rep(c("Male","Male","Male","Female","Female","Female"),2) > Food=data.frame(Value,Lard,Gender) > Food Value Lard Gender 1 709 Fresh Male 2 679 Fresh Male 3 699 Fresh
2007 Apr 02
1
?Bug: '&&' and '&' give different results?
"&&" seems to behave strangely and gives different results from "&" e.g. in a data frame selection (regardless whether terms are bracketed)? ===========Script======================= test=data.frame(gender=c("F","M","M","F","F"),side=c("R","L","R","L","R")) test
2007 Jun 21
1
Result depends on order of factors in unbalanced designs (lme, anova)?
Dear R-Community! For example I have a study with 4 treatment groups (10 subjects per group) and 4 visits. Additionally, the gender is taken into account. I think - and hope this is a goog idea (!) - this data can be analysed using lme as below. In a balanced design everything is fine, but in an unbalanced design there are differences depending on fitting y~visit*treat*gender or
2010 Mar 06
2
Plot interaction in multilevel model
I am trying to plot an interaction in a multilevel model. Here is some sample data. In the following example, it is longitudinal (i.e., repeated measures), so the outcome, score (at each of the three time points), is nested within the individual. I am interested in the interaction between gender and happiness predicting score. id <- c(1,1,1,2,2,2,3,3,3) age <-
2009 Sep 08
2
Very basic question regarding plot.Design...
Hello ALL! I have a problem to plot factor (lets say gender) as a line, or at least both line and point, from ols model: ols1 <- ols(Y ~ gender, data=dat, x=T, y=T) plot(ols1, gender=NA, xlab="gender", ylab="Y", ylim=c(5,30), conf.int=FALSE) If I convert gender into discrete numeric predictor, and use forceLines=TRUE, plot is not nice and true, since it shows values
2005 Aug 05
1
contrast {Design} question
All, I have been trying to get the following code to work: A.quantiles <- quantile(foo.frame$A, probs = seq(from = 0.05, to = 0.95, by = 0.05)) base.quantiles <- quantile(Efficacy205$BASELINE_RANK, probs = seq(from = 0.05, to = 0.95, by = 0.05)) gender <- levels(Efficacy205$GENDER) contrast.1 <- contrast(Model.1, list(TPCODE= 'A', AGE =
2008 May 25
1
marginality principle / selecting the right type of SS for an interaction hypothesis
Hello, I have a problem with selecting the right type of sums of squares for an ANCOVA for my specific experimental data and hypotheses. I do have a basic understanding of the differences between Type-I, II, and III SSs, have read about the principle of marginality, and read Venable's "Exegeses on Linear Models" (http://www.stats.ox.ac.uk/pub/MASS3/Exegeses.pdf). I am pretty new to
2011 Aug 31
1
formatting a 6 million row data set; creating a censoring variable
List, Consider the following data. gender mygroup id 1 F A 1 2 F B 2 3 F B 2 4 F B 2 5 F C 2 6 F C 2 7 F C 2 8 F D 2 9 F D 2 10 F D 2 11 F D 2 12 F D 2 13 F D 2 14 M A 3 15 M A 3 16 M A 3 17