HI,
May be this helps:
set.seed(24)
vec1<- sample(1e5,1e4,replace=FALSE)
set.seed(48)
vec2<- sample(1e7,1e6,replace=FALSE)
system.time(res<- sapply(vec1,function(x) which(vec2%in%x)))
# user system elapsed
#212.520 0.500 213.386
#or
system.time({res2<- match(vec1,vec2) #assuming that t
On Mon, Aug 19, 2013 at 6:07 PM, Shang Zuofeng wrote:
> So this is an alternative method. The package can be installed from
> source() rather than rebuilt. Although the warnings exist, the package
> itself may still be useful. Can you let me know how to installed from
> source?
>
Note that these
On Mon, Aug 19, 2013 at 2:08 PM, Patrick Connolly
wrote:
> On Sat, 17-Aug-2013 at 05:09PM -0700, Jeff Newmiller wrote:
>
>
> |> In most threaded multitasking environments it is not safe to
> |> perform IO in multiple threads. In general you will have difficulty
> |> performing IO in parallel proce
Above, I posted what I find may be errors in survival:::Prentice and
survival:::LinYing.
Today, I found (what I believe is) another discrepancy/error in
survival:::SelfPrentice.
The variance estimator is slightly different from codes of Therneau & Li (1999).
When extracting dfbeta,
Therneau
Dear useRs,
I am currently doing some data cleaning and data manipulation and I have the
following problem.
I have two vectors. Let say the size of the first one is 10 000 (vector 1)
and the size of the second one is 1 000 000 (vector 2).
I need to know for each cell of vector 1 which cells of v
Dear R users,
I am confused with the usage of apply kind of functions instead of nested
loops. Let me illustrate my problem, I have an array,named C, with
dimesions c(nr,nr,nt*n). I want to fill in a Tmat array according to the
rule as given below:
Tmat<-array(diag(nt*nr), c(nt*nr,nt*nr,n))
fo
Hello - I'm stumped on a lattice question. I'll start with my existing code:
library(lattice)
library(latticeExtra)
# no https for read.csv...
tab <- read.csv(pipe('curl -s https://raw.github.com/gist/6323455'))
fig <- barchart(assignment ~ freq | label,
groups=method,
One more question about avoiding copies when modifying lists. I would
like to call a function (call it 'f') that does an operation on a
large array according to a given index. For example
f = function(data, index) sum(data[index])
The idea is to repeatedly call f() with the same 'data' but differ
Dear Tom,
The Graphs -> Scatterplot dialog includes an option for a least-squares line
(which is checked by default).
Best,
John
---
John Fox
McMaster University
Hamilton, Ontario, Canada
> -Original Message-
> From: r-help-boun...@r-proje
Thanks a lot. It works
2013/8/23 Berend Hasselman
>
> On 23-08-2013, at 07:40, Marino David wrote:
>
> > Hi all R mailing listers:
> >
> > I am using the coda package. I tried to view the source of HPDinterval
> code
> > by typing fix(HPDinterval), it dispalys as follows:
> >
> > function (ob
I disagree with the characterization that setting TZ to anything but UTC yields
confusing results. If your time strings do not specify a time offset, then TZ
will be assumed, and if the assumed time zone accounts for daylight savings and
you don't want it to then you might be disappointed in the
Hi,
Possibly R FAQ 7.31
vec1[180]
#[1] 18
vec1[180]-18
#[1] 3.552714e-15
vec1[round(vec1,2)%in%vec2]
# [1] 2 4 6 8 10 12 14 16 18 20
A.K.
- Original Message -
From: Finlay Scott
To: r-help@r-project.org
Cc:
Sent: Friday, August 23, 2013 11:00 AM
Subject: [R] Unexpected behaviou
I need to print greek symbols IN ITALIC to eps-figures [ideally, using the
"Century Schoolbook" font family]. I've found many ways how to print e.g.
"mu", but didn't succeed to print "sigma", "rho" or other; even without the
"italic" or "font family" restriction.
An example:
postscript(file="work
Well if I understand correctly you want
data.csv$m <- rowSums(data.csv[, c(7,12,57,45)])
If you want something else please read Posting Guide and provide at least part
of your data and the result you want.
In the meantime It would be good for you to read at least R intro document
provided with
There a GUI menu option to do this in R Commander:
fit <- lm(y ~ x)
But is there an option to do this?
plot(x,y)
lines(x,predict(fit))
Thanks.
Tom
[[alternative HTML version deleted]]
__
R-help@r-project.org mailing list
https:/
Hi,
During the course of putting together a function I came across some
unexpected behaviour when using seq() and %in%.
I am creating two numeric vectors using seq(), and then using %in% to find
the values in one vector that are in the other. Sometimes all the values
are found, but sometimes a val
Hi,
I want to simulate multivariate data with > 1 distribution type. For
example, I would like one normal variate and one poisson variate with a
specified correlation structure. Is there a package that has this
implemented?
Thanks.
Chuck
[[alternative HTML version deleted]]
You need to:
1. Use this site for searching first: http://www.rseek.org
2. Ask better questions that we can understand.
Kevin
On Fri, Aug 23, 2013 at 7:52 AM, Waqas Shafqat wrote:
> please send me response surface codes of R
>
> [[alternative HTML version deleted]]
>
> ___
For sequential analysis of sequences of events, I want to calculate a
series of lagged
versions of a (numeric or character) variable. The simple function
below does this,
but I can't see how to generalize this to the case where there is also a
factor variable
and I want to calculate lags separa
On Aug 23, 2013, at 9:41 AM, Anindya Sankar Dey wrote:
> You can easily subset the data then use rowSum.
>
> say your dataset name is data1.
>
> then write data2<-data[,c(7,12,45,57)]
>
> then write result<-rowsum(data2)
In R there are two different functions `rowsum` and `rowSums`. The use y
On Aug 23, 2013, at 3:12 AM, Daniel Haugstvedt wrote:
> I am replying to my own question in case someone else finds this tread and
> needs help with the same problem. Thanks to Mark Leeds for helping me on my
> way. Any errors or flaws are mine since I have rewritten most of his comments
> to
Anna,
You forget to include
font.settings <- list( font = 1, cex = 1.3, fontfamily = "serif")
in this email, so it wasn't immediately reproducible.
The panel.bwplot.intermediate.hh function explicitly sets the outlier pch
to match
the median pch. Your controls did affect the cex of the outliers.
Hi Anindya,
If you have multiple tables and it is in a folder, you can use:
list.files() #I had three files in the working directory
#[1] "test1.txt" "test2.txt" "test3.txt"
library(data.table)
dt1<-rbindlist(lapply(list.files(),function(x)
read.table(x,header=FALSE,sep="")))
dt1
# V1 V2
#1:
Hi,
May be:
set.seed(24)
dat1<- as.data.frame(matrix(sample(1:50,145*160,replace=TRUE),ncol=160))
dat2<- dat1
dat1$m<-rowSums(dat1[,c(7,12,45,57)])
#or
dat2<-within(dat2,{m<-rowSums(cbind(V7,V12,V45,V57))}) #using column names
identical(dat1,dat2)
#[1] TRUE
A.K.
- Original Message -
You can easily subset the data then use rowSum.
say your dataset name is data1.
then write data2<-data[,c(7,12,45,57)]
then write result<-rowsum(data2)
On Fri, Aug 23, 2013 at 3:47 PM, rajib prasad wrote:
> I am new to R. I have a data like:
>
> x y z
Hi Silvano,
How about this?
id <- seq(80)
weight <- runif(80)
# randomize 4 groups with 'sample' function
group <- sample(rep(seq(4),20))
dat <- cbind(id, weight, group)
# ordered dataset by group
res <- data.frame(dat[order(group),])
# get mean and variance for each group
aggregate(res$weight
Hi,
I have a set of 80 animals and their respective weights. I
would like create 4 groups of 20 animals so that the groups
have means and variances with values ??very close.
How can I make this randomization in R?
Thanks,
--
Silvano Cesar da Costa
Departam
I am new to R. I have a data like:
x y z w p .. m
1 1015 20 25 30
2 11 1621 26 31
3 12 171819 20
Hi all
I have a short question relating to the usage of the summation sign in R.
Let's define A and B as two kxk matrices (which are constant).
C^(n) = Σ_(j=1)^n [(Σ_(i=1)^(j-1) A^i ) B (Σ_(i=1)^(j-1) A^i)’ ]
My goal is to calculate the matrix C for the periods from 1 to 200
(n=1-200).
How has
Hi all
I have a short question relating to the usage of the summation sign in R.
Let's define A and B as two kxk matrices (which are constant).
C^(n) = Ó_(j=1)^n [(Ó_(i=1)^(j-1) A^i ) B (Ó_(i=1)^(j-1) A^i) ]
My goal is to calculate the matrix C for the periods from 1 to 200 (n=1-200).
How has
Hi All,
Arun's solution is working.
Now can someone help me in just an expansion.
If we have multiple table like this, adding them in rbind is working, but
if I want a generic function where we do not know how many tables will be
created can that also be avoided from using loops.
On Fri, Aug
In the case of ?data.table()
dt1<-data.table(rbind(as.matrix(dat1),as.matrix(dat2))) ## converted the
data.frame to matrix to mimic the situation
dt2<- subset(dt1[,sum(V2),by=V1],V1!=0)
setnames(dt2,2,"V2")
dt2
# V1 V2
#1: 1 10
#2: 3 10
#3: 2 10
#or
res<-with(as.data.frame(rbind(a
Hello,
Try the following.
x1 <- read.table(text = "
1 10
3 5
0 0
")
x2 <- read.table(text = "
2 10
0 0
3 5
")
x3 <- merge(x1, x2, by = "V1", all = TRUE)
res <- data.frame(x3[1], sum = rowSums(x3[-1], na.rm = TRUE))
res <- res[-(res$sum == 0), ]
res
Hope this helps,
Rui Barradas
Em 23-
Hi,
Try:
dat1<- read.table(text="
1 10
3 5
0 0
",sep="",header=FALSE)
dat2<- read.table(text="
2 10
0 0
3 5
",sep="",header=FALSE)
res<-with(rbind(dat1,dat2),aggregate(V2~V1,FUN=sum))
res1<-res[res[,1]!=0,]
res1
# V1 V2
#2 1 10
#3 2 10
#4 3 10
#or
library(data.table)
dt1<- data.table(rbi
HI All,
Suppose I have two table like below
Table 1:
1 10
3 5
0 0
Table 2:
2 10
0 0
3 5
I need to create a new table like below
Table 3:
1 10
2 10
3 10
The row may interchange in table 3, but is there any way to do this instead
of writing lot of if-else and loops?
Thanks in advance.
please send me response surface codes of R
[[alternative HTML version deleted]]
__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and pr
Thank you!
-Original Message-
From: arun [mailto:smartpink...@yahoo.com]
Sent: 22 August 2013 17:17
To: Pancho Mulongeni
Cc: R help
Subject: Re: [R] converting a summary table to survey database form
Hi,
May be this helps:
dat1<- structure(...
dat1$ID<- row.names(dat1)
library(reshape
I am replying to my own question in case someone else finds this tread and
needs help with the same problem. Thanks to Mark Leeds for helping me on my
way. Any errors or flaws are mine since I have rewritten most of his comments
to make sure I understood them correctly.
First three general re
On 23/08/2013 10:06, Andreas Dibiasi wrote:
The CRAn binary is the first thing I tried. When using
install.packages("fame")
require(fame)
I get the following output:
under R x64:
install.packages("fame")
Installing package into ‘C:/APPS/R/R-3.0.1/library’
(as ‘lib’ is unspecified)
trying UR
The CRAn binary is the first thing I tried. When using
install.packages("fame")
require(fame)
I get the following output:
under R x64:
> install.packages("fame")
Installing package into C:/APPS/R/R-3.0.1/library
(as lib is unspecified)
trying URL
'http://cran.rstudio.com/bin/windows/contri
Hi,
I am trying to fit a smoothing model where there are three dimensions
over which I can smooth (x,y,z). I expect interactions between some,
or all, of these terms, and so I have set up my model as
mdl <- gam(PA ~ s(x) + s(y) + s(z) + te(x,y) + te(x,z) + te(y,z) +
te(x,y,z),...)
I have recentl
HI,
May be this works:
row.names(MyDF)[c(0,diff(MyDF[,3]))==0|c(0,diff(MyDF[,3]))>1]
#[1] "1" "5" "8"
A.K.
Hi,
Here i have a dataframe called MyDF.
a<- c(1,1,1,1,1,1,1,0,1,1)
b<-c(1,1,0,1,1,0,0,0,1,1)
c<-c(1,2,3,1,1,2,0,5,6,1)
d<-c(1,1,1,1,1,1,1,1,0,1)
MyDF<-data.frame(DWATT=a,TNH=b,CSG
OK, I understand. I should probebly have noticed that.
Why can I not control outlier pch=c(...) when using this code? I want all
outliers to be circles and the medians only defined by pch 2-4.
New dummy data with outliers:
mydata<- data.frame(factor1 = factor(rep(LETTERS[1:3], each = 21)), #Dummy
Hello,
In labcurve, use "keys=c(19,5)". It is said in examples provided in the
help page.
You should also modify the following lines:
> lines(timeseries,dataseries1,col="red",type="l")
> lines(timeseries,dataseries2,col="blue",type="l")
Regards,
Pascal
2013/8/23 Igor Ribeiro
> Dear all,
> I
Sibylle Stöckli gmx.ch> writes:
>
> I applied vegan's varpart function to partition the effects of
> explanatory matrices. Adj. R square for the unique fraction [a] is
> 0.25. Does anyone know why the decomposition by hand using rda gives
> me a different result for [a] (constrained proport
On 23-08-2013, at 07:40, Marino David wrote:
> Hi all R mailing listers:
>
> I am using the coda package. I tried to view the source of HPDinterval code
> by typing fix(HPDinterval), it dispalys as follows:
>
> function (obj, prob = 0.95, ...)
> UseMethod("HPDinterval")
> Then I search the ans
46 matches
Mail list logo