Displaying 18 results from an estimated 18 matches similar to: "the bar width of barchart plot in lattice package"
2011 Aug 31
3
how to create data.frames from vectors with duplicates
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. Thanks
--
Best,
Zhenjiang
2011 Mar 15
3
how to reshape the data.frame from long to wide in a specific order
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 first 12.3
1 M second 10.7
2 F control 6.3
2 F first 10.6
2 F second 11.1
3 F control 9.5
3
2011 Aug 05
4
a question on list manipulation
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
2010 Aug 10
4
matrix problem
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 0 0.2
[3,] 0.3 0 0
How can I do it efficiently? Thanks.
--
Best,
Zhenjiang
[[alternative HTML version deleted]]
2011 Aug 02
2
how to control to save plots to which dev
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
2012 Jun 12
4
How to index a matrix with different row-number for each column?
here's my question: suppose I have a matrix:
mt<-matrix(1:12,ncol=6)
now I have a vector
vt<-c(1,2,2,2,1,2)
which means I want to get:
the 1st row for column1;
the 2nd row for column2;
the 2nd row for column3;
the 2nd row for column4;
...
that what I want is this vector:
1,4,6,8,9,12
Does anyone know how to do this fast?
I know I can use for-loop to travel all columns,but
2011 Apr 15
1
how to add two data.frame with the same column but different row numbers
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]]
2011 Aug 29
1
sum of two lists
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
[[alternative HTML version
2010 Nov 10
1
ggplot2 problem in interacting mode
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 required package: proto
> data(VADeaths)
> pg <- ggplot(melt(VADeaths),
2011 Aug 24
1
read.table truncated data?
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
> a=read.table('all/isoform_exp.diff', header=T, sep='\t')
> nrow(a)
2011 Aug 31
1
counting the duplicates in an object of list
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
2010 Apr 29
1
a question on autocorrelation 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 autocorrelation of a sine function should give a
cosine; however, the following code gives a
2010 Apr 22
1
how to reorder of groups and specify ylim for each row in lattice barchart
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),auto.key = list(points = FALSE, rectangles = TRUE, space =
"right"),ylab = "Barley Yield
2008 Dec 10
0
FW: Kegg.db with GOstats
-----Original Message-----
From: Robert Gentleman [mailto:rgentlem@fhcrc.org]
Sent: Wed 10/12/2008 18:47
To: Legaie, Roxane
Subject: Re: Kegg.db with GOstats
Hi Roxanne,
Can you redirect your question to the mailing list. And, you can find the
answer in the mailing list archives...
best wishes
Robert
Legaie, Roxane wrote:
> Dear Robert Gentleman,
> I am currently working on
2010 Nov 10
0
error bars in lattice barchart
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 without luck. Here is my code (I
changed prepanel.ci and panel.ci a little to plot bars
2004 Jan 22
1
Bug repport
I have installed openssh-3.7.1p2(and its Run-time dependencies), from Software Porting And Archive Centre for HP-UX, on an HP rx2600 OS-version 11.23.
When I now try to use ssh to this server it works but the DISPLAY environment variable is not set.
I get this line in syslog.log on the server
Jan 16 10:24:25 sabina sshd[8979]: Accepted publickey for s66103 from 136.163.6.9 port 53117 ssh2
Jan
2012 May 22
3
How to remove square brackets, etc. from address strings?
Hello,
I'd like to remove the individual pairs of square brackets along with
their content - plus the space directly behind it - from address strings
such as this:
[Swidsinski, Alexander; Loening-Baucke, Vera; Lochs, Herbert] Charite
Humboldt Univ, Innere Klin, D-10098 Berlin, Germany; [Hale, Laura P.]
Duke Univ, Med Ctr, Dept Pathol, Durham, NC 27710 USA
I'd like get the
2014 Feb 26
3
error en ifelse
Hola gente!! Estoy empezando a trabajar con R, y no puedo resolver lo
siguiente:
Quiero crear una nueva variable (datmatriz) que toma el valor de 1 si:
-la variable sp es igual a L.lucidum
-alguna de las variables pap11, pap06, pap01, pap96 es igual a muerto.
El script que utilicé es :
guaran$datmatriz<-ifelse (guaran$sp=="L.lucidum"|guaran$pap11 ==