Displaying 20 results from an estimated 10000 matches similar to: "where did ggplot go?"
2006 Dec 11
1
two ggplot and colour=x question
Hi
I am using ggplot with the aesthetic=list(..., colour=x, ...)
ggplot()
ggline()
I have four different values in x ("ren", "cyn", "mixed", "bare") and I
have two questions
1) I would like to assign specific colours to the values, i.e. green,
red, blue and brown. How can I do this? I did not understand
map_colour_brewer.
2) I don't want the
2011 Jan 25
1
ggplot - controlling point size
Can anyone illuminate the following for me?
How can I get rid of the blue line in the key in the second plot?
## Create a simple data frame
df=data.frame(x=1:1000, y=2*1:1000+rnorm(1000,sd=1000),
type=sample(letters[1:2],1000, replace=TRUE))
## Very nice! Almost what I want
qplot(x, y, data=df, colour=factor(type)) + geom_smooth()
## Make a nicer plot, with smaller points
## but why
2016 Sep 03
2
Ayuda con gráfico típico de histograma más linea
Prueba algo así:
library(ggplot2)
datos <- read.table("Downloads/pec.csv", header = T, sep = ";", dec = ",")
datos$Miles <- as.numeric(gsub("\\.", "", as.character(datos$Miles)))
datos$hora <- strptime(datos$hora, format = "%H:%M")
ggplot(datos, aes(x = hora, y = Miles)) + geom_line() +
scale_x_datetime(date_breaks =
2006 Oct 24
1
[ggplot] trouble with ggabline and log-log-plots
Hello,
I'm trying to generate a log-log plot with ggplot. Within this plot, I
would like to draw a straight line with the help of ggabline which does
not work. The code is
pl1 <- qplot(correlFunc, correlFunc.ref, data=all, log=c("xy"))
pl1 <- ggabline(pl1, slope=1, intercept=0)
print(pl1) ## no line in plot :(
I can produce plots as I want, if I transform all values before
2016 Sep 02
2
Ayuda con gráfico típico de histograma más linea
Y bueno, algo más bonito sí que queda con ggplot...
#---------------
datIn <- read.csv("pec.csv", header = TRUE, sep = ";", dec = ",")
library(ggplot2)
lab_x_idx <- c(1, round(nrow(datIn)/2, 0), nrow(datIn))
lab_x <- as.vector(datIn$hora[ lab_x_idx])
fre_gg <- ggplot( datIn, aes( x = 1:nrow(datIn), y = frec)) +
geom_bar(stat =
2010 Jul 09
3
apply is slower than for loop?
I thought the "apply" functions are faster than for loops, but my most
recent test shows that apply actually takes a significantly longer than a
for loop. Am I missing something?
It doesn't matter much if I do column wise calculations rather than row wise
## Example of how apply is SLOWER than for loop:
#rm(list=ls())
## DEFINE VARIABLES
mu=0.05 ; sigma=0.20 ; dt=.25 ; T=50 ;
2011 Aug 29
3
replacing elements of a zoo object
Why doesn't this work?
x = zoo(1:5, as.Date('2001-01-01')+1:5)
x[as.Date('2001-01-05')]
x[as.Date('2001-01-05')] = 0
x
I think this is especially bad because it doesn't cause an error. It lets
you do something to x, but then you can't see x again to see what it did.
[[alternative HTML version deleted]]
2016 Sep 03
2
Ayuda con gráfico típico de histograma más linea
Sí, la primera reunión de la temporada será el 8 de este mes.
Un saludo,
Carlos J. Gil Bellosta
http://www.datanalytics.com
El 3 de septiembre de 2016, 23:52, Ruben Tobalina Ramirez <
lagrimaescrita en gmail.com> escribió:
> Muchas gracias a todos!
>
> Pues si, Eric, R a veces me vuelve loco, tiene una lógica muy particular.
> Miraré el libro, que lattice no lo he usado
2011 Dec 06
2
read.table performance
** Disclaimer: I'm looking for general suggestions **
I'm sorry, but can't send out the file I'm using, so there is no
reproducible example.
I'm using read.table and it's taking over 30 seconds to read a tiny file.
The strange thing is that it takes roughly the same amount of time if the
file is 100 times larger.
After re-reviewing the data Import / Export manual I think
2010 Apr 19
2
How to pass a list of parameters into a function
Does anyone know how to pass a list of parameters into a function?
for example:
somefun=function(x1,x2,x3,x4,x5,x6,x7,x8,x9){
ans=x1+x2+x3+x4+x5+x6+x7+x8+x9
return(ans)
}
somefun(1,2,3,4,5,6,7,8,9)
# I would like this to work:
temp=c(x3=3,x4=4,x5=5,x6=6,x7=7,x8=8,x9=9)
somefun(x1=1,x2=2,temp)
# OR I would like this to work:
temp=list(x3=3,x4=4,x5=5,x6=6,x7=7,x8=8,x9=9)
2011 Dec 07
1
RSPython installation
Does anyone know if Is there a way to manually install RSPython?
I get this error when I try to run the script from my DOS prompt.
V:\>R CMD INSTALL -c C:/Users/gene.leynes/Downloads/RSPython_0.7-1.tar.gz
* installing to library 'C:/Users/gene.leynes/Documents/R/win-library/2.13'
* installing *source* package 'RSPython' ...
**********************************************
2011 Feb 23
4
The L Word
I've been wondering what L means in the R computing context, and was
wondering if someone could point me to a reference where I could read about
it, or tell me what it's called so that I can search for it myself. (L by
itself is a little too general for a search term).
I encounter it in strange places, most recently in the "save" documentation.
save(..., list = character(0L),
2011 Sep 06
2
Possible to access a USB volume by name in windows
On the Mac it's pretty easy to get to a USB drive by name. For example the
following command works if you have a USB drive named "MYUSB"
setwd('/Volumes/MYUSB')
Is there a way to do the same thing in Windows (without knowing the drive
letter)?
Thanks!
[[alternative HTML version deleted]]
2011 Sep 26
4
Testing for arguments in a function
I don't understand how this function can subset by i when i is missing....
## My function:
myfun = function(vec, i){
ret = vec[i]
ret
}
## My data:
i = 10
vec = 1:100
## Expected input and behavior:
myfun(vec, i)
## Missing an argument, but error is not caught!
## How is subsetting even possible here???
myfun(vec)
Is there a way to check for missing function arguments, *and*
2011 Dec 07
2
curve fitted ... how to retreive data
Dear R users,
I have now managed to fit the curve using the thin plate spline as follows:
library(mgcv)
b <- gam(y~s(x1,x2,k=100),data =dat)
vis.gam(b)
What I want now is to get the fitted data for y and copy it so that I use it for further analysis.
Many thanks in advance
mintewab
2009 Jul 22
3
How to replace NAs in a vector of factors?
# Just when I thought I had the basic stuff mastered....
# This has been quite perplexing, thanks for any help
## Here's the example:
db1=data.frame(
olditems=c('soup','','','','nuts'),
prices=c(4.45, 3.25, 4.42, 2.25, 3.98))
db2=data.frame(
newitems=c('stew','crackers','tofu','goatsmilk','peanuts'))
2012 Jul 31
1
Ubuntu installation
I just followed the instructions on
CRAN<http://cran.r-project.org/bin/linux/ubuntu/README> to install
R on an Ubuntu instance.
sudo apt-get install r-base
Why does it install an old version of R? Can I install version 15.1?
I changed my sources.list to be a current cran mirror. I believe that I
have entered the URL correctly because at first I had it wrong (there was a
trailing
2009 Sep 11
1
bar chart with means - using ggplot
Like this?
# example using qplot
library(ggplot2)
meanprice <- tapply(diamonds$price, diamonds$cut, mean);meanprice
cut <- factor(levels(diamonds$cut), levels = levels(diamonds$cut))
qplot(cut, meanprice, geom="bar", stat="identity", fill = I("grey50"))
dev.new() # create a new graph to compare with qplot
# Example using ggplot
ggdata <-
2007 Nov 13
1
ggplot2: changing axis labels in ggplot()
Hi all,
For various reasons, I need to use ggplot instead of qplot for a complex
figure. Everything is working fine, except I cannot figure out how to rename
the axis labels in ggplot. I have pasted a simple example below. Any ideas
on what I am doing wrong?
Thanks for your help.
James
library(ggplot2)
##create data
2013 Jan 08
1
ggplot not showing all the years on the x-axis
Dear R helpers,
I am currently having hard time fixing the values on the x-axis of a plot
with ggplot: even though I have 12 years, ggplot plots only 3 of them.
Here is my example:
library(ggplot2)
ii <- 2000:2011
ss <- rnorm(12,0,1)
pm <- data.frame(ii,ss)
tmpplot <- ggplot(pm, aes(x = ii, y = ss))
plot <- tmpplot + geom_line()
plot
In my case, ggplot reports on the year 2000,