Question: (Closed) matrix transpose in R
0
gravatar for F
3.4 years ago by
F3.1k
Iran
F3.1k wrote:

hi friends,

using some commands i normalized an array with mas5, may you please tell me exactly with which commands i can transpose the produced matrix. text file in R???

for example i changed the directory to where i saved my produced file, opened R and typed:
> t()
Error in t.default() : argument "x" is missing, with no default

 

r microarray mas5 affy • 3.3k views
ADD COMMENTlink modified 3.4 years ago by Devon Ryan86k • written 3.4 years ago by F3.1k
1

Hello sarah!

We believe that this post does not fit the main topic of this site.

This is solely programming question and belongs to stack overflow. Or you can simply solve it yourself by typing ?t and reading the documentation.

For this reason we have closed your question. This allows us to keep the site focused on the topics that the community can help with.

If you disagree please tell us why in a reply below, we'll be happy to talk about it.

Cheers!

ADD REPLYlink modified 3.4 years ago • written 3.4 years ago by PoGibas4.7k

ok as you order!!

ADD REPLYlink written 3.4 years ago by F3.1k

............

ADD REPLYlink modified 3.4 years ago • written 3.4 years ago by F3.1k
3
gravatar for Deepak Tanwar
3.4 years ago by
Deepak Tanwar3.9k
ETH Zürich, Switzerland
Deepak Tanwar3.9k wrote:

Sarah,

To transpose a matrix, the function is t()

suppose your matrix is saved in an object matrix

# transposing a matrix

transpose_matrix <- t(matrix)
ADD COMMENTlink modified 3.4 years ago • written 3.4 years ago by Deepak Tanwar3.9k

hi Deepak,

i had a file,

first i normalized GSE33964, with below commands

library(affy)

library(methods)

inFilePattern = "*CEL.gz"

outFilePath = "GSE33964.matrix"

fileNames = list.files(pattern=glob2rx(inFilePattern))

rawData = ReadAffy(filenames=fileNames)

eset <- mas5(rawData)

write.exprs(eset, file=outFilePath, col.names=NA)

now i have a file containing NA...

i typed these codes to transpose that but no new file was produced or no changed i saw in primary file. then where is transposed matrix please or if i did right?

changedir

GSE33964_new <- t(GSE33964)
> GSE33964 <- matrix(1:30, 5, 6)
> tGSE33964 <- t(GSE33964) ##-- i.e., GSE33964[i, j] == tGSE33964[j, i] for all i,j :
> for(j in seq(ncol(a)))
+ if(! all(GSE33964[, j] == tGSE33964[j, ])) stop("wrong transpose")
> transpose_GSE33964 <- t(GSE33964)

ADD REPLYlink written 3.4 years ago by F3.1k
2
gravatar for Devon Ryan
3.4 years ago by
Devon Ryan86k
Freiburg, Germany
Devon Ryan86k wrote:

t() is correct, but you (A) have to have the matrix loaded and (B) tell t() what it is. For example, if your matrix is named m, then, m_new <- t(m).

ADD COMMENTlink modified 3.4 years ago • written 3.4 years ago by Devon Ryan86k
Please log in to add an answer.
The thread is closed. No new answers may be added.

Help
Access

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 2.3.0
Traffic: 1360 users visited in the last hour