or match. The best
>
> solution would be to avoid the internal use of deparse
>
> when using match() or unique() on lists and to hash the
>
> list element directly, but that is a fair bit of work.
>
> ** **
>
> Bill Dunlap
> Spotfire, TIBCO Software
> wdunlap ti
> ***
>
> to match. E.g.,
>
> ac <- sapply(a, function(ai) paste(collapse="\n", deparse(ai)))
>
> and use match on that. You can use the indices it returns on
>
> the original list.
>
> ** **
>
> Bill Dunlap
> Spotfire, TIBCO Software
&
0.160.030.18
> > system.time(with(dt, rowsum(x, y)))
> user system elapsed
> 0.360.040.40
> > system.time(with(dt, tapply(x, y, sum)))
> user system elapsed
> 8.770.339.11
>
> HTH,
> Dennis
>
>
> On Wed, Sep 7, 2011 at
;
[31] "YMR050C" "YOLWTy1-1" "YOL103W-B" "YORWTy1-2" "YOR142W-B" "YPLWTy1-1"
[37] "YPL257W-B" "YPRCTy1-2" "YPR137C-B" "YPRWTy1-3" "YPR158W-B"
[[4]]
[1] "YARCTy1-1" "YA
(data)
>
> to see that size is as expected.
>
> Regards
> Petr
>
> >
> > On Thu, Aug 25, 2011 at 11:57 AM, jim holtman
> wrote:
> >
> > > But did you try the following:
> > >
> > > x <- read.table(, comment.char =
1 at 9:50 AM, Jorge I Velez
> wrote:
> > Hi Zhenjiang,
> >
> > Try
> >
> > table(unlist(mapply(function(x, y) rep(x, y), y, x)))
>
> Yikes! How about simply tapply(x,y,sum) ??
> ?tapply
>
> -- Bert
> >
> > HTH,
> > Jorge
> &g
t the best depends on what you want to do with the
> data.
>
> Bill Dunlap
> Spotfire, TIBCO Software
> wdunlap tibco.com
>
> > -Original Message-
> > From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org]
> On Behalf Of zhenjiang xu
> > S
Hi R users,
suppose I have two vectors,
> x=c(1,2,3,4,5)
> y=c('a','b','c','a','c')
How can I get a data.frame like this?
> xy
count
a 5
b 2
c 8
I know a few ways to fulfill the task. However, I have a huge number
of this kind calculations, so I'd like an efficient solution. T
Thanks, Henrique. It works.
On Mon, Aug 29, 2011 at 6:45 PM, Henrique Dallazuanna wrote:
> Try this:
> as.list(colSums(merge(m, n, all = TRUE), na.rm = TRUE))
>
> On Mon, Aug 29, 2011 at 7:39 PM, zhenjiang xu
> wrote:
>>
>> Hi R users,
>>
>> Suppose I
Hi all,
I have a list x:
> x=list(a=c('1','2'),b=c('2','3'),c=c('1','2'),d=c('2','3'))
I can get the unique elements with unique(), but how can I get the
number of duplicates for each unique elements?
> unique(x)
[[1]]
[1] "1" "2"
[[2]]
[1] "2" "3"
Thanks
--
Best,
Zhenjiang
___
Hi R users,
Suppose I have two lists and the names of list 'm' are a subset of those of
'n', how can I sum the two lists with corresponding elements added together
to get list 'o'?
> n = list("a"=1,"b"=3,"c"=5)
> m = list('b'=4)
> o
$a
[1] 1
$b
[1] 7
$c
[1] 5
Thanks
--
Best,
Zhenjiang
somewhere in your data.
> use a text editor and search for single and double quotes.
>
> On Thu, Aug 25, 2011 at 11:49 AM, zhenjiang xu
> wrote:
> > Thanks for your replies. I looked at those lines and didn't spot anything
> > unusual.
> >
> >> tail(a)
>
.0121587 yes
ETS1-2 - ETS1-2 chr12:466869-467569 WT air2rrp6OK
3258.97 1114.76 -1.072772.91211 0.00359 0.0121597 yes
On Wed, Aug 24, 2011 at 2:34 PM, Sarah Goslee wrote:
> Hi,
>
> On Wed, Aug 24, 2011 at 2:18 PM, zhenjiang xu
> w
Hi R users,
I was using read.table to read a file. The data.fame looked alright, but I
found not all rows are read by the read.table. What's wrong with it? It
didn't give me any warning or error messages. Why the data are truncated?
Thanks.
$ wc -l all/isoform_exp.diff
42847 all/isoform_exp.diff
gt;
>
> Of course this version will have some problems if the names of your list
> elements end with digits that you don't want stripped off (but you can work
> around that by preprocessing the list names).
>
> --
> Gregory (Greg) L. Snow Ph.D.
> Statistical Data Cent
hy wrote:
> Hi:
>
> Your clarification suggests Duncan was on the right track, so how about this:
>
> x <- list(A=c("d", "e", "f"), B=c("d", "e"), C=c("d"))
> x2 <- unique(unlist(x))
> w <- lapply(x, functi
verse the matching, from all the elements to the
names of the list.
On Fri, Aug 5, 2011 at 12:53 PM, Duncan Murdoch
wrote:
> On 05/08/2011 12:05 PM, zhenjiang xu wrote:
>>
>> Hi R users,
>>
>> I have a list:
>> > x
>> $A
>> [1] "a" "b&
help
page more carefully. Thanks.
On Fri, Aug 5, 2011 at 12:02 PM, Duncan Murdoch
wrote:
> On 05/08/2011 11:49 AM, zhenjiang xu wrote:
>>
>> Thanks, Prof Ripley. I was using dev.next(), dev.prev(),, but I am
>> wondering, instead of switching the current dev, is there a way to
>
Hi R users,
I have a list:
> x
$A
[1] "a" "b" "c"
$B
[1] "b" "c"
$C
[1] "c"
I want to convert it to a lowercase-to-uppercase list like this:
> y
$a
[1] "A"
$b
[1] "A" "B"
$c
[1] "A" "B" "C"
In a word, I want to reverse the list names and the elements under
each list name. Is there any quic
confused which dev is the current
one.
On Tue, Aug 2, 2011 at 1:28 AM, Prof Brian Ripley wrote:
> On Tue, 2 Aug 2011, David Winsemius wrote:
>
>>
>> On Aug 1, 2011, at 11:14 PM, zhenjiang xu wrote:
>>
>>> Hi,
>>>
>>> I have a for loop to make 2
Hi,
I have a for loop to make 2 types of plots and I'd like to save one
type of plots to a pdf file and the other to another pdf file. How can
I control which plot will be saved to which pdf? Thanks
--
Best,
Zhenjiang
__
R-help@r-project.org mailing l
Thanks, Gabor. It's a nice workaround. I'll look more at zoo library.
On Fri, Apr 15, 2011 at 7:10 PM, Gabor Grothendieck wrote:
> On Fri, Apr 15, 2011 at 6:10 PM, zhenjiang xu
> wrote:
> > Thanks, Dennis! I'll go with it. It's surprising there is no ready wa
fm
> x y z
> 1 a 1 6
> 2 b 2 NA
> 3 c 3 1
> sumdf <- data.frame(x = dfm$x, y = rowSums(dfm[, -1], na.rm = TRUE))
> x y
> 1 a 7
> 2 b 2
> 3 c 4
>
> HTH,
> Dennis
>
> On Fri, Apr 15, 2011 at 1:31 PM, zhenjiang xu
> wrote:
> > Hi all,
> >
&g
Hi all,
Suppose I have 2 data.frame , a and b, how can I add them together to get c?
Thanks
> a
A
a 1
b 2
c 3
> b
A
a 6
c 1
> c
A
a 7
b 2
c 4
--
Best,
Zhenjiang
[[alternative HTML version deleted]]
__
R-help@r-project.org mailing lis
Hi,
For example, the data.frame like:
origdata.long <- read.table(header=T, con <- textConnection('
subject sex condition measurement
1 M control 7.9
1 M first12.3
1 Msecond10.7
2 F control 6.3
2 F first
Hi all,
When running R interactively, I have the problem as following:
> library(ggplot2)
Loading required package: reshape
Loading required package: plyr
Attaching package: 'reshape'
The following object(s) are masked from 'package:plyr':
round_any
Loading required package: grid
Loading
Hi all,
I've read the emails of Dan, Deepayan and Sundar about adding error bars to
the lattice plots (
https://stat.ethz.ch/pipermail/r-help/2006-October/114883.html), but I still
have the problem when I want to adding error bars to barchart. I tried both
the solution of Deepayan and Sundar but w
Hi,
I have a file like this:
1 2 0.1
2 3 0.2
3 1 0.3
And I want to read it to create a matrix like this:
[,1] [,2][,3]
[1,]0 0.1 0
[2,]0 00.2
[3,]0.300
How can I do it efficiently? Thanks.
--
Best,
Zhenjiang
[[alternative HTM
Hi R users,
How can I display the corresponding value inside each little square of level
plot plotted by the following code?
> data(Cars93, package = "MASS")
> cor.Cars93 <- cor(Cars93[, !sapply(Cars93, is.factor)], use = "pair")
> levelplot(cor.Cars93, aspect = 1, scales = list(x = list(rot = 90)
t.
On Thu, Apr 29, 2010 at 7:08 PM, Duncan Murdoch wrote:
> On 29/04/2010 6:22 PM, zhenjiang xu wrote:
>
>> Hi R users,
>>
>> where can I find the equations used by acf function to calculate
>> autocorrelation?
>>
>
> See the reference listed in ?acf.
Hi R users,
where can I find the equations used by acf function to calculate
autocorrelation? I think I misunderstand acf. Doesn't acf use following
equation to calculate autocorrelation?
[image: R(\tau) = \frac{\operatorname{E}[(X_t - \mu)(X_{t+\tau} -
\mu)]}{\sigma^2}\, ,]
If it does, then the a
7;' in mylist()
> with appropriate c(,) code? For example:
>
> mylist <- list(c(0,30), c(40,80), c(0,50),
> c(0,50), c(0,50), c(0,50))
>
> -Peter Ehlers
>
>
> On 2010-04-23 9:22, zhenjiang xu wrote:
>
>> Peter, thanks, but that do
Hi,
I have a data.frame object:
> a.df
Methods Score
1 Northern 1.3544227
2 Northern 0.8302436
3 RT-PCR 1.0011360
4 RT-PCR 1.1149423
If I write it out with write.table,
> write.table(a.df, file = 'data.txt', quote = FALSE, sep = '\t', row.names
= FALSE)
the data.txt is looks like:
Me
probably yes. I plotted each row individually instead. Thanks
On Fri, Apr 23, 2010 at 11:14 AM, Deepayan Sarkar wrote:
> On Wed, Apr 21, 2010 at 8:55 PM, David Winsemius
> wrote:
> >
> > On Apr 21, 2010, at 9:51 PM, zhenjiang xu wrote:
> >
> >> I tried that.
ley Yield (bushels/acre)",scales = list(x = list(rot =
45), y=list(relation='free', ylim=mylist)))
On Thu, Apr 22, 2010 at 7:54 PM, Peter Ehlers wrote:
> On 2010-04-21 21:13, zhenjiang xu wrote:
>
>> R experts,
>>
>> Is there anyway to reorder inside each
R experts,
Is there anyway to reorder inside each group? In the following example, the
bar of year 1932 is always plotted before the bar of year 1931, may I change
the order inside each groups of bars?
library(lattice)
barchart(yield ~ variety | site,data=barley, groups = year, layout =
c(1,6),au
I tried that. It seems the bar width is already maximized, although there is
a lot of space between groups of bars. Thank you anyway.
On Tue, Apr 20, 2010 at 10:16 AM, David Winsemius wrote:
>
> On Apr 20, 2010, at 9:46 AM, zhenjiang xu wrote:
>
> Dear R users,
>>
>>
Dear R users,
I am trying to use the following code to make a barchar plot. The bars in
the plot turn out to be a little narrow. Is there any way to modify the
width of the bars? Thank you!
library(lattice)
scores = gl(2, 5, label=c('Sensitivity', 'PPV'), length = 100)
sequences = gl(5, 1, label=
38 matches
Mail list logo