This approach is fraught with dangers.
I recommend that you put all of those data frames into a list and have your
function accept the list and the name and use the list indexing operator
mylist[[DFName]] to refer to it. Having functions that go fishing around in the
global environment will be
On 01/27/2015 02:54 AM, Bert Gunter wrote:
Huh??
ifelse(TRUE, a <- 2L, a <- 3L)
[1] 2
a
[1] 2
Please clarify.
In Bioconductor ifelse() is a generic function (with methods for Rle
objects) so all its arguments are evaluated before dispatch can
happen. You can reproduce with:
setGeneric("i
Hi,
I define a function named starStop with three inputs: start, stop and
increment.
> startStop <- function(start, stop, increment) {
+ for (i in seq(start, stop, increment+1)) cat(i,"-",i+increment,"\n")}
> startStop(12, 35, 5)
12 - 17
18 - 23
24 - 29
30 - 35
> startStop(42, 83, 5)
42 -
Dear R-help,
I have df.1001 as a data frame with rows & columns of values.
I also have other data frames named similarly, i.e., df.*.
I used DFName from:
DFName <- ls(pattern = glob2rx("df.*"))[1]
& would like to pass on DFName to another function, like:
length(DFName[, 1])
however, when I ru
Hi,
I think what you did is correct. The row name 'comp168081_c2_seq1' is not
in the filter data frame. Neither is the row as the following small example
shows. Actually the dim(datawithoutVF) 171417 12
is different from dim(data) 171471 12. Or 171417 is not the same as
171471 altho
Hi,
I think you need quotation around I like the following:
> status
2010 2011 2012
1 AAA
2 AII
3 AAA
4 UUU
5 AAA
6 III
7 UII
8 AUA
9 IAU
10III
> apply(start,2,function(x)
Hi,
Here is my implementation:
> combine <- function(x){
+ odd <- x[1:length(x) %% 2 == 1]
+ even <- x[1:length(x) %%2 == 0]
+ paste0(odd,even)}
> temp <- letters[1:24]
> temp
[1] "a" "b" "c" "d" "e" "f" "g" "h" "i" "j" "k" "l" "m" "n" "o" "p" "q" "r"
"s" "t" "u" "v" "w" "x"
> combine(temp)
I need a function that "reverse" calibrates radiocarbon dates (similar to
the R_Simulate command in Oxcal). In essence, the user inputs a calendar
date and the function outputs a possible radiocarbon date based on the
probability distribution at that point on the radiocarbon calibration
curve.
I h
Hi Kathryn,
If you construct a list of your logical conditions, you can pass that
to a function that evaluates them one by one and returns a list of the
resulting subsets.
subsets<-list(B="(A[,1] %in% c(1,2) & A[,2] %in% c(1,2)) | (A[,1] %in%
c(3) & A[,2] %in% c(1)) | (A[,1] %in% c(4) & A[,2] %in%
I need a function that "reverse" calibrates radiocarbon dates (similar to the
R_Simulate command in Oxcal). In essence, the user inputs a calendar date
and the function outputs a possible radiocarbon date based on the
probability distribution at that point on the radiocarbon calibration curve.
I h
Hi:
Don't know about performance, but this is fairly simple for operating
on atomic vectors:
x <- c("A", "A", "G", "T", "C", "G")
apply(embed(x, 2), 1, paste0, collapse = "")
[1] "AA" "GA" "TG" "CT" "GC"
Check the help page of embed() for details.
Dennis
On Wed, Jan 28, 2015 at 3:55 PM, Kate I
Kate, here's a solution that uses regular expressions, rather than vector
manipulation:
> mystr = "ID1 A A T G C T G C G T C G T A"
> gsub(" ([ACGT]) ([ACGT])", " \\1\\2", mystr)
[1] "ID1 AA TG CT GC GT CG TA"
-John
> -Original Message-
> From: R-help [mailto:r-help-boun...@r-project.o
Hi Bert! yes, you are VERY correct!!! Why am I making this simple thing
so complicated??? ;) Thank you so much for your nice lesson!
Chel Hee Lee
On 01/28/2015 09:59 PM, Bert Gunter wrote:
eek!
Chel Hee,anything that complicated should engender fear and trembling.
Much simpler and more eff
eek!
Chel Hee,anything that complicated should engender fear and trembling.
Much simpler and more efficient (if I understand correctly)
i <- seq.int(1L,length(ID1),by = 2L)
paste0(ID1[i],ID1[i+1])
That gives a vector of paired letters. If you want a single character
string, just collapse with a
I am using just the first row of your data (i.e. ID1).
> ID1 <- c("A", "A", "T", "G", "C", "T", "G", "C", "G", "T", "C", "G",
"T", "A")
> do.call(c,lapply(tapply(ID1, gl(7,2), c), paste, collapse=""))
1234567
"AA" "TG" "CT" "GC" "GT" "CG" "TA"
>
Is this what you are
I like the way presented by William Dunlap in the previous post. You
may also try this:
> dat1$item <- Reduce(c,lapply(table(dat1$Date), seq_len))
> dat2$item <- Reduce(c,lapply(table(dat2$Date), seq_len))
> dat1
Date ConcAve item
1 2009-07-08 71
2 2009-08-26 11
3
> with(dat1, ave(integer(length(Date)), Date, FUN=seq_along))
[1] 1 1 2 1 1 2 1 2 1 2 1
Bill Dunlap
TIBCO Software
wdunlap tibco.com
On Wed, Jan 28, 2015 at 4:54 PM, Morway, Eric wrote:
> The two datasets below are excerpts from much larger datasets. Note that
> there are duplicate dates in
The two datasets below are excerpts from much larger datasets. Note that
there are duplicate dates in both dat1 and dat2, e.g., "2009-10-14".
dat1 <- read.table(textConnection("Date ConcAve
2009-07-08 7
2009-08-26 1
2009-08-26 2
2009-09-15 2
2009-10-14 2
2009-10-14
Hi Kate,
Maybe you want:
seq(2,length(x),by=2)
Jim
On Thu, Jan 29, 2015 at 10:55 AM, Kate Ignatius wrote:
> I have genetic data as follows (simple example, actual data is much larger):
>
> comb =
>
> ID1 A A T G C T G C G T C G T A
>
> ID2 G C T G C C T G C T G T T T
>
> And I wish to get an o
comment inline
David Winsemius wrote on 24.01.2015 21:08:
On Jan 23, 2015, at 5:54 PM, JohnDee wrote:
Heinz Tuechler wrote
At 07:40 21.06.2009, J Dougherty wrote:
[...]
There are other ways of regarding the FET. Since it is precisely
what it says
- an exact test - you can argue that you s
I have genetic data as follows (simple example, actual data is much larger):
comb =
ID1 A A T G C T G C G T C G T A
ID2 G C T G C C T G C T G T T T
And I wish to get an output like this:
ID1 AA TG CT GC GT CG TA
ID2 GC TG CC TG CT GT TT
That is, paste every two columns together.
I have this
Hi,
You did the harder, it remains the easier
listMatrices <- vector("list", 3)
doAll <- function(A){
B <- subset(A, (A[,1] %in% c(1,2) & A[,2] %in% c(1,2)) |
(A[,1] %in% c(3)& A[,2] %in% c(1) ) |
(A[,1] %in% c(4)& A[,2] %in% c(1:4)) )
C <- s
Dear R experts,
Suppose I have a matrix A below.
a <- rep(1:4, each=5)
b <- rep(1:5, 4)
c <- rnorm(20)
A <- cbind(a,b,c)
> A
a bc
[1,] 1 1 0.761806718
[2,] 1 2 0.239734573
[3,] 1 3 -0.728339238
[4,] 1 4 -0.121946174
[5,] 1 5 -0.131909077
[6,] 2 1 -0.069790098
[7,] 2 2
Hello,
In July/August/September 2015 we will be running again a series of
statistics courses in Australia.
Confirmed courses:
1. Darwin: Data exploration, regression, GLM and GAM with introduction to R
2. Sydney: Introduction to mixed modelling, GLMM and MCMC with R
3. Canberra: Introduction
Doh, can't believe I missed that. Sorry Bert.
On Tue, Jan 27, 2015 at 5:08 PM, Bert Gunter wrote:
> Well, the OP already referred to segplot.
>
> But, see, he shouldn't be doing this plot in the first place. Yes, I
> know it's fairly standard in science, but it's a bad idea (as are many
> others
Dear Xochitl,
Have a look at gls() from the nlme package. It allows you to fit auto
correlated errors.
gls(k ~ NPw, correlation = corAR1(form = ~ Time))
Best regards,
ir. Thierry Onkelinx
Instituut voor natuur- en bosonderzoek / Research Institute for Nature and
Forest
team Biometrie & Kwalit
Hi all,
Here is a description of my case. I am sorry if my question is also
statistic related but it is difficult to disentangle. I will however try
to make it only R applied.
My response is a growth constant "k" and my descriptor is prey biomass
"NP" and time series is of 21 years.
I appl
A new release 0.13.1 of matrixStats is now on CRAN
[http://cran.r-project.org/package=matrixStats]. The source code is
available on GitHub [https://github.com/HenrikBengtsson/matrixStats].
WHAT DOES IT DO?
The matrixStats package provides highly optimized functions for
computing common summaries
Hi Monnand,
Is this what you are looking for?
data[grep("prefix1",data$name),]
data[grep("prefix2",data$name),]
Jim
On Wed, Jan 28, 2015 at 6:51 PM, Monnand wrote:
> Hi all,
>
> This really annoyed since I thought this would be easy with some higher
> order function.
>
> Here is what I want:
>
29 matches
Mail list logo