Displaying 20 results from an estimated 4000 matches similar to: "Maintaining repeated ID numbers when transposing with reshape"
2010 Apr 23
6
transpose? reshape? flipping? challenge with data frame
Greetings all,
I am having difficulty transposing, reshaping, flipping (not sure which) a data frame which is read from a DBF file. I have tried using t(), reshape() and other approaches without success. Can anyone please suggest an way (elegant or not) of flipping this data around ?
The initial data is like propsum (defined below), and I want it to look like tpropsum once reformed.
>
2010 Mar 06
1
transposing data
Hi. I have repeated measures data of the form where each observation
is a trial, and trials are grouped by subject, and variables encode
whatever level of a factor was present during that trial, and the
dependent variable is response time (RT). I want to transpose the
data to a form suitable for MANOVA such that there is one observation
per subject and RT is recoded across many
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
2013 Oct 17
1
Reshape
Hello,
I have data frame like the one created below,
##input data
Person <- c(1,1,1,1,1,1,2,2)
Amount <- c(100,10,100,10,100,10,50,150)
Date <- c("12/01/2012", "12/01/2012", "01/01/2013","01/01/2013","02/01/2013","02/01/2013","12/01/2012","12/01/2012")
df <- data.frame(Person,Amount,Date)
I would
2008 Feb 14
3
Transposing by a group variable
Hi R,
Can I transpose a data frame by a particular group variable?
For example:
d=data.frame(group=c(1,1,2,2,2),val=c(6,4,6,3,5))
And my output should be:
data.frame(group=c(1,2),v1=c(6,6),v2=c(4,3),v3=c(NA,5))
Many thanks,
Shubha
This e-mail may contain confidential and/or privileged i...{{dropped:13}}
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 Dec 09
1
reshape() makes R run out of memory (PR#14121)
Full_Name: Alexander L. Belikoff
Version: 2.8.1
OS: Ubuntu 9.04 (x86_64)
Submission from: (NULL) (67.244.71.200)
I'm trying to reshape the following data frame:
ID DATE1 DATE2 VALUE_TYPE VALUE
'abcd1233' 2009-11-12 2009-12-23 'TYPE1' 123.45
...
VALUE_TYPE is a string and is a factor with only 2 values
2007 Jun 25
2
transposing data.frames
Hello,
This must be simple...
Thanks a lot
- Christoph
# Imagine you have a list, e.g:
K <- list(1:10, 2:11, 9:18)
K
# Transforming to dataframe...
KK <- as.data.frame(K)
# ... one obtaines the list elements as column.
KK
# But I need the list elements as rows
# How can I achieve this? Is there a simple way to transpose
data.frames?
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
[[alternative HTML
2005 Jul 18
5
colnames
Hi,
I have a matrix with column names starting with a character in [0-9]. After some matrix operations (e.g. copy to another matrix), R seems to add a character 'X' in front of the column name. Is this a normal default behaviour of R? Why has it got this behaviour? Can it be changed? What would be the side effect?
Thank you.
Regards,
Gilbert
[[alternative HTML version deleted]]
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
PENSION
101913
GK
7489
30-May-10
PENSION
101913
2008 Apr 15
2
Transposing Data Frame does not return numeric entries
x <- read.table("LittleGarvin.csv", sep=",", header=TRUE)
y <- t(x)
str(y)
chr [1:193, 1:288] "oligocha" "0" " 0" " 0" " 0" "0" ...
- attr(*, "dimnames")=List of 2
..$ : chr [1:193] "X" "upwd1201" "upwd0502" "upwd0702" ...
..$ : NULL
x is a data frame with
2009 May 15
2
transposing/rotating XY in a 3D array
Dear list,
We have a number of files containing similarly structured data:
file1:
A B C
1 2 3
4 5 6
file2:
A B C
7 8 9
10 11 12
... etc
My part of R receives all these data as an array: 1,2,3... 12 together
with info about dimensions (row,col,fileN) . (
Converting the data into 3D cannot simply done by:
array(x, c(2,3,2))
because breaks the structure (e.g. 1,3,5 is type mismatch)
2002 Nov 01
1
Reshape function
Can someone help me with the proper usage of the
reshape function?
Let's say I have a dataset with columns like this
(wide format):
Id Sex Group Test Day1 Day 2 Day 3...
And I want to transpose this into something like this
(thin):
Id Sex Group Test Time
Where the new column labeled time contains all the
time variables (Day 1, Day 2, Day 3...) that were in
the wide
2010 Oct 29
1
transposing a column table
Dear R-user,
I need help on how to transpose this column of clustering vector in R with 8768 entries derived from a PAM clustering output in a vertical view to an excel file
Clustering vector:
[1] 1 1 2 2 1 2 1 2 1 1 2 2 1 2 2 2 2 1 1 1 1 2 2 1 2 2 1 2 2 2 2 2 2 2 2 1 2
[38] 2 1 1 2 2 2 2 2 1 2 1 2 2 2 2 1 2 1 2 2 1 2 2 2 2 2 2 1 2 1 2 2 2 1 1 2 2
[75] 2 1 2 2 2 2 2 2 2 1 1 2 1 2 2 2 2 2
2010 Jan 15
4
transposing a list of vectors
I have a list of vectors, all forced to be the same length:
testlist <- list(
shape=c(0, 0, 2),
cell.fill=c("red","blue","green"),
back.fill=rep("white",3),
scale.max=rep(100,3)
)
> str(testlist)
List of 4
$ shape : num [1:3] 0 0 2
$ cell.fill: chr [1:3] "red" "blue" "green"
$ back.fill: chr [1:3]
2009 Dec 04
0
simple reshape of a large data frame (reshape() runs out of memory)
Hello everyone,
I'm having a problem performing reshape() on a large data frame. The
operation is fairly trivial but it makes R run out of memory.
The data frame has the following structure:
ID DATE1 DATE2 VALTYPE
VALUE
'abcd1233' 2009-11-12 2009-12-23 'TYPE1'
123.45
...
VALTYPE is a string and is a factor with
2008 Jul 23
4
Using PrettyR to produce LaTeX output
Hello everyone. I am new to R, so please bear with me. I am trying to find
an easy way to export descriptive statistics and other information about my
data frame to a LaTeX format.
I have found the describe function in PrettyR to be very helpful in
producing results in the exact format I'm looking for. However, the value
of the describe function is a LIST (rather than a data frame) which I
2009 Oct 04
2
Row to Column help
Dear R Community,
I am attempting to transpose a dataset from rows to columns but am stuck. I
have tried using reshape() with little luck, possibly due to the categorical
nature of the data. For example:
id<-c(1,2,2,3,3,3)
author<-c("j","k","k","l","l","l")
2010 Jun 29
2
transposing a data frame from horizontal to vertical (stacking)
Hello, everyone!
I have a very simple task - I have a data frame (see MyData below) and
I need to stack the data (see result below).
I wrote the syntax below - it's very basic and it does what I need.
But I am sure what I am trying to do is a very typical task and there
must be a much shorter/more elegant way of doing it.
Any advice?
Thank you very much!