similar to: Matrix problem

Displaying 20 results from an estimated 40000 matches similar to: "Matrix problem"

2004 Jul 08
2
Getting elements of a matrix by a vector of column indice s
See if the following helps: > m <- outer(letters[1:5], 1:4, paste, sep="") > m [,1] [,2] [,3] [,4] [1,] "a1" "a2" "a3" "a4" [2,] "b1" "b2" "b3" "b4" [3,] "c1" "c2" "c3" "c4" [4,] "d1" "d2" "d3" "d4" [5,]
2009 Mar 20
4
how to make aggregation in R ?
Hi, I am trying to aggregate the sum of my test data.frame as follow: testDF <- data.frame(v1 = c("a", "a", "a", "a", "a", "b", "b", "b", "b", "b", "c", "c", "c", "c", "c", "d", "d", "d", "d",
2005 Aug 15
2
queer data set
I have a dataset that is basically structureless. Its dimension varies from row to row and sep(s) are a mixture of tab and semi colon (;) and example is HEADER1 HEADER2 HEADER3 HEADER3 A1 B1 C1 X11;X12;X13 A2 B2 C2 X21;X22;X23;X24;X25 A3 B3 C3 A4 B4 C4 X41;X42;X43 A5 B5 C5 X51 etc., say. Note that a blank
2005 Jun 03
2
rearrange data
Dear all: I have this: A1 B1 C1 D1 E1 A2 B2 C2 D2 E2 A3 B3 C3 D3 E3 And I want this A1 E1 B1 E1 C1 E1 D1 E1 A2 E2 B2 E2 C2 E2 D2 E2 A3 E3 B3 E3 C3 E3 D3 E3 Example: m<- matrix(1:15,nrow=3,byrow=T) m v<- unlist(list(t(m[,1:4]))) u<- rep(c(5,10,15),c(4,4,4)) data.frame(v,u) This is the result I want but I would like to learn a simpler way to do it. Any clue?
2012 Apr 19
3
How to "flatten" a multidimensional array into a dataframe?
Hi, I have a three dimensional array, e.g., my.array = array(0, dim=c(2,3,4), dimnames=list( d1=c("A1","A2"), d2=c("B1","B2","B3"), d3=c("C1","C2","C3","C4")) ) what I would like to get is then a dataframe: d1 d2 d3 value A1 B1 C1 0 A2 B1 C1 0 . . . A2 B3 C4 0 I'm sure there is one function to do
2011 Mar 05
2
Repeating the same calculation across multiple pairs of variables
Hi all, I frequently encounter datasets that require me to repeat the same calculation across many variables. For example, given a dataset with total employment variables and manufacturing employment variables for the years 1990-2010, I might have to calculate manufacturing's share of total employment in each year. I find it cumbersome to have to manually define a share for each year and
2005 Apr 20
1
newby trying to solve a system
Dear R-gurus, being very new to R, (as well as lazy and not too smart !) I have some problems (and get lost in the docs) trying to write something to find the 9 values (A1,B1,C1,A2,B2,C2....C3) which are solutions of a 12 equations system of the form : > x1-(A1/(A1+B1+C1)) = 0 > y1-(B1/(A1+B1+C1))= 0 > z1-(C1/(A1+B1+C1)) = 0 > 3 same equations with subscript 2 > 3 same
2013 Feb 23
1
how to calculate left kronecker product?
For an application, I have formulas defined in terms of a left Kronecker product of matrices, A,B, meaning A \otimes_L B = {A * B[i,j]} -- matrix on the left multiplies each element on the right. The standard kronecker() function is the right Kronecker product, A \otimes_R B = {A[i,j] * B} -- matrix on the right multiplies each element on the left. The example below shows the result of
2009 Oct 06
1
linear model with coefficient constraints
I would like to perform a regression like the one below: lm(x ~ 0 + a1 + a2 + a3 + b1 + b2 + b3 + c1 + c2 + c3, data=data) However, the data has the property that a1+a2+a3 = A, b1+b2+b3 = B, and c1+c2+c3 = C, where A, B, and C are positive constants. So there are two extra degrees of freedom, and R handles this by producing NA for two of the coefficients. Instead, I would prefer to remove the
2007 Jul 12
1
how to estimate treatment-interaction contrasts
Hello, R experts, Sorry for asking this question again again since I really want a help! I have a two-factor experiment data and like to calculate estimates of interation contrasts say factor A has levels of a1, a2, and B has levels of b1, b2, b3, b4, and b5 with 3 replicates. I am not sure the constrast estimate I got is right using the script below:
2017 Aug 07
3
AliasAnalysis: may-alias subcategory
There are function which does have optimization opportunities but because of may-alias memory dependencies sometimes optimization is not effective. May be runtime checks kills the gains of optimization. For such cases aiming to do interprocedural function specialization optimization where in the clone function version no-alias assumption can be assumed and the original function version will hold
2005 May 31
2
help
Dear all:   I have this:  A1 B1 C1 D1 E1 A2 B2 C2 D2 E2 A3 B3 C3 D3 E3   And I want this A1 E1 B1 E1 C1 E1 D1 E1 A2 E2 B2 E2 C2 E2 D2 E2 A3 E3 B3 E3 C3 E3 D3 E3   Example:   m<- matrix(1:15,nrow=3,byrow=T) m v<- unlist(list(t(m[,1:4]))) u<-
2010 Feb 04
2
Filling a logical matrices with values
Hello !! I have this problem: A matrix on True/False and as many numerical vectors as columns, but of different length. What I 'd like to get is this: set.seed(12) > dat <- as.data.frame(matrix(as.logical(sample(T:F, 30, T)),5,6)) > colnames(dat) <- letters[1:6] > rownames(dat) <- paste(letters[1:5],1:5, sep="") > dat a b c d e f a1
2009 Jun 23
3
More continuing text for tables
Hello List, While translating documents in markdown, I've noticed that it is often necessary to continue table cell text on the following line, especially when limited to a narrow column, and especially in table headers. Unfortunately, this is impossible with the existing table syntax, which interprets each new line as a new table row. I see that David Wheeler proposed a syntax for a text
2004 Nov 28
1
Could anyone help me reshape this "wide" data into "longitudinal" one? Thanks
Dear R people, I have a matrix like this: var1 var2 var3 var4 a1 7.1 7.2 8.1 8.2 a2 10.5 10.6 ... ... a3 b1 b2 b3 b4 c1 c2 ... The matrix row names are "a1", "a2", ...... and the matrix column names are "var1", "var2", "var3" and "var4". Now I want to reshape this data into a
2009 May 18
9
Concatenating two vectors into one
Dear users, a very simple question: Given two vectors x and y x<-as.character(c("A","B","C","D","E","F")) y<-as.factor(c("1","2","3","4","5","6")) i want to combine them into a single vector z as A1, B2, C3 and so on. z<-x*y is not working, i tried several others
2007 Sep 04
2
Recursive concatenation
Colleagues, I want to create the following array: "A1", "A2", "A3", "B1", "B2", "B3", "C1", "C2", "C3" I recall that there is a trick using "c" or "paste" permitting me to form all combinations of c("A", "B", "C") and 1:3. But, I can't recall the
2012 Mar 29
2
How to improve, at all, a simple GLM code
Hi There, I am trying to fit a logit model to some data in a CSV file in R. Here is my code: Prepared_Data = read.csv("Prepared_Data.csv", header=TRUE) Prepared_Data attach(Prepared_Data) lrfit<-glm(C3~A1*B2*D4*E5,family = binomial) anova(lrfit, test="Chisq") write.csv(anova(lrfit, test="Chisq"), file="CWModelA.csv") shell.exec("CWModelA.csv")
2007 Jul 31
5
extract columns of a matrix/data frame
Hello all, I have a matrix whose column names look like a1 a2 b1 b2 b3 c1 c2 1 2 3 7 1 3 2 4 6 7 8 1 4 3 Now, I can have any number of a's. not just two as shown above and same goes for b's and c's. I need to extract all the a's columns and put them in another matrix, extract all b's columns and put them in some matrix
2010 Feb 09
2
How can I rearange my dataframe
An embedded and charset-unspecified text was scrubbed... Name: ??????????? URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20100209/db12d14b/attachment.pl>