Displaying 20 results from an estimated 734 matches for "transpose".
2010 Jul 30
4
transpose of complex matrices in R
Hello everybody
When one is working with complex matrices, "transpose" very nearly
always means
*Hermitian* transpose, that is, A[i,j] <- Conj(A[j,i]).
One often writes A^* for the Hermitian transpose.
I have only once seen a "real-life" case
where transposition does not occur simultaneously with complex conjugation.
And I'm not 100% sure th...
2006 Jul 27
2
Vector extracted from a matrix. How can I specify dimensions in as.matrix?
Transpose vector extracted from a matrix
Hello,
I am doing a recursive analysis that uses every line (vector) of a matrix in
a loop. In the model, I need to transpose those vectors that are extracted
from a matrix.
Using simple vectors (no matrix involved) the transpose function works fine:
simplevecto...
2010 Dec 20
1
transposing panel data
I am currently trying to transpose some large panel data set ie transposing multiple rows in into a single column. instead the transpose functionality transposes all rows into columns. my sample data set looks like below:
ACCT_NUM
ACCOUNT_NAME
TRAN_AMT
DATE
EMPLOYER
101913
GK
7489
30-Apr-10
PENSI...
2012 Mar 20
2
Reshaping data from long to wide without a "timevar"
Hello All,
I was wondering if it's possible to reshape data from long to wide in R without using a "timevar". I've pasted some sample data below along with some code. The data are sorted by Subject and Drug. I want to transpose the Drug variable into multiple columns in alphabetical order.
My data have a variable called "RowNo" that functions almost like a "timevar" but not quite. In Subject 6, Erlotinib has a RowNo value of 3 whereas Paclitaxel has a RowNo value of 2. So if I use reshape as in the f...
2003 Sep 29
4
Data frame transpose
Hi All,
I want to ask if there is a transpose function for data frame like the
procedure of transpose in SAS? Because I want to partially transpose a
data frame which contains 5 columns (siteid, date, time, obs, mod), what
I want to do is to put time as the column variables along with siteid,
and date, and put obs and mod in the row names. spe...
2009 Jul 10
4
how to transpose a dataframe
I want to transpose a dataframe like
level 2006 2007 2008
A ....
B .....
C ........
into
level year
A 2006
A 2007
A 2008
B 2006
B 2007
......
There is a procedure in SAS c...
2009 Sep 28
6
SAS user now converting to R - Help with Transpose
I am just starting to code in R and need some help as I am used to doing this
in SAS.
I have a dataset that looks like this:
Chemical Well1 Well2 Well3 Well4
BOD 13.2 14.2 15.5 14.2
O2 7.8 2.6 3.5 2.4
TURB 10.2 14.6 18.5 17.3
and so on with more chemicals....
I would like to transpose my data so that it looks like this:
Chemical WellID Value
BOD Well1 13.2
BOD Well2 14.2
BOD Well3 15.5
BOD Well4 14.2
O2 Well1 7.8
O2 Well2 2.6
.... and so on
In sas I would code it like this:
proc sort data=ds1; by chemical; run;
Proc Transpose data=ds1 out=ds2;
by chemical;
var Well1 Well2 Well3...
2008 Apr 15
2
Transposing Data Frame does not return numeric entries
...ot; 0" "0" ...
- attr(*, "dimnames")=List of 2
..$ : chr [1:193] "X" "upwd1201" "upwd0502" "upwd0702" ...
..$ : NULL
x is a data frame with a whole bunch of numeric vectors I would like for the
rows and columns to be reversed == transposed but with the same attributes.
I am trying to feed the transposed data frame to metaMDS(vegan). I am
stumped- sorry for the large attached file- I am at a loss.
Stephen Sefick
--
Let's not spend our time and resources thinking about things that are so
little or so large that all they reall...
2005 Mar 03
2
reading row vectors from file
...iles with separate vectors on each row of the file,
e.g.,
$ cat /tmp/stats
freq,0,1,2,3,4,5,6,7,8,9,16,17,18,19,20,...
noise,49,47,48,48,50,47,48,47,46,50,48,54,49,47,49,...
signal,99,0,100,0,0,100,0,100,100,0,100,101,100,0,0,...
pctrcv,5,0,5,0,0,5,0,5,11,0,5,5,5,0,0,...
I can transpose the data file (e.g., using an awk script), and then read
it using read.csv("tstats"),
$ transpose /tmp/stats > /tmp/tstats
$ cat /tmp/tstats
freq,noise,signal,pctrcv
0,49,99,5
1,47,0,0
2,48,100,5
...
but would prefer to import the line-oriented files direc...
2010 Dec 20
2
package "arules" - 'transpose' of the transactions
Suppose this is my list of transactions:
set.seed(200)
tran=random.transactions(100,3)
inspect(tran)
items transactionID
1 {item80} trans1
2 {item8,
item20} trans2
3 {item28} trans3
I want to get the 'transpose' of the data, i.e.
transactionID items
1 {trans2} item8
2 {trans2} item20
3 {trans3} item28
4 {trans1} item80
I tried converting tran into a matrix, then transpose it, then convert it
back to transactions. But my dataset is actually very very large, so I
wonder...
2024 Feb 29
2
[External] converting MATLAB -> R | element-wise operation
I decided to do a direct comparison of transpose and sweep.
library(microbenchmark)
NN <- matrix(c(1, 2, 3, 4, 5, 6), nrow = 2, byrow = TRUE) # Example matrix
lambda <- c(2, 3, 4) # Example vector
colNN <- t(NN)
microbenchmark(
sweep = sweep(NN, 2, lambda, "/"),
transpose = t(t(NN)/lambda),
colNN = colNN/lam...
2010 Jun 29
2
transposing a data frame from horizontal to vertical (stacking)
...k you very much!
MyData<-data.frame(names=c("John","Mary","Paul","Debby"),jan=c(10,15,20,25),feb=c(1,2,3,4))
(MyData)
months<-names(MyData)[-1]
people<-as.character(MyData[[1]])
### Creating a temp matrix with people as columns and months as rows:
transposed<-apply(MyData[-1],1,t)
### Putting vertical data (months as rows) - for each person - into a list:
list.of.stacked<-list()
for(i in 1:ncol(transposed)){
list.of.stacked[[i]]<-as.data.frame(matrix(ncol=3,nrow=length(months)))
names(list.of.stacked[[i]])<-c("month","val...
2009 Sep 27
3
Teach me how to transpose in R
...=get.var.ncdf(hyo)
> write.csv(data2,file="C:/ple.csv")
But the problem is, I expected this data would be 17000 * 72 (row* col) ;
but, it is the other way around. 72*17000
Because the maximum col number in excel is 16383, this cvs file doesn't show
all data. Obviously, I need to transpose the matrix..
I tried to use transpose function but failed.
> bbb=t(data2)
Error in t.default(data2) : argument is not a matrix
> ccc=t(hyo)
> ccc
[1] "file has dimensions:"
Error in if (nc$ndims > 0) for (i in 1:nc$ndims) { :
argument is of length zero
Teach me how to de...
2011 Jul 25
1
Ouch - brown, hansen error
Hi
I'm trying to use ouch's hansen and brown functions but I get the error:
> brown(logflatnodes,archotreeouch)
Error in backsolve(l, x, k = k, upper.tri = upper.tri, transpose =
transpose) :
NA/NaN/Inf in foreign function call (arg 1)
and with hansen also:
Error in optim(par = c(sqrt.alpha, sigma), fn = function(par) { :
function cannot be evaluated at initial parameters
I'm not sure what I'm supposed to put in the sqrt.alpha and sigma
parameters. I ha...
2009 Feb 24
2
Transpose array
Hi Listers,
Is there a way that I can transpose an array...
Suppose I have the following array...
x<-array(c(1,2,3,4),dim=c(1,2,2))
, , 1
[,1] [,2]
[1,] 1 2
, , 2
[,1] [,2]
[1,] 3 4
And I would like to get the following result...
, , 1
[,1]
[1,] 1
[,2] 2
, , 2
[,1] [,2]
[1,] 3
[,2] 4
Thanks in a...
2009 Aug 18
4
Transpose a dataset
...176.25000 190.0 20
PULSE RATE 67.48221 11.7657645 40.0 60.00000 68.0
75.00000 97.0 253
SYSTOLIC BLOOD PRESSURE 131.91700 14.4986667 97.0 122.00000 132.0
140.00000 185.0 253
WEIGHT 85.17079 17.3150434 57.3 70.90000 83.1
100.00000 122.5 89
now i want to transpose this dataset like
BODY TEMPERATURE mean 36.41099
sd 0.4015699
0% 35.1
25% 36.222
50% 36.5
75% 36.667
100% 3...
2009 May 15
2
transposing/rotating XY in a 3D array
...by:
array(x, c(2,3,2))
because breaks the structure (e.g. 1,3,5 is type mismatch)
array(1:12,c(2,3,2))
, , 1
[,1] [,2] [,3]
[1,] 1 3 5
[2,] 2 4 6
...
Of course following R's indexing order (rowIndex is the fastest)
retains the structures, but X and Y dimensions are transposed. (note, c
(2,3,2) => (3,2,2))
array(1:12, c(3,2,2))
, , 1
[,1] [,2]
[1,] 1 4
[2,] 2 5
[3,] 3 6
Its like converting into Japanese vertical reading.
It is not that I cannot get used to it, but I guess it is less error
prone if I have the same order as in the data files....
2008 Aug 25
3
Maintaining repeated ID numbers when transposing with reshape
I have a dataset in "long" format that looks something like this:
ID TEST RESULT
1 A 17
1 A 12
1 B 15
1 C 12
2 B 8
2 B 9
Now what I would like to do is transpose it like so:
ID TEST A TEST B TEST C
1 17 15 12
1 12 . .
2 . 8 .
2 . 9 .
When I try:
reshape(mydata, v.names="result", idvar="id",timevar="tes...
2000 Nov 07
1
matrix transpose and object name
hello, everybody,
i have several unresolved issues:
1. how to do a matrix transpose? i cant find how to do it in the
documentation.
2..suppose i have an object named as lm1 from linear regression, how could
i refer to it by paste("lm",1,sep="") ?
3. to save a matrix 100 x 30, how to have a text file with 100 lines and 30
cols, instead of stacking them?
thanks....
2006 May 09
1
transposing a big data file
I HAVE A VERY BIG DATA OF 67 COLMS AND 25000 ROWS
AND WOULD LIKE TO TRANSPOSE IT THE R HELP WAS NOT ENOUGH INFORMATION
BECOUSE I AM NOT A PROGRAMMER AND FIRST TIME R USER.
SO CAN YOU GIVE SOME HINTS OF CODING,
AA TT GG GG CC AA TT GG GG CC AA TT GG GG CC AA TT GG GG CC AA TT GG GG
CC
TO
AA AA AA AA AA TT TT TT TT TT GG GG GG GG GG GG GG GG GG GG CC CC CC CC
CC
[[...