Displaying 20 results from an estimated 7000 matches similar to: "ordering columns (longitudinal data in wide format)"
2012 Sep 28
2
Converting array to matrix
Hi,
I have a 3d array as below, I want to make this array to a matrix of p=50(rows) and n=20(columns) with the coverage values .
The code before the array is:
library(binom)
Loading required package: lattice
pi.seq<-seq(from = 0.01, to = 0.5, by = 0.01)
no.seq<-seq(from = 5, to = 100, by = 5)
cp.all = binom.coverage( p = pi.seq, n = no.seq , conf.level = 0.95, method = "exact")
2007 Apr 25
1
help
Hi all,
I have 2 questions:
1)How do I calculate the mean on an imported txt file? I've imported the
file below and that's what it looks like imported. How do I then calcuate
the mean, median, or mode on the column LeafArea using the desktop R
package?
Any help would be greatly appreciated!!
Thanks,
Nat
LeafType Leaflets LeafArea ShapeRatio LeafWeight LeafThickness
1 1
2004 Nov 28
3
Correct Syntax for a Loop
I'll appreciate if some one can help me with the
following loop. This is the logic of the loop,
if we have the following data;
> x.df
x.dif
. .
. .
102 0.00
103 0.42
104 0.08
105 0.00
106 0.00
107 0.00
108 -0.16
109 -0.34
110 0.00
111 -0.17
112 -0.33
113 0.00
114 0.00
115 0.00
116 0.33
117 0.17
118 0.00
. .
. .
I'm trying to find i's where
for (i
2013 Mar 06
3
About basic logical operators
Hello everyone,
I have a basic question regarding logical operators.
> x<-seq(-1,1,by=0.02)
> x
[1] -1.00 -0.98 -0.96 -0.94 -0.92 -0.90 -0.88 -0.86 -0.84 -0.82 -0.80 -0.78
[13] -0.76 -0.74 -0.72 -0.70 -0.68 -0.66 -0.64 -0.62 -0.60 -0.58 -0.56 -0.54
[25] -0.52 -0.50 -0.48 -0.46 -0.44 -0.42 -0.40 -0.38 -0.36 -0.34 -0.32 -0.30
[37] -0.28 -0.26 -0.24 -0.22 -0.20 -0.18 -0.16
2018 Mar 12
7
Equivalent of gtools::mixedsort in R base
Hi,
Searching for functions that would order strings that mix characters and numbers in a "natural" way (ie, "a1 a2 a10" instead of "a1 a10 a2"), I found the mixedsort and mixedorder from the gtools package.
Problems:
1- mixedorder does not work in a "do.call(mixedorder, mydataframe)" call like the order function does
2- gtools has not been updated in 2.5
2018 Mar 12
0
Equivalent of gtools::mixedsort in R base
???
> y <- sort( c("a1","a2","a10","a12","a100"))
> y
[1] "a1" "a10" "a100" "a12" "a2"
> mixedsort(y)
[1] "a1" "a2" "a10" "a12" "a100"
**Please read the docs!** They say that mixedsort() and mixedorder() both
take a **single
2018 Mar 12
1
Equivalent of gtools::mixedsort in R base
x <- c( "a1", "a10", "a2" )
y <- c( "b10", "b2", "a12", "ca1" )
DF <- expand.grid( x = x, y = y )
# randomize
set.seed( 42 )
DF <- DF[ sample( nrow( DF ) ), ]
# missing from gtools
mixedrank <- function( x ) {
seq.int( length( x ) )[ gtools::mixedorder(x) ]
}
o <- do.call( order, lapply( DF, mixedrank ) )
2008 Dec 06
1
Morlet wavelet not supportd by wavCWTPeaks
aa <- (structure(list(X.0.85 = c(-1.02, -1.17, -1.29, -1.39, -1.46,
-1.5, -1.52, -1.5, -1.46, -1.39, -1.3, -1.19, -1.07, -0.93, -0.79,
-0.65, -0.5, -0.36, -0.22, -0.08, 0.05, 0.18, 0.3, 0.41, 0.52,
0.62, 0.72, 0.81, 0.89, 0.98, 1.05, 1.13, 1.19, 1.25, 1.29, 1.31,
1.31, 1.29, 1.24, 1.16, 1.06, 0.93, 0.77, 0.58, 0.38, 0.16, -0.07,
-0.31, -0.89, -1.05, -1.19, -1.31, -1.41, -1.47, -1.51, -1.51,
2018 Mar 12
0
Equivalent of gtools::mixedsort in R base
split any mixed columns into letter and number columns
and then order can be used on that:
DF <- data.frame(x = c("a10", "a2", "a1"))
o <- do.call("order", transform(DF, let = gsub("\\d", "", x),
no =
as.numeric(gsub("\\D", "", x)),
2012 Jul 30
2
distance matrix and hclustering
Dear R Users,i am very new to R. I want your help on an issue regarding distance matrix and cluster analysis
i had discharge data of 4 rivers(a,b,c,d) in 4 vectors each having 364 values
> dput(qmu)structure(list(a = c(0.26, 0.25, 0.25, 0.25, 0.24, 0.23, 0.22, 0.21, 0.21, 0.21, 0.2, 0.19, 0.19, 0.19, 0.19, 0.18, 0.18, 0.18, 0.17, 0.17, 0.17, 0.17, 0.17, 0.17, 0.17, 0.17, 0.17, 0.17, 0.17, 0.17,
2006 Jan 11
3
natural sorting
It would be nifty to incorporate this into R or into an R package:
http://sourcefrog.net/projects/natsort/
2018 Mar 12
0
Equivalent of gtools::mixedsort in R base
1- mixedorder does not work in a "do.call(mixedorder, mydataframe)"
call like the order function does
This is tangential, but do.call(order, mydataframe) is not safe to use in a
general purpose function either - you need to remove the names from
the second argument:
> d <- data.frame(method=c("New","New","Old","Old","Old"),
2017 Jun 29
1
about reading files in order
Thanks for that answer.
I was not aware of gtools::mixedsort
<https://www.rdocumentation.org/packages/gtools/versions/3.5.0/topics/mixedsort>
function.
Jean
On Thu, Jun 29, 2017 at 2:47 PM, Henrik Bengtsson <
henrik.bengtsson at gmail.com> wrote:
> You can use:
>
> > files <- list.files(path = "folder01")
> > files <- gtools::mixedsort(files)
>
2017 Jun 29
2
about reading files in order
Hi R users,
I have a question about opening the txt files and putting them into a
matrix. The txt files are in the folder01, while they have the name
file.1.txt, file.2.txt, file.3.txt, etc. There are about 200 such text
files. Each txt file contains one value inside. When I tried to use the
code below, I found that the txt files are not in order, from 1, 2, 3, to
200. Rather, they are in the
2017 Jun 29
0
about reading files in order
You can use:
> files <- list.files(path = "folder01")
> files <- gtools::mixedsort(files)
to order the files in a "human-friendly" order rather than
lexicographic order (which sort() provides).
FYI 1; it's preferred to use file.path("folder01", list[i]) rather
than paste('folder01',lists[i],sep='/').
FYI 2; if you use
2010 Mar 31
1
Weird R behaviour?
Dear list,
I have observed a weird behaviour from R --- apologies if I am missing
something obvious!
df3f826f28
df3f826f28
Say you type in R:
>c.preec <- 10074
>c.gd <- 2200
>p1 <- .2
>c.neo <- p1*9451 + (1-p1)*3883
>n.preec <- 3710
>n.gd <- 2650
>n.neo <- 2120
>n.pcos <- 53000
>unit.met <- 94
>cost.met <- 94*n.pcos
>effect <-
2012 Feb 28
2
Error: could not find function "hier.part"
Error: could not find function "hier.part"
things I have tried:
1. reinstall R (lastest version, on windows XP)
2. install package "gtools"
3. include:
library(gtools)
require(gtools)
4. how I call this function:
hier.part(c$Y, xdata, fam = "gaussian", gof = "Rsqu")
5.when I try to check what's in the package "gtools", I get (hier.part is
2001 Mar 16
1
combine dataset
Hi,
I have two data sets look like below:
==========================
state count1 percent1
CA 19 0.34
TX 22 0.35
FL 11 0.24
OR 34 0.42
GA 52 0.62
MN 12 0.17
NC 19 0.34
state count2 percent2
FL 22 0.35
MN 22 0.35
CA 11 0.24
TX 52 0.62
==========================
How to combine these two data set and make it look
like below?
2004 Oct 16
3
Lazy loading... advices
Hello,
I am looking for more information about lazy loading introduced in R 2.0.0.
Doing
?lazyLoad
I got some and there is a 'see also' section that points to
'makeLazyLoading'... But I cannot reach this page.
My problem is: I recompiled a library that uses a lot of functions from
other libraries (of course I can give details if needed). I load it in my
computer: library(svGUI),
2004 Sep 17
1
R-2.0.0 Install problem for package bundle with inter-dependent n amespaces
I have a revised version of the gregmisc package, which I've converted into
a package bundle each of which has a namespace: gplots, gmodels, gdata,
gtoools. Of course, there are interdependencies among these namespaces:
gsun374: /tmp [11]> cd gregmisc/
gsun374: gregmisc [12]> grep import */NAMESPACE
gdata/NAMESPACE:importFrom(gtools, odd, invalid, mixedsort)