Displaying 20 results from an estimated 7000 matches similar to: "two plots in qplot"
2011 Jun 10
1
ggplot2 avoid automatic color selection
Hey all,
I'm trying to replicate some plots with ggplot2. The problem is that I
need to specify the color for every
attribute (drug). If I use the code below the colors get automatically
assigned but I need to plot drug1 in black drug2 in blue
etc.
How do I do that?
q = qplot(days,vol,data = cellLine7064, color = drug, geom = c("line", "point"))
best regards,
Immanuel
2008 Mar 04
1
qplot (ggplot2) faceting histogram with missing values
Hi,
I've run into a difficulty with qplot function (in the ggplot2
package). I can facet histograms even when the faceting variable
contains missing values, but only so long as the faceting variable is
not a factor.
Example:
y1 <- rnorm(10)
x1 <- c(rep(1,5), rep(2,4), NA)
x2 <- factor(c(rep(1,5), rep(2,4), NA))
library(ggplot2)
qplot(y1, geom = "histogram", facets =
2008 Jul 04
1
Repeated measures lme or anova
Hi
As I can't find an example of my data structure I'd like some advice on which is the most appropriate test for significant effects. If I should be using either lme or anova, is the relevant example below the best/correct way to do the test?
The Data...
2 groups of patients (5 in GroupA, 7 in GroupB)
3 short acting drugs, (I'm not concerned with residual effects from the previous
2011 Feb 08
1
Just another pattern matching / indexing question
Hi all, thank you for your patience.
I am dealing with a large dataset detailing patients and medications
Medications are hard to code, as they are (usually) meaningless unless
matched with doses.
I have a dataframe with vectors (Drug1, Drug2..... Drug 16) and individual
patients are represented by rows.
The vectors are actually factors, with 100s of possible levels (all the
drugs the patient
2012 Nov 29
2
Analysis of Variance
Hi, I am encountering a difficulty I don't understand. Be patient, I'm very
new to analysis of variance.
If I load this data:
example12_7=read.table("http://msemac.redwoods.edu/~darnold/math15/data/chapter12/example12_7.dat",header=TRUE)
The run the oneway.test:
oneway.test(time~drug,data=example12_7,var.equal=TRUE)
I get these results:
data: time and drug
F = 4.1881, num
2007 Jul 05
3
summarizing dataframe at variable/factor levels
All,
Is there an efficient way to apply say "mean" or "median" to a dataframe
according to say all combinations of two variables in the dataframe?
Below is a simple example and the outline of a "manual" solution that
will work but is not very efficient
(could also generalize this to a function). Searched the archives and
docs but didn't see anything close to
2011 Sep 28
1
number of items to replace is not a multiple of replacement length
Please help with this error message
drugbook is an 885 x 32 dataframe
>names(drugbook)
[1] "DRUG1" "DRUG2" "DRUG3" "DRUG4" "DRUG5"
[6] "DRUG6" "DRUG7" "DRUG8" "DRUG9" "DRUG10"
[11] "DRUG11" "DRUG12"
2010 Aug 23
2
change order of plot panels in faceted ggplot/qplot
Hi,
I have a 5-paneled figure that i made using the facet function in
qplot (ggplot). I've managed to arrange the panels into two rows/
three columns, but for the sake of easy visual comparisons between
panels in my particular dataset, I want to have the two plots on the
bottom align on the right hand side of the figure instead of the left.
Here's an example:
m <-
2011 Jun 07
2
ggplot2 and facet
I have a data frame (attached) that has interpolated EOT errors for
each minute before flight landing. It also has the runway and an index
for the flight:
> > times[1:4,]
time error runway flight
1 0 -0.02206235 04R 1
2 1 -0.07961631 04R 1
3 2 -0.13795380 04R 1
4 3 -0.20726073 04R 1
> > sapply(times, class)
time error
2007 Sep 12
1
stastistical test on normalized data
Dear R-maillit,
I have to perform a stastistical test to asses if two grug show the same or different effect on my prepartion.
I tested on the same preparation only one drug and I have to use normalized data due to high variability in the control condictions.
What type can I use?
A non paramatric test right?
And how can do it on R software?
Thanks in advance
Simone
[[alternative HTML version
2011 Jun 06
2
qplot fill and colour not working as expected
I am just learning to use qplot and can't get the fill/colour to work. Below
is the R code for a scatter plot and bar graph.
library(ggplot2)
x<-c(1,2,3,4,5,6,7)
y<-c(1,2,3,2,5,6,3)
qplot(x,y, main="Scatter Plot Test", xlab="X Label Test", ylab="Y Label
Test", colour="blue")z<-c("van", "van", "van",
2008 May 12
1
Converting qqplot2 qplot() to grammar?
Hello all,
I've been using the following qplot command:
qplot(pixX,pixY, data=som, geom="tile", fill=rgb) +
scale_fill_identity() + opts(aspect.ratio = .75) + facet_grid(unitX ~ unitY)
Now I would like to convert it into the explicit ggplot grammar, so I
can remove the extras: axes, labels, background, borders, facet labels,
and extra white-space around the plot. (If anyone has
2009 Mar 12
3
Unable to run smoother in qplot() or ggplot() - complains about knots
I get the following error when I run qplot()
qplot(grade, read,data = hhm.long.m, geom = c("point", "smooth"))
Error in smooth.construct.cr.smooth.spec(object, data, knots) :
x has insufficient unique values to support 10 knots: reduce k.
I am not sure how to tackle this problem. When I take a subsample (<
1000) than I am able to run that function but with my sample
2009 Feb 04
1
In qplot, is it possible to switch the location of axis_h and strip_h?
That is qplot, is it possible to switch the location of axis_h and strip_h?
I produced a plot where I would like to have the strip_h on the bottom and the axis_h on the top of the facet plot. Is that possible?
P.S. I figured out how to not show the x-axis ticks, while still showing the x-lablel.
There is probably a better way, but here is what I found that seems to work:
2011 Sep 13
3
ggplot - class "character" problem
Hi
I'm trying to use ggplot2 to chart a dataset that I've drawn in from
excel.? When I run the qplot command, I get the following error
message:
Error: ggplot2 doesn't know how to deal with data of class character
It feels like I need to coerce one of the fields in my data frame.
Here's the code, which is short:
#draw data in from network location
2012 Jun 27
3
qplot and colors (Please Help)
Please help:
I am using qplot as below and want to specify a different color scheme for race but dont know how, can someone show me.
Thanks in advance
Code and input file below:
library(ggplot2)
library(gridExtra)
d<-read.table("results", header=TRUE, fill=TRUE)
plot2<-qplot(X,Y,data=d,color=race,facets=TYPE~., xlab="X", ylab="Y") + theme_bw()
2009 Jun 10
1
ggplot, qplot: alpha channel for colors corresponding to factor
Hi,
I have a qplot like the one in the minimal example below, except I
also have faceting like this:
qplot(jitter(Goodall),jitter(Better.adapt),colour=Second.adapt,facets=~Pol,data=d1)
and with the real data I get quite a lot of overplotting, so I would
like to add an alpha channel.
In addition, I would like to be able to control which colors are used
for each value of Second.adapt (which
2007 Jul 03
1
xyplot and autokey, maintaining colors specified via "col" in key
All,
When specifying colors to xyplot w/ a groups argument, using
auto.key no longer maintains the colors properly. I've searched
the docs and help but haven't found exactly what I need ... I saw
a few examples in the archives involving par.settings but that doesn't
seem to do it. I also saw some people using key instead of auto.key, but
that didn't seem consistent. Is there a
2008 Jul 10
1
layout is to xyplot as ??? is to qplot
Playing with ggplot, something I'd promised myself I'd get around to. I've
the following scenario:
library(lattice)
library(ggplot2)
myData <- data.frame(
x = rnorm(100),
y = rnorm(100),
group = 1:4
)
xyplot(y ~ x | factor(group), data = myData, layout = c(2, 2))
qplot(x, y, facets = ~ group, data = myData)
In this code the lattice example gives me a 2x2 layout, whereas
2012 Nov 09
1
R function data variable name argument
Hello fellow R-ers,
I have spent some time on this and it is driving me NUTS! I am sure there is a solution, so please help.
I am trying to create a function that will plot different lines for subsets of a dataset. For example, I am trying to look at different drug groups (drug2), let's say 1,2,3,4, and 5. The data has 2 different rates, college students and high school students (var names cs