Hi Allaisone,
If you want a data frame as the output you will have to put up with a
few NA values unless each Customer has the same number of diet types:
a1df<-read.table(text="CustomerIDDietType
1 a
1c
1b
2
It depends quite strongly on what you want to do with the result, but I wonder
if what is really needed might be a list of diettypes per person, i.e.
continuing from Eric's code
> On 25 Feb 2018, at 18:56 , Eric Berger wrote:
>
> Hi Allaisone,
> I took a slightly
Hi Allaisone,
I took a slightly different approach but you might find this either as or
more useful than your approach, or at least a start on the path to a
solution you need.
df1 <-
data.frame(CustId=c(1,1,1,2,3,3,4,4,4),DietType=c("a","c","b","f","a","j","c","c","f"),
I believe you need to spend time with an R tutorial or two: a data frame
(presumably the "table" data structure you describe) can *not* contain
"blanks" -- all columns must be the same length, which means NA's are
filled in as needed.
Also, 8e^5 * 7e^4 = 5.6e^10, which almost certainly will not
f Bogdan
> > Tanasa
> > Sent: Monday, July 3, 2017 9:22 AM
> > To: r-help <r-help@r-project.org>
> > Subject: [R] reshaping the data
> >
> > Dear all,
> >
> > I would appreciate please a piece of help regarding the use of
> acast/dcas
r-help-boun...@r-project.org] On Behalf Of Bogdan
> Tanasa
> Sent: Monday, July 3, 2017 9:22 AM
> To: r-help <r-help@r-project.org>
> Subject: [R] reshaping the data
>
> Dear all,
>
> I would appreciate please a piece of help regarding the use of acast/dcast
> fun
Hi Bogdan,
If you want something like this:
22M 17M 11M
AEBP1 SNV SNV NA
ATR INDEL NA NA
ATR SNV NANA
BTKNA NA SNV
BTK NA NA INDEL
You're in trouble with repeated row names. Same with column names
Dear all,
I would appreciate please a piece of help regarding the use of acast/dcast
functions in reshape2 package.
Specifically, I'm working with a data frame, that has information about
SAMPLE, GENE, and TYPE of MUTATION (as shown below):
SampleGene Type
22M AEBP1 SNV
17M
3:45 AM
> To: r-help@r-project.org
> Subject: [R] Reshaping from long to wide with duplicate idvar and timevar
>
> Hi,
>
> I would like to reshape a data.frame from long to wide format. However, the
> reshape function does not seem to accept data containing rows with
> dup
Hi,
I would like to reshape a data.frame from long to wide format. However, the
reshape function does not seem to accept data containing rows with duplicate
idvar and timevar. Building upon the ?reshape example:
summary(Indometh)
wide <- reshape(Indometh, v.names = "conc", idvar = "Subject",
From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of David L
> Carlson
> Sent: Monday, November 28, 2016 8:27 PM
> To: jean-philippe <jeanphilippe.fonta...@gssi.infn.it>; r-help@r-project.org
> Subject: Re: [R] reshaping a large dataframe in R
>
> There may be a simpl
On 11/28/2016 1:06 AM, jean-philippe wrote:
dear all,
I have a dataframe of 500 rows and 4004 columns that I would like to
reshape to a dataframe of 500500 rows and 4 columns. That is from this
dataframe:
V1 V2 V3 V4 ... V4001 V4002 V4003 V4004
1 2 3 4 ... 4001 4002 4003 4004
1 2 3 4 ...
David L Carlson
Department of Anthropology
Texas A University
College Station, TX 77840-4352
-Original Message-
From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of jean-philippe
Sent: Monday, November 28, 2016 3:07 AM
To: r-help@r-project.org
Subject: [R] reshaping a
dear all,
I have a dataframe of 500 rows and 4004 columns that I would like to
reshape to a dataframe of 500500 rows and 4 columns. That is from this
dataframe:
V1 V2 V3 V4 ... V4001 V4002 V4003 V4004
1 2 3 4 ... 4001 4002 4003 4004
1 2 3 4 ... 4001 4002 4003 4004
1 2 3 4 ... 4001 4002
I suggest you simplify your computing task by making this into three
distinct tasks:
1. get copies of the shapefiles on your computer. Do this outside of R.
Since this has two parts, i.e., downloading and unzipping, it will be
easier at first to do it outside of r. Then later you can figure out
Hi All,
I need to reshape an ESRI shape file: http://arnulf.us/PLZ and resp
http://www.metaspatial.net/download/plz.tar.gz
I found an instruction for T-SQL Server:
https://blog.oraylis.de/2010/05/german-map-spatial-data-for-plz-postal-code-regions/
How can I do this using R?
Kind regards
> Dénes Tóth
> on Tue, 22 Mar 2016 10:55:58 +0100 writes:
> Hi Martin,
> On 03/22/2016 10:20 AM, Martin Maechler wrote:
>>> >Dénes Tóth
>>> > on Fri, 18 Mar 2016 22:56:23 +0100 writes:
>> > Hi
Thanks all. This is interesting, and for what I am doing worthwhile and
helpful. I have to be careful in each operation whether a copy is made or not,
and knowing this allows me to test on small examples what any command will do
before I use,
Thanks again, I appreciate all the help. I will
Hi Martin,
On 03/22/2016 10:20 AM, Martin Maechler wrote:
>Dénes Tóth
> on Fri, 18 Mar 2016 22:56:23 +0100 writes:
> Hi Roy,
> R (usually) makes a copy if the dimensionality of an array is modified,
> even if you use this syntax:
> x <-
> Dénes Tóth
> on Fri, 18 Mar 2016 22:56:23 +0100 writes:
> Hi Roy,
> R (usually) makes a copy if the dimensionality of an array is modified,
> even if you use this syntax:
> x <- array(1:24, c(2, 3, 4))
> dim(x) <- c(6, 4)
> See also
Thanks for the info, but I will stay with regular R. Work -arounds for what I
want to do just took some thought and programming, I just didn’t know if R
copied the array or just manipulated indices, and given the size of the array
I am memory limited.
This gets into the old thing of
Roy,
I have implemented a Ruby Gem (SciCom) with exactly your use case in mind.
SciCom is based on Renjin, an R interpreter for the JVM. So, this reply is
about R, but not about GnuR. If this is not proper behavior, please let me
know. I´ve looked at the posting guidelines and it seems to be
Hi Roy,
R (usually) makes a copy if the dimensionality of an array is modified,
even if you use this syntax:
x <- array(1:24, c(2, 3, 4))
dim(x) <- c(6, 4)
See also ?tracemem, ?data.table::address, ?pryr::address and other tools
to trace if an internal copy is done.
Workaround: use
> On Mar 19, 2016, at 8:18 AM, Henrik Bengtsson
> wrote:
>
> On Fri, Mar 18, 2016 at 8:28 PM, Roy Mendelssohn - NOAA Federal
> wrote:
>> Hi Henrik:
>>
>> I want to do want in oceanography is called an EOF, which is just a PCA
>>
On Fri, Mar 18, 2016 at 8:28 PM, Roy Mendelssohn - NOAA Federal
wrote:
> Hi Henrik:
>
> I want to do want in oceanography is called an EOF, which is just a PCA
> analysis. Unless I am missing something, in R I need to flatten my 3-D matrix
> into a 2-D data matrix. I
Hi All:
I am working with a very large array. if noLat is the number of latitudes,
noLon the number of longitudes and noTime the number of time periods, the
array is of the form:
myData[noLat, no Lon, noTime].
It is read in this way because that is how it is stored in a (series) of netcdf
arrays are vectors stored in column major order. So the answer is: reindexing.
Does this make it clear:
> v <- array(1:24,dim=2:4)
> as.vector(v)
[1] 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
> v
, , 1
[,1] [,2] [,3]
[1,]135
[2,]246
Hi Henrik:
I want to do want in oceanography is called an EOF, which is just a PCA
analysis. Unless I am missing something, in R I need to flatten my 3-D matrix
into a 2-D data matrix. I can fit the entire 30GB matrix into memory, and I
believe I have enough memory to do the PCA by
> On Mar 18, 2016, at 2:56 PM, Bert Gunter wrote:
>
> However copying may occur anyway as part of R's semantics. Others will
> have to help you on that, as the details here are beyond me.
>
> Cheers,
> Bert
Hi Bert:
Thanks for your response. The only part I was
Thanks. That is what I needed to know. I don’t want to play around with some
of the other suggestions, as I don’t totally understand what they do, and don’t
want to risk messing up something and not be aware of it.
There is a way to read in the data chunks at a time and reshape it and put, it
On Fri, Mar 18, 2016 at 3:15 PM, Roy Mendelssohn - NOAA Federal
wrote:
> Thanks. That is what I needed to know. I don’t want to play around with
> some of the other suggestions, as I don’t totally understand what they do,
> and don’t want to risk messing up something
R always makes a copy for this kind of operation. There are some operations
that don't make copies, but I don't think this one qualifies.
--
Sent from my phone. Please excuse my brevity.
On March 18, 2016 2:28:35 PM PDT, Roy Mendelssohn - NOAA Federal
wrote:
>Hi
Hi
Isn't melt just what you want?
melt(mydt)
Petr
-Original Message-
From: r-help-boun...@r-project.org [mailto:r-help-bounces@r-
project.org] On Behalf Of Abraham Mathew
Sent: Tuesday, March 18, 2014 1:59 AM
To: r-help@r-project.org (r-help@r-project.org)
Subject: [R] Reshaping
I have the following data frame. Using the stringr package, I've attempted
to map the url's to some specific elements that are in each url. I then
used the reshape package to join two different data frames. The next step
is to transform the two columns in the mydt data frame (forester and
Hi Guys
I am trying to cast a data frame but not aggregate the rows for the
same variable.
here is a contrived example.
**input**
temp_df -
data.frame(names=c('foo','foo','foo'),variable=c('w','w','w'),value=c(34,65,12))
temp_df
names variable value
1 foow34
2 foow
Abhi,
In the example you give, you don't really need to reshape the data ... just
rename the column value to w.
Here's a different example with more than one category ...
tempdf - expand.grid(names=c(foo, bar), variable=letters[1:3])
tempdf$value - rnorm(dim(tempdf)[1])
tempdf
library(reshape)
, 9 Jun 2013 23:15:48 -0700
To: r-help@r-project.org
Subject: [R] reshaping a data frame
Hi Guys
I am trying to cast a data frame but not aggregate the rows for the
same variable.
here is a contrived example.
**input**
temp_df -
data.frame(names=c('foo','foo','foo'),variable=c('w','w
: Monday, June 10, 2013 2:15 AM
Subject: [R] reshaping a data frame
Hi Guys
I am trying to cast a data frame but not aggregate the rows for the
same variable.
here is a contrived example.
**input**
temp_df -
data.frame(names=c('foo','foo','foo'),variable=c('w','w','w'),value=c(34,65,12))
temp_df
@gmail.com
To: r-help@r-project.org r-help@r-project.org
Cc:
Sent: Monday, June 10, 2013 2:15 AM
Subject: [R] reshaping a data frame
Hi Guys
I am trying to cast a data frame but not aggregate the rows for the
same variable.
here is a contrived example.
**input**
temp_df -
data.frame(names=c
5
#Mary 4 0 0 0
A.K.
From: sylvain willart sylvain.will...@gmail.com
To: arun smartpink...@yahoo.com
Cc: R help r-help@r-project.org
Sent: Saturday, April 13, 2013 5:41 PM
Subject: Re: [R] Reshaping Data for bi-partite Network Analysis [SOLVED
Hello
I have a dataset of people spending time in places. But most people don't
hang out in all the places.
it looks like:
Input-data.frame(people=c(Marc,Marc,Joe,Joe,Joe,Mary),
+ place=c(school,home,home,sport,beach,school),
+ time=c(2,4,3,1,5,4))
Input
people
, 2013 5:03 PM
Subject: [R] Reshaping Data for bi-partite Network Analysis
Hello
I have a dataset of people spending time in places. But most people don't
hang out in all the places.
it looks like:
Input-data.frame(people=c(Marc,Marc,Joe,Joe,Joe,Mary),
+ place=c(school,home,home
Hello,
With the following the order of both rows and columns will be different
than the order of your example output, but the table is basically the same.
xtabs(time ~ people + place, data = Input)
Hope this helps,
Rui Barradas
Em 13-04-2013 22:03, sylvain willart escreveu:
Hello
I have
sylvain.will...@gmail.com
To: r-help r-help@r-project.org; sylvain willart
sylvain.will...@gmail.com
Sent: Saturday, April 13, 2013 5:03 PM
Subject: [R] Reshaping Data for bi-partite Network Analysis
Hello
I have a dataset of people spending time in places. But most people don't
hang out
-Original Message-
Here's the relevant portion of the as.table Help file:
But ... is an argument to table(), not to as.table; this part of the help file
is not referring to as.table.
The first argument to as.table is x, which is an 'arbitrary R object'. as.table
is a generic; it
as.table(dat1)
#Error in as.table.default(dat1) : cannot coerce to a table
You _can_ coerce to a matrix first:
as.table( as.matrix(dat1) )
S Ellison
***
This email and any attachments are confidential. Any use...{{dropped:8}}
Yes. My error was previously pointed out to me and there was further
offlist discussion. Maybe I should have kept it onlist, but I was
reticent about displaying my stupidity. :( Mea Culpa.
Cheers,
Bert
On Thu, Apr 11, 2013 at 9:11 AM, S Ellison s.elli...@lgcgroup.com wrote:
-Original
Hello all,
I have data in the form of a table:
X Y1Y2
0.1 3 2
0.2 2 1
And I would like to transform in the form:
X Y
0.1 Y1
0.1 Y1
0.1 Y1
0.1 Y2
0.1 Y2
0.2 Y1
0.2 Y1
0.2 Y2
Any ideas how?
Thanks in advance,
IOanna
(res)
res
# X Y
#1 0.1 Y1
#2 0.1 Y1
#3 0.1 Y1
#4 0.1 Y2
#5 0.1 Y2
#6 0.2 Y1
#7 0.2 Y1
#8 0.2 Y2
A.K.
- Original Message -
From: IOANNA ii54...@msn.com
To: 'r-help-r-project.org' r-help@r-project.org
Cc:
Sent: Monday, April 8, 2013 8:09 AM
Subject: [R] Reshaping a table
Hello all
To: IOANNA
Cc: R help
Subject: Re: [R] Reshaping a table
Hi,
Try this:
dat1-read.table(text=
X Y1 Y2
0.1 3 2
0.2 2 1
,sep=,header=TRUE)
res-do.call(rbind,lapply(split(dat1,seq_len(nrow(dat1))),function(x)
{Y=rep(colnames(x)[-1],x[-1]); X=rep(x[,1],length(Y
about the problem.
A.K.
- Original Message -
From: Bert Gunter gunter.ber...@gene.com
To: arun smartpink...@yahoo.com
Cc: dcarl...@tamu.edu dcarl...@tamu.edu
Sent: Monday, April 8, 2013 1:33 PM
Subject: Re: [R] Reshaping a table
Thanks.
Here's the relevant portion of the as.table Help
Seems like this should be easy but I'm struggling a bit. How do I rearrange a
data frame to go from the first one to the second shown below ?
State Datelbs
TX 200701 400
TX 200702 650
TX 200703 950
TX 200704 1000
FL 200701 200
FL
What am I doing wrong ? Using the method you proposed on SLIGHTLY different
data.
head(x)
Region YearMon kg
AP 200701 290,311
AP 200702 322,671
AP 200703 216,600
AP 200704 450,711
AP 200705 245,215
AP 200706 212,492
j
Didn't try the other two methods as I spent a bit of time trying to learn
about reshape2. I was also able to melt the data and that went fine
(although based on your post, melting is not needed).
Any ideas on why reshape2 dcast is giving fits ?
--
View this message in context:
Could it be that my data is showing up as factors ?
class(x)
1] data.frame
str(x)
data.frame':284 obs. of 3 variables:
$ Region : Factor w/ 4 levels AP,EU,LA,..: 1 1 1 1 1 1 1 1 1 1 ...
$ YearMon: int 200701 200702 200703 200704 200705 200706 200707 200708 200709
200710 ...
$ kg :
Thanks Rui!
Anybody with ideas regarding filling _while_ binding data frames instead of
afterwards?
Ingmar
2012/8/22 Rui Barradas ruipbarra...@sapo.pt
Hello,
Your function doesn't seem to be very difficult to generalize.
d - read.table(text=
trg_type child_type_1
1 Scientists NA
2
On Aug 23, 2012, at 2:02 AM, Ingmar Schuster wrote:
Thanks Rui!
Anybody with ideas regarding filling _while_ binding data frames
instead of
afterwards?
Not sure what you mean by _while_ binding dataframes but the
original question seems answered by this sentence from the help file
Hi,
I have a data set with variables that are _not_ missing at random. Now I
use a package for learning a Bayesian Network which won't accept NA as a
value. From a database I query data.frames with k,k+n,k+2n, ... variables
(there are always at least k variables as leftmost columns). Using
Hello,
Your function doesn't seem to be very difficult to generalize.
d - read.table(text=
trg_type child_type_1
1 Scientists NA
2of used
, header=TRUE)
str(d)
subs_na - function(tok, na_factor_level = NOT_REALIZED, na_num = 9) {
ifac - which(sapply(tok, is.factor))
Wonderful! thanks, Rui!
AC
On Tue, Jul 24, 2012 at 10:01 PM, Rui Barradas ruipbarra...@sapo.pt wrote:
Hello,
Try the following.
# We are going to use this twice
sl - split(long, long$id)
# Remove groups with only one row
l2 - lapply(sl, function(x) if(nrow(x) 1) x)
l2 -
Hi,
I am trying to reshape data from a long to wide format but have a specific
task that I cannot get to output properly.
# SAMPLE DATA;
id - c(1,2,2,3,3,3)
time -c(0,0,5, 0, 2, 10)
x - rnorm(length(id))
long - data.frame(id,time,x)
# To reshape, I would like to exclude 'id' values that have NO
Hello,
Try the following.
# We are going to use this twice
sl - split(long, long$id)
# Remove groups with only one row
l2 - lapply(sl, function(x) if(nrow(x) 1) x)
l2 - do.call(rbind, l2)
l2
# Create a new variable
l3 - lapply(sl, function(x) cbind(x, NEW_VARIABLE=seq_len(nrow(x
l3 -
On 2012-07-24 22:01, Rui Barradas wrote:
Hello,
Try the following.
# We are going to use this twice
sl - split(long, long$id)
# Remove groups with only one row
l2 - lapply(sl, function(x) if(nrow(x) 1) x)
l2 - do.call(rbind, l2)
l2
# Create a new variable
l3 - lapply(sl, function(x)
Dear all,
I have a data frame with 2 columns and 102500 rows. The data looks like
below
V1V2
809811...
9099001100...
0023110011...
654511...
. .
. .
. .
. .
. .
I want to split the
Perhaps something like this:
x - c(11, 001100, 001001) # Test data
strsplit(x,) # See what strsplit does
do.call(rbind, strsplit(x,)) # Now combine the list elements nicely.
Incidentally, your question was grossly malformed, involving both
incomplete data and that in a non-reproducible
)
names(dat2)-c(V1,LETTERS[1:6])
dat2
V1 A B C D E F
1 8098 1 1 0 0 0 0
2 9099 0 0 1 1 0 0
3 0023 1 1 0 0 1 1
4 6545 1 1 1 1 1 1
A.K.
- Original Message -
From: efulas ef_u...@hotmail.com
To: r-help@r-project.org
Cc:
Sent: Saturday, June 9, 2012 6:21 AM
Subject: [R] Reshaping columns
Hello All,
Tried some more Internet searches and came to the conclusion that one probably
does need to create a timevar before reshaping from long to wide. Below is
some code that creates the timevar and transposes the data.
connection - textConnection(
005 1 Gemcitabine
005 2 Erlotinib
006 1
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
If I understand you right,
library(reshape2)
dcast(melt(TestData, id.var = Subject, measure.var = Drug), Subject ~ value)
Michael
On Tue, Mar 20, 2012 at 9:50 AM, Paul Miller pjmiller...@yahoo.com wrote:
Hello All,
I was wondering if it's possible to reshape data from long to wide in R
, Erlotinib. That's what I mean when I say
I want the columns in alphabetical order.
Thanks,
Paul
--- On Tue, 3/20/12, R. Michael Weylandt michael.weyla...@gmail.com wrote:
From: R. Michael Weylandt michael.weyla...@gmail.com
Subject: Re: [R] Reshaping data from long to wide without a timevar
Of Marco Guerzoni
Sent: Tuesday, March 13, 2012 10:51 AM
To: r-help@r-project.org
Subject: [R] reshaping a dataset for a network
dear all,
apologizes for bothering with a probably stupid question but I really
don' t know how to proceed.
I have a dataset which look like df
a- c(1,2,3,4,4,4,5,5)
b
Sent: Tuesday, March 13, 2012 10:51 AM
To: r-help@r-project.org
Subject: [R] reshaping a dataset for a network
dear all,
apologizes for bothering with a probably stupid question but I really
don' t know how to proceed.
I have a dataset which look like df
a- c(1,2,3,4,4,4,5,5)
b- c
13, 2012 10:51 AM
To: r-help@r-project.org
Subject: [R] reshaping a dataset for a network
dear all,
apologizes for bothering with a probably stupid question but I really
don' t know how to proceed.
I have a dataset which look like df
a- c(1,2,3,4,4,4,5,5)
b- c(11,7,4,9,8,3,12,4)
df-cbind(a,b)
I
Message-
From: Marco Guerzoni [mailto:marco.guerz...@unito.it]
Sent: Wednesday, March 14, 2012 1:02 AM
To: William Dunlap
Cc: r-help@r-project.org
Subject: Re: [R] reshaping a dataset for a network
Thank you fro the reply.
I managed to arrive till here, then I would like to have
, 2012 1:02 AM
To: William Dunlap
Cc: r-help@r-project.org
Subject: Re: [R] reshaping a dataset for a network
Thank you fro the reply.
I managed to arrive till here, then I would like to have it in matrix
where the $1 $2...$5 are the first column.
Il 3/13/2012 8:15 PM, William Dunlap ha scritto
dear all,
apologizes for bothering with a probably stupid question but I really
don' t know how to proceed.
I have a dataset which look like df
a - c(1,2,3,4,4,4,5,5)
b - c(11,7,4,9,8,3,12,4)
df -cbind(a,b)
I would like to have one which looks like this:
a
1 11
2 7
3 4
4 9 8 3
5 12 4
a are
Guerzoni
Sent: Tuesday, March 13, 2012 10:51 AM
To: r-help@r-project.org
Subject: [R] reshaping a dataset for a network
dear all,
apologizes for bothering with a probably stupid question but I really
don' t know how to proceed.
I have a dataset which look like df
a - c(1,2,3,4,4,4,5,5
Hello,
I have a large data set which I am trying to get in to a long/narrow format.
I have given an example below of how I want my data to look before and
after... any ideas for an easy way to do this?
*###Start With this...
*set.seed(1)
a=rnorm(10)
b=rnorm(10)
c=rnorm(10)
d=rnorm(10)
e=rnorm(10)
Hi,
I *think* this is what you want...
On Fri, Mar 2, 2012 at 12:29 PM, robgriffin247
robgriffin...@hotmail.com wrote:
Hello,
I have a large data set which I am trying to get in to a long/narrow format.
I have given an example below of how I want my data to look before and
after... any ideas
On 09/08/2011 12:02 AM, dadrivr wrote:
Hi,
I'm trying to reshape my data set from wide to tall format for multilevel
modeling. Unfortunately, the function I typically use (make.univ from the
multilevel package) does not appear to work with unbalanced data frames,
which is what I'm dealing
I have the following data (see RawData using dput below)
How do I get it in the following 3 column format (CO2 measurements are the
elements of the original data frame). I'm sure the package reshape is where
I should look, but I haven't figured out how.
Thanks ahead of time
Month Year CO2
Hi,
I'm trying to reshape my data set from wide to tall format for multilevel
modeling. Unfortunately, the function I typically use (make.univ from the
multilevel package) does not appear to work with unbalanced data frames,
which is what I'm dealing with.
Below is an example of the columns of
look at the melt function in reshape, specifically ?melt.data.frame
require(reshape)
Raw.melt-melt(RawData,id.vars='Year',variable_name='Month')
there is an additional feature in the melt function for handling na values.
names(Raw.melt)[3]-'CO2'
head(Raw.melt)
Year MonthCO2
1 1958 J
The terminology (melt, cast, recast) just isn't intuitive to me; but I
understand how to use melt now.
Thanks!
Justin Haynes wrote:
look at the melt function in reshape, specifically ?melt.data.frame
require(reshape)
Raw.melt-melt(RawData,id.vars='Year',variable_name='Month')
there
Dear,
I have a data frame melted from a list of matrices (melt from reshape
package), then I impute some missing values and then want to tabulate
the data again to the array (or list, doesn't matter) of matrices form.
However when using xtabs function it orders my rows alphabetically and
Dnia 2011-06-15, o godz. 12:05:01
Jim Lemon j...@bitwrit.com.au napisał(a):
On 06/15/2011 06:46 PM, filip.biele...@rega.kuleuven.be wrote:
Dear,
I have a data frame melted from a list of matrices (melt from
reshape package), then I impute some missing values and then want
to tabulate
Dear R users,
I have a problem with reshaping data. I know such questions have been asked
before, but I can't get it right, neither with the reshape function nor with
the melt function.
My dataset has about 407 variables and about 48000 cases.
Each case looks as follows:
V1 v2 v3
Can you provide a brief reproducible example for us to play with?
Scott
On Tuesday, May 17, 2011 at 12:31 PM, Stijn Van Daele wrote:
Dear R users,
I have a problem with reshaping data. I know such questions have been asked
before, but I can't get it right, neither with the reshape function
Hi:
Here's one way, using an abbreviated example:
du - data.frame(v1 = factor(rep(1:10, each = 4)),
v2 = factor(rep(rep(1:2, each = 2), 10)),
v3 = factor(rep(1:2, 20)),
x1 = rnorm(40),
y1 = rnorm(40),
x2 =
Hi-
Tabular data have been provided to me within .csv files. I need to transform
the data from tabular format into a dataframe with three
columns. The columns need to be the table row id, table column id, and the
tabulated variable. An example dataset can be downloaded here:
Hi all,
I have been struggling with this problem for a few days.
I have a data table like this:
gene rpkm1 diff1 rpkm2 diff2
gene1 23 50 13 120
gene2 111 220 827 1200
gene3
Try this:
reshape(x, direction = 'long', varying = list(c(2, 4), c(3, 5)), idvar =
'gene')
On Thu, Feb 24, 2011 at 3:19 PM, fbarreto fbarr...@ucsd.edu wrote:
Hi all,
I have been struggling with this problem for a few days.
I have a data table like this:
gene rpkm1
Hi Dennis,
Thanks for the answer, it works perfectly for two time intervals, but
if I add a third interval like this:
ID begin_t1end_t1 begin_t2end_t2
begin_t3end_t3
Thomas 11/03/0413/05/0604/02/07
$variable - NULL
dat.final - cast(m.dat, ... ~ begin.end)
Hope it helps,
Ista
--- On Mon, 7/19/10, Thomas Jensen thomas.jen...@eup.gess.ethz.ch wrote:
From: Thomas Jensen thomas.jen...@eup.gess.ethz.ch
Subject: [R] Reshaping data
To: R-help@r-project.org
Received: Monday, July 19, 2010, 6:48 PM
Dear All,
I have some data in the following shape:
ID begin_t1end_t1 begin_t2end_t2
Thomas 11/03/0413/05/0604/02/0716/05/08
... ... ... ...
Hi:
Here's one solution using function reshape() in the stats package (adapted
from an R-help solution by Thomas Lumley on Nov. 26, 2002):
d - read.table(textConnection(
+ ID begin_t1end_t1 begin_t2
end_t2
+ Thomas 11/03/0413/05/06
wrote:
From: Thomas Jensen thomas.jen...@eup.gess.ethz.ch
Subject: [R] Reshaping data
To: R-help@r-project.org
Received: Monday, July 19, 2010, 6:48 PM
Dear All,
I have some data in the following shape:
ID
begin_t1 end_t1
begin_t2 end_t2
Thomas
11/03
Thank you Dennis and Henrique for your help!
Both solutions work! I just need to find a way of removing the empty cells
from the final long dataframe since they are not NAs.
Maybe there is an easier way of doing this of the data is not treated as a
dataframe? The original data file that is
-Original Message-
From: r-help-boun...@r-project.org
[mailto:r-help-boun...@r-project.org] On Behalf Of Mia Bengtsson
Sent: Friday, May 21, 2010 3:39 AM
To: Dennis Murphy; Henrique Dallazuanna
Cc: r-help@r-project.org
Subject: Re: [R] reshaping data
Thank you Dennis
] On Behalf Of Mia Bengtsson
Sent: Friday, May 21, 2010 3:39 AM
To: Dennis Murphy; Henrique Dallazuanna
Cc: r-help@r-project.org
Subject: Re: [R] reshaping data
Thank you Dennis and Henrique for your help!
Both solutions work! I just need to find a way of removing
the empty cells from
1 - 100 of 142 matches
Mail list logo