...
> mydf[2] # ???
B
1 4
2 5
3 6
A data frame is "really" a list of columns, so giving a single value
returns that column.
False. It returns a data frame consisting of a single column = a list
containing a single component.
mydf[[2]]
returns a single component/column.
While these differ
On Tue, Jan 26, 2016 at 4:24 PM, Robert Sherry wrote:
>
> Thank you for the response. As expected, the following expression worked:
> df[order(df$x),]
This says to sort the rows, and leave the columns alone.
Subsetting a 2-dimensional object is via
[rows, columns]
> I would expect the follo
Thank you for the response. As expected, the following expression worked:
df[order(df$x),]
I would expect the following expression to work also:
df[order(df$x)]
However it does not. That is, the comma is needed. Please tell me why
the comma is there.
Thanks
Bob
On 1/26/2016 8:19 A
> On 23.01.2016 01:21, Robert Sherry wrote:
> > In R, I run the following commands:
> > df = data.frame( x=runif(10), y=runif(10) )
> > df2 = df[order(x),]
>
>
> You use another x from your workspace, you actually want to
>
>
> df2 = df[order(df[,"x"]),]
or
df[order(df$x),]
And
On 23.01.2016 01:21, Robert Sherry wrote:
In R, I run the following commands:
df = data.frame( x=runif(10), y=runif(10) )
df2 = df[order(x),]
You use another x from your workspace, you actually want to
df2 = df[order(df[,"x"]),]
Best,
Uwe Ligges
The first, as I would expect
In R, I run the following commands:
df = data.frame( x=runif(10), y=runif(10) )
df2 = df[order(x),]
The first, as I would expect, creates a data frame with two columns and
10 rows. I expect the second to sort the data based upon
the columns x and produce a new data frame, df2, with the s
Spring 0.1927715
> #16 Spring 0.1927715
>
> The process you describe does not get me there
>
> Any other recommendations?
>
> -Original Message-
> From: arun [mailto:smartpink...@yahoo.com]
> Sent: Thursday, October 11, 2012 10:33 AM
> To: ROLL Josh F
> Cc: R help
>
ly, the Obs column has only 4 values. Do you want to
get the means???
A.K.
- Original Message -
From: ROLL Josh F
To: 'arun'
Cc: R help
Sent: Thursday, October 11, 2012 1:42 PM
Subject: RE: [R] Sorting a data frame by specifying a vector
Sorry if I wasn't clear but th
Winter 0.9318599
> #10 Winter 0.9318599
> #14 Winter 0.9318599
> #4 Spring 0.1927715
> #8 Spring 0.1927715
> #12 Spring 0.1927715
> #16 Spring 0.1927715
>
> Any other thoughts?
>
> JR
>
>
> -Original Message-
> From: Bert Gunter [mailto:gunter.ber
tober 11, 2012 10:33 AM
To: ROLL Josh F
Cc: R help
Subject: Re: [R] Sorting a data frame by specifying a vector
Hi,
In your dataset, it seems like it is already ordered in the way you wanted to.
df.. <- data.frame(Season=rep(c("Summer","Fall","Winter","Spring&
927715
#5 Summer 0.2141001
#6 Winter 0.9318599
#7 Fall 0.6722337
#8 Spring 0.1927715
#9 Summer 0.2141001
#10 Winter 0.9318599
#11 Fall 0.6722337
#12 Spring 0.1927715
#13 Summer 0.2141001
#14 Winter 0.9318599
#15 Fall 0.6722337
#16 Spring 0.1927715
A.K.
----- Original Message -
F
?order
df[order(yourcolumn, ]
-- Bert
On Thu, Oct 11, 2012 at 10:08 AM, LCOG1 wrote:
> Hello all,
>I cannot seem to figure out this seemingly simple procedure.
>
> I want to sort a data frame by a specified character vector.
>
> So for :
>
> df.. <- data.frame(Season=rep(c("Summer","Fall","
Hello all,
I cannot seem to figure out this seemingly simple procedure.
I want to sort a data frame by a specified character vector.
So for :
df.. <- data.frame(Season=rep(c("Summer","Fall","Winter","Spring"),4),Obs=
runif(length(rep(c("Summer","Fall","Winter","Spring"),4
I want to so
-help@r-project.org
Sent: Tue, June 7, 2011 10:05:37 AM
Subject: Re: [R] Sorting a data frame with values of different lengths
Also, I tried changing a line to store W as numeric:
sample_info<-c(pds_gagehandles[i],p,as.numeric(sample_W))
But it is still sorting incorrectly:
> W_table[order(W
Thanks for catching that, Sarah.
It seems like the problem was that I was using the c() function to combine
terms (including W) that I was adding to a data frame.
This caused R to convert the numeric W to a character string.
I fixed this by using data.frame() and then rbind() instead of c() and
Hi,
On Tue, Jun 7, 2011 at 10:01 AM, William Armstrong
wrote:
> Hi Sarah,
>
> str(W_table) gives me:
>
>> str(W_table)
> 'data.frame': 11 obs. of 3 variables:
> $ pds_gagehandles.i.: Factor w/ 1 level "mibe": 1 1 1 1 1 1 1 1 1 1 ...
> $ p : chr "1" "2" "3" "4" ...
> $ W
Also, I tried changing a line to store W as numeric:
sample_info<-c(pds_gagehandles[i],p,as.numeric(sample_W))
But it is still sorting incorrectly:
> W_table[order(W_table$as.numeric.W.),]
pds_gagehandles.i. p as.numeric.W.
8mibe 81004.5
1mibe 1
Hi Sarah,
str(W_table) gives me:
> str(W_table)
'data.frame': 11 obs. of 3 variables:
$ pds_gagehandles.i.: Factor w/ 1 level "mibe": 1 1 1 1 1 1 1 1 1 1 ...
$ p : chr "1" "2" "3" "4" ...
$ W : chr "746" "870.5" "767" "1066" ...
here is the script I am usi
Hi,
It looks to me that your data frame is being sorted as text.
What does
str(W_table)
show?
How was W_table created? Your W column appears to not be numeric.
Sarah
On Tue, Jun 7, 2011 at 9:51 AM, William Armstrong
wrote:
> Hi all,
>
> I am attempting to run a script in which I permute my da
Hi all,
I am attempting to run a script in which I permute my data and run a
Wilcoxon rank sum test on the data 1000 times and compare my original test
statistic to the permuted test statistics to more accurately estimate a
significance level for the trends I am observing.
In the process of doing
TIBCO Software
wdunlap tibco.com
> -Original Message-
> From: r-help-boun...@r-project.org
> [mailto:r-help-boun...@r-project.org] On Behalf Of Alastair
> Sent: Thursday, February 03, 2011 7:13 AM
> To: r-help@r-project.org
> Subject: [R] Sorting a Data Frame by hybrid s
On Feb 3, 2011, at 10:12 AM, Alastair wrote:
Hi,
I'm trying to present a table of some experimental data, and I want
to order
the rows by the instance names. The issue I've got is that there are a
variety of conventions for the instance names (e.g. competition01,
competition13, small_1, bi
Hi,
I'm trying to present a table of some experimental data, and I want to order
the rows by the instance names. The issue I've got is that there are a
variety of conventions for the instance names (e.g. competition01,
competition13, small_1, big_20, med_9). What I want to be able to sort them
fi
Dear Michael,
Is this what you are looking for?
ex.dat$rn=as.numeric(rownames(ex.dat))
ex.dat
# Are new3 and ex.dat equals?
all.equal(new3,ex.dat)
[1] TRUE
HTH,
Jorge
On Tue, Jul 8, 2008 at 10:58 PM, Michael Rennie <[EMAIL PROTECTED]> wrote:
> Hi there,
>
> I'm sure there's an easy answer to
Can't you just do
newdat <- newdat[order(row.names(newdat)),]
Or am I missing something?
cheers,
Rolf Turner
On 9/07/2008, at 2:58 PM, Michael Rennie wrote:
Hi there,
I'm sure there's an easy answer to this, and I can't wait to see it.
The question: is the
Hi there,
I'm sure there's an easy answer to this, and I can't wait to see it.
The question: is there an easy way to sort a data frame by it's row names?
My dilemma:
I've had to pull apart a data frame, run it through a loop to do some
calculations and generate new variables, and then re-constr
26 matches
Mail list logo