Displaying 20 results from an estimated 3000 matches similar to: "matrix problem"
2011 Feb 03
3
R Data Manipulation - Transposing Data by a Given Column, Like User_ID
Hello,
I'd like to transpose data to create an analysis-friendly dataframe. See
below for an example, I was unable to use t(x) and I couldn't find a
function with options like PROC TRANSPOSE in SAS.
The ideal solution handles variable quantities of SITE - but beggars can't
be choosers. :-)
Thank you in advance,
Mike
## INPUT DATA
USER_ID<-c(1,1,1,2,2,2,3,3,4)
SITE
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 advance,
Marcio
--
View this message in context:
2009 Feb 16
4
assuming AR(1) residuals in OLS
Hi to all,
In other statistical software, such as Eviews, it is possible to
regress a model with the Least Squares method, assuming that the
residuals follow an AR(q) process.
For example the resulting regression is something like
y = 1.2154 + 0.2215 x + 0.251 AR(1)
How is it possible to do the same in R?
Thank you very much in advance,
Constantine Tsardounis
http://www.costis.name
2010 May 06
5
frequency
Dear list,
Im trying to do the following operation but im not able to do it
This is my table:
1 2 3
1 0 7 4
2 0 2 0
3 0 1 3
4 0 3 4
what i would like to do is
divide each row values with the corresponding column' sum,namely:
1 2 3
1 0 0.54 0.36
2 0 0.15 0
3 0 0.08
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 that that wasn't a
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. specifically to
transpose a data frame:
siteid date
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
2005 Mar 03
2
reading row vectors from file
Hi,
New to R, using version 2.0.1 (2004-11-15) on debian Linux (sid), kernel
2.6.8-2-686.
I have data in files 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,...
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
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 can do this, is there any function in R can do
this?
--
View this
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/lambda
)
Unit: nanoseconds
expr min lq
2008 Jan 01
7
in_vertical_groups_of
Hi all,
Here''s another contribution for anyone interested.
In Railscast episode 28, Ryan Bates showed us in_groups_of which
allows you to group array members such as
>> list = [1, 2, 3, 4, 5, 6, 7]
=> [1, 2, 3, 4, 5, 6, 7]
>> list.in_groups_of(3)
=> [[1, 2, 3], [4, 5, 6], [7, nil, nil]]
This allows you to iterate over the groups and, for example, display
a list
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
2004 Feb 16
4
Matrix mulitplication
ABCD are four matrix.
A * Inverse((Transpose(A)*Tranpose(B)*B*A+C)) * Transpose(A) * Transpose(B) * D
how to write in R in an efficient way?
---------------------------------
[[alternative HTML version deleted]]
2009 Sep 27
3
Teach me how to transpose in R
Hi guys,
I need your help!!
My goal is to make a csv file from ncdf file.
This is the code i've used :
> hyo=open.ncdf("C:/CRUTEM3.nc")
> hyo
[1] "file C:/CRUTEM3.nc has 4 dimensions:"
[1] "longitude Size: 72"
[1] "latitude Size: 36"
[1] "unspecified Size: 1"
[1] "t Size: 1916"
[1] "------------------------"
2009 Aug 18
4
Transpose a dataset
Hi Everyone,
I have a dataset like this
mean sd 0% 25% 50%
75% 100% n
BODY TEMPERATURE 36.41099 0.4015699 35.1 36.22222 36.5
36.66667 37.1 89
DIASTOLIC BLOOD PRESSURE 73.60079 9.4656186 50.0 67.00000 73.0
80.00000 95.0 253
HEIGHT 171.94000 9.2011670 153.5 166.50000 173.0
176.25000 190.0
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
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:
simplevector <-matrix(1:3,3,1)
tsimplevector <-t(simplevector) #transposed
dim(simplevector)
2005 Dec 20
3
transpose a matrix?
I have a data set in the following format:
x<-data.frame(id=c(‘a’,’b’,’c’),’2005-01-15’=c(100,225,425), ’2005-02-23’=c(1100,2325,4525))
> x
id X2005.01.15 X2005.02.23
1 a 100 1100
2 b 225 2325
3 c 425 4525
I want:
id
a
b
c
X2005.01.15
100
225
425
X2005.02.23
1100
2009 Nov 04
1
s4 generic issue
I'm hoping that someone with deeper insight into S4 than I,
that is to say virtually everyone reading this list, could help
resolve the following problem in SparseM. We have
setGeneric("backsolve",
function(r, x, k = NULL, upper.tri = NULL, transpose = NULL,
twice = TRUE, ...)
standardGeneric("backsolve"),
useAsDefault= function(r, x,