Displaying 20 results from an estimated 2000 matches similar to: "ggplot2 and facet"
2011 Jun 08
3
How to suppress factor labels
I am using ggplot2 to make a boxplot that overlays a scatterplot:
pp = qplot(time, error, data=times, size=I(1), geom="jitter", main=title,
ylab="Error (min)", xlab="Time before ON (min)", alpha=I(1/10),
color=times$runway,
ylim=c(-30,40))
pp2 = pp + with(times, facet_wrap(~ runway, ncol=2))
print(pp2 + geom_boxplot(alpha=.5,
2011 Jun 10
1
Double x grid in ggplot2
I am trying to overlay raw data with a boxplot as follows:
pp = qplot(factor(time, levels=0:60, ordered=TRUE),
error, data=dfsub, size=I(1), main =" title", ylab="Error
(min)",
xlab="Time before ON (min)", alpha=I(1/10),
ylim=c(-30,40), geom="jitter") +
facet_wrap(~ runway, ncol=2) +
2010 Mar 20
3
How to select a row from one dataframe that is "close" to a row in another dataframe
I have two data frames of flight data, but they have very different
numbers of rows. They come from different sources, so the data are not
identical.
> names(oooi)
[1] "FltOrigDt" "MkdCrrCd"
[3] "MkdFltNbr" "DprtTrpnStnCd"
[5] "ArrTrpnStnCd" "ActualOutLocalTimestamp"
2011 May 25
2
Importing fixed-width data
I have a data set where the lines look like:
2011-05-13 00:00:00 EONAAL330 dfa13002516PSCNONA
2011-05-13 00:00:01 EONAAL223 laa13044510AS.NONM
Some lines are missing the field before and after the NON:
2011-05-13 00:00:05 EONBHS229 mia13001621NON
I read them into R using
df = read.fwf(file, widths=c(19,-4,7,3,8,2,1,3,1),
2011 Aug 27
2
Am having trouble calling a function
In my main R program, I have
source("retaanalysis/Functions/doAirport.R")
.... stuff to read data and calculate ads
sapply(ads, function(x) {doAirport(x, base)} )
And doAirport has
# analyze the flights for a given airport
doAirport = function(df, base) {
# Get rid of unused runway factor levels (from other airports)
df$lrw <- drop.levels(df$lrw) # In gdata package
#
2010 Apr 09
2
How to use tapply for quantile
I am trying to calculate quantiles of a data frame column split up by
two factors:
# Calculate the quantiles
quarts = tapply(gdf$tt, list(gdf$Runway, gdf$OnHour), FUN=quantile,
na.rm = TRUE)
This does not work:
> quarts
04L 04R 15R 22L 22R 27 32
33L 33R
0 NULL Numeric,5 NULL Numeric,5 NULL Numeric,5 NULL
Numeric,5 NULL
1 NULL
2010 Apr 16
6
bwplot puts the bars in the wrong place
Dear R-Help,
With the attached data set, I am still getting incorrect bwplots
> xyplot(gdf$tt~gdf$OnHour |gdf$Runway, data=gdf) # Is correct
> bwplot(gdf$tt~gdf$OnHour |gdf$Runway, data=gdf, horizontal=FALSE) #
Puts the boxes on the wrong x-axis values
# look especially at 0 and 3. How do I fix this?
What is happening?
Thanks,
Jim Rome
2009 Oct 06
1
ggplot2 applying a function based on facet
Look at the bottom of the message for my question
#here is a little function that I wrote
USGS <- function(input="discharge", days=7){
library(chron)
library(gsubfn)
#021973269 is the Waynesboro Gauge on the Savannah River Proper (SRS)
#02102908 is the Flat Creek Gauge (ftbrfcms)
#02133500 is the Drowning Creek (ftbrbmcm)
#02341800 is the Upatoi Creek Near Columbus (ftbn)
#02342500 is
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 <-
2010 Apr 01
2
pdf files in loops
I need to make a bunch of PDF files of histograms. I tried
gatelist = unique(mdf$ArrivalGate)
for( gate in gatelist) {
outfile = paste("../", airport, "/", airport, "taxiHistogram", gate,
".pdf", sep="")
pdf(file = outfile, width = 10, height=8, par(lwd=1))
title=paste("Taxi time for Arrival Gate", gate, "by
2010 Jan 16
3
Comparing dates in dataframes
I have two data frames. One (arr) has all arrivals to an airport for a
year, and the other (gw) has the dates and quarter hour of the day when
the weather is good. arr has a Date and quarter hour column.
>names(arr)
[1] "Date" "weekday" "hour" "month" "minute"
[6] "quarter" "ICAO"
2011 Jul 17
1
How to speed up interpolation
df is a very large data frame with arrival estimates for many flights
(DF$flightfact) at random times (df$PredTime). The error of the estimate
is df$dt.
My problem is that I want to know the prediction error at each minute
before landing. This code works, but is very slow, and dominates
everything. I tried using split(), but that rapidly ate up my 12 GB of
memory. So, is there a better R way of
2008 Mar 26
2
Range across a List
Hi R,
I have a list
> class(pp2)
[1] "list"
> length(pp2)
[1] 1244
It is in the below format
RIC Trade.Date Close.Price Currency.Code Convertion.Rate New.Price
ABCD.SZ 2008/02/29 15.30 CNY 0.1408 2.154240
ABCD.SZ 2008/01/31 15.27 CNY 0.1392 2.125584
ABCD.SZ 2007/12/31 14.88 CNY 0.1371 2.040048
2010 Feb 01
3
merging data frames gives all NAs
Dear kind R helpers,
I have a vector of runway names in rwy ("31R", "31L",... the number is
user selectable)
arrgnd is a data frame with data for all flights and all runways, with a
Runway column.
I am trying to subset arrgnd into a dat frame for each selected runway,
and then combine them back together using the following code:
for (j in 1:nr) { # nr = number of
2011 Sep 30
2
ggplot2 - extracting values of smooth
Suppose that I'm working on Hadley's diamond dataset and I want to
review the relationship between price, colour and carat.
I might run the following:
library(ggplot2)
#plot scatter and add some hex binning
q<-qplot(carat,price,data=diamonds, geom=c("hex"),
main="Variability of Diamond Prices by Carat and Colour")
#facet to get one scatter for
2010 May 18
2
Function that is giving me a headache- any help appreciated (automatic read )
note: whole function is below- I am sure I am doing something silly.
when I use it like USGS(input="precipitation") it is choking on the
precip.1 <- subset(DF, precipitation!="NA")
b <- ddply(precip.1$precipitation, .(precip.1$gauge_name), cumsum)
DF.precip <- precip.1
DF.precip$precipitation <- b$.data
part, but runs fine outside of the function:
days=7
2013 Mar 07
3
ggpliot2: reordering of factors in facets facet.grid(). Reordering of factor on x-axis no problem.
Hi everyone (again),
before you all start screaming that the reordering of factors has been
discusse on several threads and is not particular to ggplot2, hear me out.
I can easily reorder my x-axis factor in facet.grid() in ggplot2. What I
cannot reorder are the factors represented on the strips. I can see that the
graphs are changing, so I am afraid of what it is I am doing. Why is ggplot2
2010 May 31
1
Can not save plot to png file correctly
You can save as png like this too:
library(ggplot2)
data=data.frame(
? X=sample(10,1000,replace=T)
? , Y=letters[1:10])
png("mypng.png")
qplot(X, data=data, geom='histogram') + facet_wrap( ~ Y)
dev.off()
?
Felipe D. Carrillo
Supervisory Fishery Biologist
Department of the Interior
US Fish & Wildlife Service
California, USA
----- Original Message ----
> From: Peng Yu
2013 Oct 03
1
version comparison puzzle
Can anyone explain what I'm missing here?
max(pp1 <- package_version(c("0.99999911.3","1.0.4","1.0.5")))
## [1] ?1.0.4?
max(pp2 <- package_version(c("1.0.3","1.0.4","1.0.5")))
## [1] ?1.0.5?
I've looked at ?package_version , to no avail.
Since max() goes to .Primitive("max")
I'm having trouble figuring out
2009 Aug 11
1
ggplot2: override facet names in facet_wrap?
just a quick question (to which I suspect the answer is "no"):
does anyone know if, in the ggplot2 package, there's a way to
override the default names of the facets in facet_wrap (which
correspond to the levels of the factor used to facet)? I know
that I go back and change the levels of the factor, but it would
be convenient to be able to supply a vector of level names at
the time