similar to: ggplot question

Displaying 20 results from an estimated 1000 matches similar to: "ggplot question"

2007 Apr 23
1
data recoding problem
Hi R experts, I have a data recoding problem I cant get my head around - I am not that great at the subsetting syntax. I have a dataset of longitudinal toxicity data (for multistate modelling) for which I want to also want to do a simple Kaplan-Meier curve of the time to first toxic event. The data for 2 cases presently looks like this (one with an event, the other without), with id representing
2007 Feb 26
2
how to fill between 2 stair plots
Hi all, I want to create a simple plot with 2 type='s' lines on it: plot(a, b, type='s') lines(x, y, type='s') I wish to then fill the area between the curves with a colour to accentuate the differences eg col=gray(0.95). I cant seem to come up with a simple method for this. Any pointers in the right direction much appreciated. Cheers Scott
2011 Jun 07
1
extract data features from subsets
I have a large dataset similar to this: ID time result A 1 5 A 2 2 A 3 1 A 4 1 A 5 1 A 6 2 A 7 3 A 8 4 B 1 3 B 2 2 B 3 4 B 4 6 B 5 8 I need to extract a number of features for each individual in it (identified by "ID"). These are: * The lowest result (the nadir) * The time of the nadir - but if the nadir level is present at >1 time point, I need the minimum and maximum time of nadir
2012 Nov 09
3
Looking for a test of standard normality
Dear list members, I am looking for a goodness of test that will tell me if a sample is likely to have come from a standard normal distribution. I can find plenty of omnibus tests for normality in the nor.test package, but none of them appear to allow me to test against the specific alternative that the data are not standard normal. My back up option is to use a Kolmogorov-Smirnov test, but my
2007 Feb 15
1
bootcov and cph error
Hi all, I am trying to get bootstrap resampled estimates of covariates in a Cox model using cph (Design library). Using the following I get the error: > ddist2.abr <- datadist(data2.abr) > options(datadist='ddist2.abr') > cph1.abr <- cph(Surv(strt3.abr,loc3.abr)~cov.a.abr+cov.b.abr, data=data2.abr, x=T, y=T) > boot.cph1 <- bootcov(cph1.abr, B=100, coef.reps=TRUE,
2009 Jul 28
2
Density plot in ggplot2
Hi all, I was trying to draw a stacked density plot like that : library(ggplot2); library(plyr) dat <- cbind(rnorm(300), rep(c(1,2), each=150)) ggplot() + geom_density(aes(x=dat[,1], fill=factor(dat[,2]), position="stack")) + xlab("") + ylab("") + scale_colour_manual(name = "Pallet", labels = c("X", "Y")) Here
2009 Aug 19
3
ggplot 2 semi-transparency error
Hi, I used the command ggplot as follows... p<-ggplot(a,aes(x=a$V1,colour=a$V2,fill=a$V2)) p + geom_density(alpha = 0.2,xlim=c(-10,10),ylim=c(0,0.5)) when I say, dev.print(device=postscript,file="/alpha/dct.pdf") I get Warning message: In grid.Call.graphics("L_polygon", x$x, x$y, list(as.integer(1L:length(x$x)))) : semi-transparency is not supported on this device:
2000 Feb 25
2
problem with read.table
> Hi, > I recently downloaded R on window and running Rgui on NT. I have never use > R before and trying to learn R by following An introduction to R. > I generated a table of 900x5 in excel and saved as tab delimited txt file. > I then do read.table but I keeping getting the following message > > data <- read.table("ML4mm25.txt", header=T, sep=" ")
2009 Mar 25
2
[ggplot2] Densityplot, grouping and NAs
Dear all, I do not fully understand how ggplot2 handles NAs. See the following example: library(ggplot2) x <- rnorm(150) g <- as.factor(c(rep(c(0,1,NA),50))) mydf <- data.frame(x,g) m <- ggplot(aes(x = x, group = g, color = g), data = mydf) m + geom_density() How do I get rid of the NAs (i.e. the blue colored curve)? I thought ## m <- ggplot(aes(x = x, group = g, color = g,
2000 Jun 22
1
help
Dear All, Further to answers to sorting, can someone tell me how can I sort a list that contains duplicates (name) but keeping the duplicates together when sorting the values. e.g., a data frame with name (in duplicates), Mvalues(may be different for the duplicates) name M 1234 8 1234 8.3 4321 9 4321 8.1 If I sort by M, it will be 1234, 4321, 1234, 4321 but I want to keep the duplicates together,
2011 Jun 07
1
ggplot2 Histogram with density curve
I am learning ggplot2 commands and I have figured out how to create histograms and density curves but I am not sure how to add a density curve on top of a histogram. Here are the two graphs that I created. ## Histogram t<-rnorm(500) w<-qplot(t, main="Normal Random Sample", fill=I("blue"), colour=I("black"), geom="histogram") w ##Density Curve
2012 Aug 06
4
Overlay Histogram
Dear all, For two sets of random variables, say, x <- rnorm(1000, 10, 10) and y <- rnorm(1000. 3, 20). Is there any way to overlay the histograms (and density curves) of x and y on the plot of y vs. x? The histogram of x is on the x axis and that of y is on the y axis. The density curve here is to approximate the shape of the distribution and does not have to have area 1. Thank you
2011 Jul 06
2
how to best present concentrated data points/ ggplot2
Hi all, I am trying to plot a weighted density plot for two different types and want to show the data points on the x axis. The code is as follows. The data points are very concentrated. Is there a better way to present it( should I set the alpha value or something else)? Thanks! YL library(ggplot2) x <- rnorm(10000) a <- rnorm(5000) b <- rnorm(5000) weights.x <- abs(a/sum(a))
2009 Sep 02
1
Howto Superimpose Multiple Density Curves Into One Plot
I have a data that looks like this: http://dpaste.com/88561/plain/ And I intend to create multiple density curve into one plot, where each curve correspond to the unique ID. I tried to use "sm" package, with this code, but without success. __BEGIN__ library(sm) dat <- read.table("mydat.txt"); plotfn <- ("~/Desktop/flowgram_superimposed.pdf"); pdf(plotfn);
2012 Aug 08
1
ggplot2 with separate average lines
Hi I'm just starting off with R but is this correct? I have this data set. > data Type ID Size 1 Reqd 244808 1024 2 Reqd 244045 512 3 Reqd 245427 800 4 Reqd 245423 1024 5 Reqd 244983 1024 6 Used 244808 615 7 Used 244045 33 8 Used 245427 261 9 Used 245423 461 10 Used 244983 1194 I want a scatterplot of the Size values grouped by the Type column. I also want 2 lines
2007 Nov 08
1
ggplot2 facets as rows and columns
Does anyone (Hadley??) know if there's a straightforward way in ggplot2 to get data divided by a single factor to plot as a rectangular grid of subplots? So far I've only been able to get such data plotted as a single row or single column of skinny subplots. The code below gives an example implemented with lattice, and my best attempt in ggplot2 cheers Ben Bolker ------------ g=
2008 Jan 15
4
Overlay plots from different data sets using the Lattice package
#After spending the entire day working on this question, I have decided to reach out for support: #I am trying to overlay a densityplot from one data set over a histogram of another, if I were to plot the two individually, they would look like: # data frame construction data.frame.A <- data.frame(rnorm(12*8), c(rep("one", 4), rep("two", 4), rep("three", 4)),
2008 Mar 04
1
ggplot2 - Problem with grid plot
Hi R-help I'm trying to create a grid plot in which each plot in the grid contains two density plots (colored by factor) and two vertical lines at the respective medians (also colored by the factor). Using the diamonds dataset as an example, the following commands give me price density plots by factor cut in a single, ungridded plot. p <- ggplot(data=diamonds, aes(x=price)) +
2020 Aug 24
2
(sin asunto)
Buenas tardes, tengo una variable bimodal (*var)*, de presencias y ausencias (1s y 0s) y otra variable, *prob*, con las probabilidades que le asigna un modelo (entre 0 y 1). Con: *ggplot(Preds, aes(x=prob, fill= var )) + geom_density(alpha=.3)* obtengo la distribuciĆ³n de las presencias y de las ausencias, por separado, en funciĆ³n del valor de probabilidad asignado. Las dos curvas se cruzan en un
2009 Aug 20
1
ggsave to .png bug in ggplot2 (?)
Text is really small and legend boxes are huge in this plot when saved to .png with ggsave. Plot is correct (i.e. looks the same as the screen) when saved with dev.print. Saving to .pdf with ggsave give the correct output. I'm a noob at ggplot2 so this may be user error rather than a bug. However the interface to ggsave seems simple enough to exclude many possibilities for screwing this up