Agustín;
also you can do:
> v <- c(1,1,1,2,3,4,1,10,3)
> dict <- cbind(c(1,2,3),c(1001,1002,1003))
> v <- ifelse(!is.na(match(v,dict)),dict[match(v,dict),2],v)
> v
[1] 1001 1001 1001 1002 10034 1001 10 1003
Javier
-
> Dear Agustin,
>
> Perhaps
>
> v1 <- c(1,1,1,2,3,4,1,10,3)
> dpu
The answer may be simple: you need to use quotation marks and not the
falsely named 'smart quotes' of Office.
How are you writing your programs? It is best to use an R-aware text
editor, but it you must use Word or similar, turn off all the automatic
mis-features.
On Fri, 27 Jun 2008, Rodri
Hi,
I guess this what your need. I assume your output is 10 by 11 matrix.
However, you still need to define your geneset function(?)
result<- list()
output<-matrix(NA, nrow=10, ncol=11)
for(i in 1:length(ncol(output)))
{
result[[i]] <- geneset(which(geneset %n% output[1,]))
}
Chunha
jim holtman wrote:
Is this what you want:
# split the dataframe by the grouping (z was your sample data)
z.s <- split(z, z[[1]])
# calculate the median
(ans <- lapply(z.s, function(.grp) apply(.grp[,7:9], 2, median)))
$HOR006_3
TC.15_comps IC.16_comps SOC.17_comps
10.549669 4.
Hi, all dear R experts,
I am really stuck by how to get the 5th percentile( with a 95% CI )of the
Kaplan-meier estimator of survival function P(T>t). I have a simulated sample
of lifetime Ts, then I set the KM estimator
< km.fit<-survfit(Surv(T),type="kaplan-meier",data=Surv(T))
https://st
Hi,Dear all R experts,
As far as I know, fitdistr() is only to estimate the parameters in
univariate distributions. I have a set of data (x,y) and I assume it follows a
bivariate weibull distribution. Could someone tell me a function in R that is
suitable for parameter estimation in mult
Hi,
Could someone explain what this message mean? I was playing with lme4
pacakge but I could not run any models...
Error in printMer(object) :
no slot of name "dims" for this object of class "table"
In addition: Warning message:
In printMer(object) :
trying to get slot "dims" from an object (cl
Takatsugu Kobayashi indiana.edu> writes:
>
> Hi,
>
> Could someone explain what this message mean? I was playing with lme4
> pacakge but I could not run any models...
>
> Error in printMer(object) :
> no slot of name "dims" for this object of class "table"
> In addition: Warning message:
> In
On Fri, 2008-06-27 at 21:43 +0200, Dan Bolser wrote:
> 2008/6/27 Prof Brian Ripley <[EMAIL PROTECTED]>:
> >
> > I forgot to answer that: just ask R to show you stats:::biplot.prcomp
>
> Ah! I never knew the ::: trick!
In this case you also need to know that biplot.prcomp is in stats.
getAnywhere
Thanks for helping me out with the thing of quotation marks. I finally
could save time running programs at the university and home.
One additional question for all of you. I'm starting to be familiar
with multinomial regression models. Actually I'm doing some exercise
with the pneumo data that appe
Dear R users,
I have a simple problem I cannot solve, but I sure you can help.
I have two vector, let say
> tmp1 <- c("a", "a", "b", "c")
> tmp2 <- c("a", "a", "b", "c", "c", "d")
and I want to create a matrix of two column for which I have all the
combinations of the same character, let say li
Hi,
Is the following function built in somewhere?
concat = function(v) {
res = ""
for (i in 1:length(v))
res = paste(res,v[i],sep="")
res
}
e.g.
> concat(c("12","3","45"))
[1] "12345"
Cheers,
Andy
--
Andy Fugard, Postgraduate Research Student
Psychology (Room F3), The University
Dear everyone:
I am now trying one exercise using clustering method£¬I want to identify
clusters and members for each cluster from the clustering result. it is
important
that i want to require the minimal distance between members in one cluster below
one fixed cutoff
So I am writing to
merge(tmp1, tmp2) gives the basic data and you can put it
in the form requested using:
Tmp1 <- data.frame(x = tmp1)
Tmp2 <- data.frame(x = tmp2)
M <- merge(Tmp1, Tmp2)
data.frame(tmp1 = M$x, tmp2 = M$x)
or using Tmp1 and Tmp2 from above:
library(sqldf)
sqldf("select x tmp1, x tmp2 from Tmp1 nat
Hi, Andy
I am a little confused, why don't you just use paste() directly?
> paste("12","3","45",sep="")
produce the same result with your concat.
regards .
On 2008-6-28, at 下午7:44, Andy Fugard wrote:
Hi,
Is the following function built in somewhere?
concat = function(v) {
res = ""
for
paste(v, collapse="")
On Sat, 28 Jun 2008, Andy Fugard wrote:
Hi,
Is the following function built in somewhere?
concat = function(v) {
res = ""
for (i in 1:length(v))
res = paste(res,v[i],sep="")
res
}
e.g.
concat(c("12","3","45"))
[1] "12345"
Cheers,
Andy
--
Andy Fugard, Postg
Thanks a lot, it works perfectly .
Bye
Paul
jholtman wrote:
>
> Is this what you want:
>
>> x
> cola colb
> 11c
> 21i
> 31i
> 41c
> 52i
> 62c
> 72c
> 82i
> 92i
>> # generate run lengths
>> z <- rle(x$colb)
>> # calculat
Just had to comment that I thought this question was unintentionally
funny, seeing as many of us have gone thru a lot of pain to force Excel
NOT to join lines across NA-type points in our data.
Back to the subject: if you use is.na(), just be careful to remove the
corresponding values in th
Dear R Users,
The granger.test command in the MSBVAR package estimates all possible
bivariate Granger causality tests for m variables. If one passes a data
frame with 3 rows, it returns 6 granger tests in two rows, one for the
F-statistic and another for the p-value.
For example:
> a<-rnorm(1
On Jun 27, 2008, at 1:44 PM, baptiste Auguié wrote:
DeaR list,
Pardon the stupidity of this question but I've been trying this for
a while now without success.
I've followed the example given in the green book "programming with
data", and I now have a working example of a S4 class with a
Thanks Haris, I eventually got this to work thanks to some off-list
help and lots of trials and error. I have to admit I still don't
understand all the details of the procedure (the "generic" paradigm
in particular escapes me), but at least I have achieved a working
example that I can alter
Hello,
The problem I'm working now requires to operate on big matrices.
I've noticed that there are some packages that allows to run some
commands in parallel. I've tried snow and NetWorkSpaces, without much
success (they are far more slower that the normal functions)
My problem is very simple,
Hi Patrick,
Thanks, that worked.
noitems<-3
firstcol<-{result<-NULL;for(i in
1:noitems)result<-c(result,(1:noitems)[-i]);result}
secondcol<-{result<-NULL; for(i in 1:noitems)
result<-c(result,rep(i,noitems-1)); result}
cols<-cbind(firstcol,secondcol)
gt_mat<-array(NA,c(noitems,noitems))
gt_m
Hi all:
Was this question ever answered?
#Is it possible to have different axis limit for each facet in a ggplot2 plot?
Here is an example
library(ggplot2)
x=seq(-10,10,.1)
y=cos(x)
z=sin(x)*10
dat=melt(data.frame(x,y,z), id.var="x")
qplot( x, value, data=dat, facets=variable~., geom="line" ) +
Another way to do it (a more or less straightforward translation of what you
said):
fun <- function(x) {
xp <- c("", x)[-(length(x)+1)] # to get the "previous
element of x"
x[1] <- if(x[1]=="i") "l" else x[1]
x <- ifelse(x == "i" & xp == "c", "l", x)
x <- ifelse(x == "i" &
Hello,
I'm fairly new to R, and despite spending quite some time exploring, testing,
and looking for answers, I still have a couple of questions remaining...
The first one is about creating a dataframe using a list of the variable names .
I get this output file from a database:
BOB <- c('A/A',
Does this do what you want:
> BOB <- c('A/A', 'C/C', '15/27')
> MARY <- c('A/A', NA, '13/12')
> JOHN <- c('A/A', 'C/A', '154/35')
> CLIFF <- c('A/C', 'C/C', '15/12')
> PAM <- c('A/C', 'C/A', '13/12')
> sampleList <- c("BOB", "MARY", "JOHN", "CLIFF", "PAM")
> polyList <- c("rs123", "rs124", "rs555"
Hi all,
I have created following codes :
mat = cbind(c(0.59710430,0.23057380), c(0.23057380, 0.5971089))
set.seed = 1000
vary = runif(dim(mat)[1], 2000, 3000)
calc = function(mat, vary)
{
result = vector(length = (length(vary)+1))
result[1] = sqrt(t(vary) %*% vary)
On 28 Jun 2008, at 16:20, Peng Jiang wrote:
Hi, Andy
I am a little confused, why don't you just use paste() directly?
> paste("12","3","45",sep="")
produce the same result with your concat.
The problem is that I have a vector, not those individual arguments.
But the collapse argument does
Dear all,
I am trying to understand how to access S4 methods after loading a
package, using the online documentation of getMethod and friends.
This is what I have been trying:
> library(coin)
> findMethods("ApproxNullDistribution")
list()
Warning message:
In findMethods("ApproxNullDistribution")
"Juan Pablo Romero Méndez" <[EMAIL PROTECTED]> writes:
> Hello,
>
> The problem I'm working now requires to operate on big matrices.
>
> I've noticed that there are some packages that allows to run some
> commands in parallel. I've tried snow and NetWorkSpaces, without much
> success (they are far
31 matches
Mail list logo