similar to: multiplying columns in matrix

Displaying 20 results from an estimated 10000 matches similar to: "multiplying columns in matrix"

2012 Aug 21
2
define subset argument for function lm as variable?
Hi I want to do a series of linear models, and would like to define the input arguments for lm() as variables. I managed easily to define the formula arguments in a variable, but I also would like to have the "subset" in a variable. My reasoning is, that I have the subset in the results object. So I wiould like to add a line like: subs <- dead==FALSE & recTreat==FALSE which
2012 Jun 05
1
Do YOU know an equation for splines (ns)?
Hi, I am looking at the change in N concentration in plant roots over 4 time points and I have fit a spline to the data using ns and lme: fit10 <- lme( N~ns(day, 3), data = rcn10G) I may want to adjust the model a little bit, but for now, let's assume it's good. I get output for the fixed effects: Fixed: N ~ ns(day, 3) (Intercept) ns(day, 3)1 ns(day, 3)2 ns(day, 3)3
2012 Aug 22
3
Question concerning anova()
Hi I am comparing four different linear mixed effect models, derived from updating the original one. To compare these, I want to use anova(). I therefore do the following (not reproducible - just to illustration purpose!): dat <- loadSPECIES(SPECIES) subs <- expression(dead==FALSE & recTreat==FALSE) feff <- noBefore~pHarv*year # fixed effect in the model reff <-
2012 Nov 11
4
Multiplying elements of a list by rows of a matrix
Hi all, I have the following code: set.seed(1) x1 <- matrix(sample(1:12), ncol=3) x2 <- matrix(sample(1:12), ncol=3) x3 <- matrix(sample(1:12), ncol=3) X <- list(x1,x2,x3) tt <- matrix(round(runif(5*4),2), ncol=4) Is there a way I can construct a new list where newlist[[i]] = tt[i,] %*% X[[i]] without using a for loop? Each element of newlist will be 3 x 1 vector. Thanks -- Tina
2013 May 13
2
reduce three columns to one with the colnames
Ein eingebundener Text mit undefiniertem Zeichensatz wurde abgetrennt. Name: nicht verf?gbar URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20130513/fe848ce7/attachment.pl>
2013 Feb 28
2
data grouping and fitting mixed model with lme function
Dear all,   I have data from the following experimental design and trying to fit a mixed model with lme function according to following steps but struggling. Any help is deeply appreciated.   1) Experimental design: I have 40 plants each of which has 4 clones. Each clone planted to one of 4 blocks. Phenotypes were collected from each clone for 3 consecutive years. I have genotypes of plants. I
2012 Jul 23
3
How to do the same thing for all levels of a column?
Dear all, I am a R beginner, and I am looking for a way to do the same thing for all levels of a column in a table. Basically, I have a bunch of protein sequences composed of different amino acid residues, and each residue is represented by an uppercase letter. I want to calculate the ratio of different amino acid residues at each position of the proteins. Here is an example table: Proteins
2012 Jul 30
1
lattice legen and auto.key conflict
Hello R-helpers, I'm trying to customize a graphic in lattice using the 'legend' argument to add labels on my plot but in the process I'm losing the legend drawn by 'auto.key', despite the fact that I'm actually not sticking these on the same sides of the graphic. I worked up a quick and simple example with the iris data : ### here's the basic graph
2012 Oct 25
5
system is computationally singular: reciprocal condition number
Hi folks, I know, this is a fairly common question and I am really disappointed that I could not find a solution. I am trying to calculate Mahanalobis distances in a data frame, where I have several hundreds groups and several hundreds of variables. Whatever I do, however I subset it I get the "system is computationally singular: reciprocal condition number" error. I know what it means
2011 Oct 30
1
Normality tests on groups of rows in a data frame, grouped based on content in other columns
Dear R users, I have a data frame in the form below, on which I would like to make normality tests on the values in the ExpressionLevel column. > head(df) ID Plant Tissue Gene ExpressionLevel 1 1 p1 t1 g1 366.53 2 2 p1 t1 g2 0.57 3 3 p1 t1 g3 11.81 4 4 p1 t2 g1 498.43 5 5 p1 t2 g2 2.14 6 6 p1 t2 g3 7.85 I
2012 Oct 03
1
Difficulties in trying to do a mixed effects model using the lmer function
Dear people of the help list I am drying to analyze my data using the 'lmer' function and I keep having problems. This is the model: > fm1<-lmer(dbh~spec+scheme+(1|Plot),data=d, REML=FALSE). I analyse tree size (dbh) of 3 different species (spec) and 3 planting schemes (scheme). I have 5 plots, which I hope to model as a random factor. (However, the subsequent output is based on
2013 May 01
4
Selecting several columns/rows of a dataframe?
Sorry, the use of rows/columns I found so far was rather contradictive, both refering to what can be gotten via subset() instead of what I'm looking for. Is there a way to get multiple colums/rows? Something like corpus.df${mph,mgl,eng} Thanks in advance for any answers. -- Joel Prokopchuk
2013 Jun 18
2
find closest value in a vector based on another vector values
Dear All, would you please provide your thoughts on the following: let us say I have: a <-c(1,5,8,15,32,69) b <-c(8.5,33) and I would like to extract from "a" the two values that are closest to the values in "b", where the length of this vectors may change but b will allways be shorter than "a". So at the end based on this example I should have the result
2012 Aug 30
2
Identifying and Removing NA Columns and factor Columns with more than x Levels
Hi, How do you subset a dataframe so that you only have columns: 1. that contain one or more NAs? 2. that contain factors with greater than or equal to 32 levels? How do you remove from a dataframe columns** 3. with one or more NA's? 4. that contain factors with greater than or equal to 32 levels? ** I know how to remove columns at a basic level but I am trying
2012 Sep 12
3
Need help
Hello, I am brand new in this site as well as in R. Please accept my early apology if it's not the right place to ask such a question. I have the following equation: b=[2(1-a)(1+2a)^0.5]/(1+3a) How can I solve the above equation for 'a' using R? Thanks in advance. KD [[alternative HTML version deleted]]
2012 Apr 23
3
Selecting columns whose names contain "mutated" except when they also contain "non" or "un"
Hello All, Started out awhile ago trying to select columns in a dataframe whose names contain some variation of the word "mutant" using code like: names(KRASyn)[grep("muta", names(KRASyn))] The idea then would be to add together the various columns using code like: KRASyn$Mutant_comb <- rowSums(KRASyn[grep("muta", names(KRASyn))]) What I discovered though, is
2012 Sep 28
4
Merging multiple columns into one column
Good Evening- I have a dataframe that has 10 columns that has a header and 7306 rows in each column, I want to combine these columns into one. I utilized the stack function but it only returned 3/4 of the data...my code is: where nfcuy_bw is the dataframe with 7305 obs. and 10 variables Once I apply this code I only receive a data frame with 58440 obs. of 2 variables, of which there should be
2013 Mar 09
2
grouping followed by finding frequent patterns in R
I have a data in the following form : CIN TRN_TYP 9079954 1 9079954 2 9079954 3 9079954 4 9079954 5 9079954 4 9079954 5 9079954 6 9079954 7 9079954 8 9079954 9 9079954 9 . . . . . . there are 100 types of CIN (9079954,12441087,15246633,...) and respective TRN_TYP first of all, I want this data to be
2012 Feb 23
5
cor() on sets of vectors
suppose I have two sets of vectors: x1,x2,...,xN and y1,y2,...,yN. I want N correlations: cor(x1,y1), cor(x2,y2), ..., cor(xN,yN). my sets of vectors are arranged as data frames x & y (vector=column): x <- data.frame(a=rnorm(10),b=rnorm(10),c=rnorm(10)) y <- data.frame(d=rnorm(10),e=rnorm(10),f=rnorm(10)) cor(x,y) returns a _matrix_ of all pairwise correlations: cor(x,y)
2012 Oct 11
3
Sorting a data frame by specifying a vector
Hello all, I cannot seem to figure out this seemingly simple procedure. I want to sort a data frame by a specified character vector. So for : df.. <- data.frame(Season=rep(c("Summer","Fall","Winter","Spring"),4),Obs= runif(length(rep(c("Summer","Fall","Winter","Spring"),4)))) I want to sort the data frame