Hi Matthew,
Is this what you are trying to do?
mmdf<-read.table(text="Regulatorhits
AT1G69490AT4G31950,AT5G24110,AT1G26380,AT1G05675
AT2G55980AT2G85403,AT4G89223",header=TRUE,
stringsAsFactors=FALSE)
# split the second column at the commas
hitsplit<-strsplit(mmdf$hits,",")
# define a f
e Station, TX 77843-4352
-Original Message-
From: R-help On Behalf Of Matthew
Sent: Tuesday, April 30, 2019 2:25 PM
To: r-help (r-help@r-project.org)
Subject: [R] transpose and split dataframe
I have a data frame that is a lot bigger but for simplicity sake we can
say it looks like
I have a data frame that is a lot bigger but for simplicity sake we can
say it looks like this:
Regulator hits
AT1G69490 AT4G31950,AT5G24110,AT1G26380,AT1G05675
AT2G55980 AT2G85403,AT4G89223
In other words:
data.frame : 2 obs. of 2 variables
$Regulator: Factor w/ 2 levels
$hits
On Tue, 29 Nov 2016 17:22:47 + (UTC)
Elham - via R-help wrote:
> Is there another way (I prefer a way with Excel)?
Search on "friends don't let friends use excel for statistics."
Spreadsheets are an inherently perilous way to do statistics and Excel
specifically is notoriously poor. In fact
Hi,
To provide a [very] small example of what Bert is referring to:
DF <- data.frame(Letters = letters[1:4], int = 1:4)
> str(DF)
'data.frame': 4 obs. of 2 variables:
$ Letters: Factor w/ 4 levels "a","b","c","d": 1 2 3 4
$ int: int 1 2 3 4
> DF
Letters int
1 a 1
2 b
No, no. It *is* for transposing. But it is *what* you are transposing
-- a data frame -- that may lead to the problems. You will have to
read what I referred you to and perhaps spend time with an R tutorial
or two (there are many good ones on the web) if your R learning is not
yet sufficient to und
It is probably worth mentioning that this (i.e. transposing a data
frame) can be a potentially disastrous thing to do in R, though the
explanation is probably more than you want to know at this point (see
?t and follow the 'as.matrix' link for details). But if you start
getting weird results and
thank you all,it worked
On Tuesday, November 29, 2016 9:49 PM, "Dalthorp, Daniel"
wrote:
Try David's suggestion to spell the argument "stringsAsFactors" correctly.
Then:
data <- read.table("your_file_location", sep ="\t", comment.char = "",
stringsAsFactors = F, header = T)
transpose
Try David's suggestion to spell the argument "stringsAsFactors" correctly.
Then:
data <- read.table("your_file_location", sep ="\t", comment.char = "",
stringsAsFactors = F, header = T)
transpose_data <- t(data)
-Dan
On Tue, Nov 29, 2016 at 9:56 AM, Elham - via R-help
wrote:
> yes you have rig
It's 'stringsAsFactors' = FALSE (without my added quotes) with an 's'
at the end of 'strings' .
-- Bert
Bert Gunter
"The trouble with having an open mind is that people keep coming along
and sticking things into it."
-- Opus (aka Berkeley Breathed in his "Bloom County" comic strip )
On Tue, Nov
yes you have right about excel.by R,what should I do for transposing row and
column?
On Tuesday, November 29, 2016 9:13 PM, David Winsemius
wrote:
> On Nov 29, 2016, at 9:22 AM, Elham - via R-help wrote:
>
> Hi,
>
> I am trying to transpose large datasets inexcel (44 columns and 57
> On Nov 29, 2016, at 9:22 AM, Elham - via R-help wrote:
>
> Hi,
>
> I am trying to transpose large datasets inexcel (44 columns and 57774 rows)
> but it keeps giving me the message we can'tpaste because copy area and paste
> area aren't the same size. Is there a way totranspose all the data
Hi,
I am trying to transpose large datasets inexcel (44 columns and 57774 rows) but
it keeps giving me the message we can'tpaste because copy area and paste area
aren't the same size. Is there a way totranspose all the data at one time
instead of piece by piece? One dataset has agreat amount of
Both ways are doing well the job. Nice!
Thanks again!
--
View this message in context:
http://r.789695.n4.nabble.com/transpose-a-data-frame-according-to-a-specific-variable-tp4702971p4703007.html
Sent from the R help mailing list archive at Nabble.com.
_
library(tidyr)
spread(DF,Year,Day)
> On 09 Feb 2015, at 16:47, jeff6868 wrote:
>
> finalDF <-
> data.frame(id=c("A","B","C"),"2000"=c(NA,NA,164),"2001"=c(120,NA,99),
> "2002"=c(90,18,48),"2003"=c(54,217,NA),"2004"=c(NA,68,NA))
signature.asc
Description: Message signed with OpenPGP using G
One way is to use the reshape2 package:
library(reshape2)
dcast(DF, id ~ Year, value.var = "Day")
Dennis
On Mon, Feb 9, 2015 at 7:47 AM, jeff6868
wrote:
> Dear R-users,
>
> I would like to transpose a large data.frame according to a specific column.
> Here's a reproductible example, it will be
Dear R-users,
I would like to transpose a large data.frame according to a specific column.
Here's a reproductible example, it will be more understandable.
At the moment, my data.frame looks like this example:
DF <- data.frame(id=c("A","A","A","B","B","B","C","C","C"),
Year=c(2001,2002,2003,2002,
reshape(dta, idvar="id", timevar="name", direction="wide")
-Original Message-
From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org]
On Behalf Of Nico Met
Sent: Mittwoch, 26. Juni 2013 13:38
To: R help
Subject: [R] Transpose of the rows
D
N00016-014A -0.5843794 -0.8428928 -7939.444 -13.594147 12.200
#3 TN00031-014A 0.8001962 0.1741609 -1200.824 -25.868973 NA
A.K.
- Original Message -
From: Nico Met
To: R help
Cc:
Sent: Wednesday, June 26, 2013 7:37 AM
Subject: [R] Transpose of the rows
Dear R users,
Dear R users,
I am using a big data matrix and need to transpose rows (formatting of
input matrix). I would like write a general code for this example.
for example: my input file is "dta"
dput(dta)
structure(list(id = structure(c(1L, 1L, 1L, 1L, 1L, 2L, 2L, 2L,
2L, 2L, 3L, 3L, 3L, 3L), .Label =
:06 AM
Subject: Re: [R] transpose lists
Thanks. The result should be a list of lists like...
> x
[[1]]
[1] 12.10 3.44
[[2]]
[1] 0.1 3.0
[[3]]
[1] 12.0 33.1
[[4]]
[1] 1.1 23.0
lapply(x, t) doesn't do the job, I think.
ishida
2013/3/8 PIKAL Petr
> Hi
>
> > -Origina
t; From: r-help-boun...@r-project.org [mailto:r-help-bounces@r-
> > > project.org] On Behalf Of ishi soichi
> > > Sent: Friday, March 08, 2013 10:50 AM
> > > To: r-help
> > > Subject: [R] transpose lists
> > >
> > > Can you think of
gt; >> Hi
> >>
> >>> -Original Message-
> >>> From: r-help-boun...@r-project.org [mailto:r-help-bounces@r-
> >>> project.org] On Behalf Of ishi soichi
> >>> Sent: Friday, March 08, 2013 10:50 AM
> >>> To: r-help
&
t; 2013/3/8 PIKAL Petr
>
>> Hi
>>
>>> -Original Message-
>>> From: r-help-boun...@r-project.org [mailto:r-help-bounces@r-
>>> project.org] On Behalf Of ishi soichi
>>> Sent: Friday, March 08, 2013 10:50 AM
>>> To: r-help
help-boun...@r-project.org [mailto:r-help-bounces@r-
> > project.org] On Behalf Of ishi soichi
> > Sent: Friday, March 08, 2013 10:50 AM
> > To: r-help
> > Subject: [R] transpose lists
> >
> > Can you think of a function that transposes a list like
>
> What shall
Hi
> -Original Message-
> From: r-help-boun...@r-project.org [mailto:r-help-bounces@r-
> project.org] On Behalf Of ishi soichi
> Sent: Friday, March 08, 2013 10:50 AM
> To: r-help
> Subject: [R] transpose lists
>
> Can you think of a function that transposes a
Can you think of a function that transposes a list like
> x
[[1]]
[1] 12.1 0.1 12.0 1.1
[[2]]
[1] 3.44 3.00 33.10 23.00
?
ishida
[[alternative HTML version deleted]]
__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listi
Hi Yao He,
this doesn't sound like R to me. I'd go for perl (or awk).
See e.g. here:
http://stackoverflow.com/questions/1729824/transpose-a-file-in-bash
HTH
Claudia
Am Wed, 6 Mar 2013 22:37:14 +0800
schrieb Yao He :
> Dear all:
>
> I have a big data file of 6 columns and 6 rows like
bel = c("2.357",
> "2.358", "2.359", "2.36", "2.362", "2.364", "y"), class = "factor"),
> F1 = structure(c(13L, 9L, 6L, 9L, 12L, 11L, 7L, 3L, 10L,
> 5L, 5L, 6L, 7L, 9L, 3L, 9L, 5L, 8L, 1L, 3L,
;,
"19.837", "19.838", "19.839", "x"), class = "factor"), F1.1 =
structure(c(9L,
1L, 5L, 1L, 1L, 3L, 3L, 4L, 2L, 3L, 1L, 3L, 4L, 3L, 4L, 7L,
6L, 3L, 5L, 6L, 6L, 6L, 8L, 7L, 8L, 6L, 7L, 6L), .Label = c("8.775",
"
ot;y", "x", "y")))
If you post an example like this, we'll know better what to do.
It's just a matter of copy&paste to an R session.
Rui Barradas
--
View this message in context:
http://r.789695.n4.nabble.com/Breaking-up-a-Row-in-R-transpose-tp4607658p46
(Small example.)
Rui Barradas
--
View this message in context:
http://r.789695.n4.nabble.com/Breaking-up-a-Row-in-R-transpose-tp4607658p4609748.html
Sent from the R help mailing list archive at Nabble.com.
__
R-help@r-project.org mailing list
https:/
id 'dimnames' given for data frame
Any help is much appreciated.
Thank you.
--
View this message in context:
http://r.789695.n4.nabble.com/Breaking-up-a-Row-in-R-transpose-tp4607658p4609658.html
Sent from the R help mailing list archive at Nabble.com.
__
as
--
View this message in context:
http://r.789695.n4.nabble.com/Breaking-up-a-Row-in-R-transpose-tp4607658p4609488.html
Sent from the R help mailing list archive at Nabble.com.
__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listin
On Fri, May 04, 2012 at 11:11:47AM -0700, marc212 wrote:
> I have something like 28 rows and 6000 columns. How would I configure this
> with for loops.
The transformation may be splitted into simpler pieces using a for
loop over the 28 rows. Try the following.
orig <- rbind(
"0"=c(5, 6, 6, 7
I have something like 28 rows and 6000 columns. How would I configure this
with for loops.
Thank you.
Marc
--
View this message in context:
http://r.789695.n4.nabble.com/Breaking-up-a-Row-in-R-transpose-tp4607658p4609309.html
Sent from the R help mailing list archive at Nabble.com
On Thu, May 03, 2012 at 07:36:45PM -0700, marc212 wrote:
> I have the following:
> Time A1 A1 B1 B1 C1 C2
> x y x y x y
> 0 5 6 6 7 7 9
> 1 3 4 4 3 9 9
> 2 5 2 6
this message in context:
http://r.789695.n4.nabble.com/Breaking-up-a-Row-in-R-transpose-tp4607658.html
Sent from the R help mailing list archive at Nabble.com.
__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read
See ?t
__Scott Chamberlain
Rice University, EEB Dept.
On Wednesday, May 25, 2011 at 9:07 AM, Mohamed Lajnef wrote:
> Dear All,
> Suppose this data.frame
> D
>
> V7 V8 V9 V10 V11 V12 V13 V14 V15 V16 V17 V18 V19 V20 V21 V22
> C C C C T T G G A A C C G G C C
> G G T T A A A A T
Dear All,
Suppose this data.frame
D
V7 V8 V9 V10 V11 V12 V13 V14 V15 V16 V17 V18 V19 V20 V21 V22
C C C C T T G G A A C C G G C C
G G T T A A A A T A T T C C G G
C C C C T T G G A A C C G G C C
I would translate D
Ups, I mean library(reshape) not plyr, sorry
# Example datasets
# Input
propsum <- data.frame(coverClass=c("C", "G", "L", "O", "S"),
R209120812=c(NA, 0.49, 0.38, 0.04, 0.09),
R209122212=c(0.05, 0.35, 0.41, 0.09, 0.10))
library(reshape)
xpropsum <- melt
Try this:
xtabs(values ~ ind + cover, cbind(cover = propsum$coverClass,
stack(propsum)))
On Fri, Apr 23, 2010 at 1:43 AM, wrote:
> 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(), r
While the OP turned out to want to transpose his data, for those who are
reading and would like some (ugly) code to flip a tensor about an
arbitrary axis, here goes:
*_* Carl
#my own cheap matrix flipflopper
flip<-function(x,flipdim=1) {
#axis is index, so 1 is rows, 2 is cols (for ma
Hi David,
you could use a mix of "plyr" and reshape:
# Example datasets
# Input
propsum <- data.frame(coverClass=c("C", "G", "L", "O", "S"),
R209120812=c(NA, 0.49, 0.38, 0.04, 0.09),
R209122212=c(0.05, 0.35, 0.41, 0.09, 0.10))
library(plyr)
xpropsum <
@r-project.org
Subject: Re: [R] transpose? reshape? flipping? challenge with data frame
Hi David,
There are many ways, including
rownames(propsum) <- propsum$coverClass
propsum$coverClass <- NULL
t(propsum)
Best,
Ista
On Fri, Apr 23, 2010 at 5:43 AM, wrote:
> Greetings all,
>
&
Hi David,
There are many ways, including
rownames(propsum) <- propsum$coverClass
propsum$coverClass <- NULL
t(propsum)
Best,
Ista
On Fri, Apr 23, 2010 at 5:43 AM, wrote:
> Greetings all,
>
> I am having difficulty transposing, reshaping, flipping (not sure which) a
> data frame which is read
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 init
Try this. First we use outer to form a matrix such that i,j-th entry
is TRUE if i, j are in the same group and unequal and FALSE otherwise.
We apply which on the rows of that matrix to get the groups that are
associated with the row group. We then cbind the components together
using ts class to
try this:
> x <- read.table(textConnection(" id group
+ 1 1 1
+ 2 2 1
+ 3 3 1
+ 4 4 1
+ 5 5 2
+ 6 6 2
+ 7 7 3
+ 8 8 3
+ 9 9 3
+ 10 10 3
+ 11 11 3
+ 12 12 3"), header=TRUE)
> # split by group and process
>
Hi all,
I want to make extra columns in my datafile where the id of every
groupmember is mentioned in separate columns. To explain it better see the
example:
id<-c(1,2,3,4,5,6,7,8,9,10,11,12)
group<-c(1,1,1,1,2,2,3,3,3,3,3,3)
a<-as.data.frame(cbind(id,group))
## if x is a matrix this should work
library(reshape)
x <- structure(c(36.41099, 73.60079, 171.94, 67.48221, 131.917, 85.17079,
0.4015699, 9.4656186, 9.201167, 11.7657645, 14.4986667, 17.3150434,
35.1, 50, 153.5, 40, 97, 57.3, 36.2, 67, 166.5, 60, 122,
70.9, 36.5, 73, 173, 68, 132, 83.1, 36.666
You mean ***transform*** a dataset, not ``transpose''. Transposition
is something done to a matrix. If you do not get your terminology
straight, no one can help you.
You may get some mileage out of the reshape() function; possibly you
may need the more elaborate facilities in the reshape packa
Does ??transpose help
(for example, leading to ?t for 'transpose')
>>> rajclinasia 18/08/2009 05:00:00 >>>
Hi Everyone,
I have a dataset like this
mean sd0% 25%
50%
75% 100% n
BODY TEMPERATURE 36.41099 0.4015699 3
Is this what you want:
> x
mean sd X0. X25. X50.
X75. X100. n
BODY_TEMPERATURE 36.41099 0.4015699 35.1 36.2 36.5
36.7 37.1 89
DIASTOLIC_BLOOD_PRESSURE 73.60079 9.4656186 50.0 67.0 73.0
80.0 95.0 253
HEIGHT
Hi Everyone,
I have a dataset like this
mean sd0% 25% 50%
75% 100% n
BODY TEMPERATURE 36.41099 0.4015699 35.1 36.2 36.5
36.7 37.1 89
DIASTOLIC BLOOD PRESSURE 73.60079 9.4656186 50.0 67.0 73.0
80
MarcioRibeiro wrote:
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,]12
, , 2
[,1] [,2]
[1,]34
And I would like to get the following result...
, , 1
[,1]
[1,]
ent: Tuesday, February 24, 2009 9:50 AM
> To: r-help@r-project.org
> Subject: [R] 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
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,]12
, , 2
[,1] [,2]
[1,]34
And I would like to get the following result...
, , 1
[,1]
[1,]1
[,2]2
, , 2
Hi all,
I used the "replicate" function to make 2 samples from file test with 5
records in each sample and saved the output in "result".
result=replicate(2,test[,sample(colnames(test),5,replace =
FALSE)],simplify=FALSE)
now I need to transpose each sample, but when I use:
t(result)
or
res
if x is your data: t(x)
-
cuncta stricte discussurus
-
-Ursprüngliche Nachricht-
Von: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Im
Auftrag von Felipe Carrillo
Gesendet: Wednesday, March 12, 2008 8:19 PM
An: [EMAIL PROTECTED]
Betreff: [R
Hi all:
How can I transpose this dataset from column to row
idweek value
1 5 51
2 6 73
3 7 41
4 8 22
5 9 83
6 10 55
7 11 42
to something like this...
id1 2 3 4 5 6 7
week 5 6 7 8 9 10 11
value 51 73 41
61 matches
Mail list logo