Displaying 20 results from an estimated 600 matches similar to: "ggplot2-geom_text()"
2018 May 22
2
Using tryCatch in a for loop
Data and code as promised:
#Creating a test dataset
Year<- c(2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014)
Lake1<- c(2, 4, 5, 2, 1, 1, 2, 3, 4, 5, 6, 2, 3, 1, 2)
Lake2<- c(1, 3, -1, 4, -2, 1, 2, 3, 4, 5, 6, 2, 3, 1, 2)
Lake3<- c(1, 2, 5, -3, 1, 1, 2, 3, 4, 5, 6, 2, 3, 1, 2)
Lake4<- c(1, 1, 1, 1, 1, 1, 1, 250, 240, 240, 240, 240, 240, 239,
2018 May 22
0
Using tryCatch in a for loop
No. If your ouput is a numeric "matrix", it cannot include alpha. Columns
in a data frame can be of different classes, but each column must be single
class.
and finally, of course, see ?cat -- I think you are misusing it. If you
simply want to return "somestuff", your function should be:
function(w) {"somestuff"}
not
function(w) {cat("somestuff")}
As
2018 May 22
3
Using tryCatch in a for loop
Hello All,
I have been trying to use a for loop to run segmented regressions (from?R package segmented)?on many columns of data in a data frame with the end goal of writing a new file with the following columns: column title, breakpoint year, slope, and difference in slope. Unfortunately, when one of the columns doesn't have a breakpoint the code stops and provides?an error or warning. I
2018 May 22
0
Using tryCatch in a for loop
Others may have greater insight, but my response is: Exactly what did or
didn't happen that makes you say the code didn't work? That is, what did or
didn't you get when you ran it compared to your expectations?
Cheers,
Bert
Bert Gunter
"The trouble with having an open mind is that people keep coming along and
sticking things into it."
-- Opus (aka Berkeley Breathed in
2018 May 22
4
Using tryCatch in a for loop
Hi Bert,
Thank you for the quick response!?
In its current?state?the code?prints three lines that say "warning". What I was expecting is that I would?get?a matrix with 4 columns, 1. column names (from the original data, ex. Lake1) 2. breakpoint year 3. slope 4. slope difference from the first to the?second segment of the segmented regression. Each row in the matrix would be the results
2018 May 22
0
Using tryCatch in a for loop
On 5/22/2018 11:32 AM, Bailey Hewitt wrote:
> Hi Bert,
>
> Thank you for the quick response!
>
> In its current?state?the code?prints three lines that say "warning". What I was expecting is that I would?get?a matrix with 4 columns, 1. column names (from the original data, ex. Lake1) 2. breakpoint year 3. slope 4. slope difference from the first to the?second segment of
2018 May 22
0
Using tryCatch in a for loop
(practically) ALWAYS respond to the list. I have cc'ed them here.
Others may (almost always do!) have greater insight/better answers than I.
In this case, I have no clue, but presumably your call is wrong, but as I
have no experience with the segmented.lm function, I don't care to track
down how exactly. Your tryCatch call seems to be fine, however.
-- Bert
Bert Gunter
"The
2013 Nov 15
0
getting the results of tapply into a single matrix
Hi,
Try:
example <- read.table(text="ID Sex Location CL
1?? F??? lake1?? 40
1?? F??? lake1???
1?? F??? lake1???? 43
2?? M??? lake1??? 30
3?? M??? lake2??? 22
4?? F??? lake2???? 25
4?? F??? lake2???? 27",sep="",header=TRUE,stringsAsFactors=FALSE,fill=TRUE)
aggregate(CL~.,example,mean,na.rm=TRUE)
#or
library(plyr)
2009 Apr 01
0
回复: R-help Digest, Vol 73, Issue 32
Dear sir, How to do bilinear time series in R?Is there any functions or packages? thank you!
-----Sincerely yours
Kuangnan Fang 方匡南 敬上
department of statistics ,Economics school,Xia men University.
Fujian Province (361005) China
Mobile Phone:15860721915 SKYPE: ruiqwy
MSN Messenger: ruiqwy@hotmail.com
QQ:39863401
--- 09年3月31日,周二, r-help-request@r-project.org
2013 Sep 01
1
Blur and not readable text, using geom_text in ggplot
Dear R Users,
I am new to ggplot. I am using geom_text to inscribe values on my ggplot
but it is giving me values which are unreadable and blur.
Please let me know if there is any way out.
----------------- Code -----------------
*es <- es3 + geom_text(data=tmp.cor, aes(x=2, y=min(infer.df$value),*
* label=text.bottom), colour="black",*
*
2009 Oct 23
1
ggplot2: stat_bin ..count.. with geom_text when NA is present
One for the ggplot2 gurus...
I have a function which makes a plot just fine if the response vector (res
in the example; fac1 is a factor) has no NA in it. It plots the data, then
makes a little annotation at the bottom with the data counts using:
p <- p + geom_text(aes(x = fac1, y = min(res) - 0.1 * diff(range(res)),
label = paste("n = ", ..count.. , sep =
2010 Jun 26
1
predict newdata question
Hi:
I am using a subset of the below dataset to predict PRED_SUIT for
the whole dataset but I am having trouble with 'newdata'. The model
was created with 153 records and want to predict for 208 records.
wolf2 <- structure(list(gridcell = c(367L, 444L, 533L, 587L, 598L, 609L,
620L, 629L, 641L, 651L, 662L, 674L, 684L, 695L, 738L, 748L, 804L,
805L, 872L, 919L, 929L, 938L, 950L, 958L,
2009 Dec 31
1
ggplot2: How to change font of labels in geom_text
Happy New Year everyone.
I have what I hope is a simple-to-answer question. In the code sample
below, I'm using a tile plot to plot a continuous measure and overlaying the
plot with labels. I need to print the labels in courier, but there appears
to be no way to override the default font setting in geom_text. I've
scoured the web for clues on how to do this, but found nothing relevant.
2009 May 16
1
ggplot2: annotating plot with mathematical formulae
Hi,
Is there a way of annotating a ggplot plot with mathematical formulae?
I can do
geom_text(aes(label="some text", ...
but I can't do
geom_text(aes(label=expression(x^{n-1}), ...
It gives the error
Error: geom_text requires the following missing aesthetics: label
Is there a convenient equivalent?
Cheers,
Paul
2017 Jun 27
4
ggplot2 geom_bar arrangement
Hi,
I was trying to draw a geom_bar plot. However, by default, the bars are
arranged according to the label, which I don't want. I want the bars to
appear exactly as they appear in the data frame. For example in the code:
Lab=c(letters[4:6],letters[1:3])
valuex = c(3.1,2.3,0.4,-0.4,-1.2,-4.4)
df <- data.frame(Lab,valuex)
px <- ggplot(df,aes(Lab,valuex,label=Lab)) +
2008 May 27
1
label outliers in geom_boxplot (ggplot2)
Dear List and Hadley,
I would like to have a boxplot with ggplot2 and have the outlier values
labelled with their "name" attribute. So I did
> library(ggplot2)
> dat=data.frame(num=rep(1,20), val=c(runif(18),3,3.5),
name=letters[1:20])
> p=ggplot(dat, aes(y=val, x=num))+geom_boxplot(outlier.size=4,
outlier.colour="green")
>
2011 Apr 22
1
ggplot
Hello everyone,
I am using ggplot
to plot but I am getting the following error which I do not understand
Error: geom_text requires the following missing aesthetics: label
My code is
dimx<-256
library(ggplot2)
dev.new()
xandy<-expand.grid(seq(1:dimx),seq(1:dimy))
xx<-data.frame(xandy[[1]],xandy[[2]],Powermap=Powermap)
subsetxx<-subset(xx, xx$Powermap>threshold)
2010 Nov 20
2
Merge two ggplots
Hello everyone.
I am using ggplot and I need some help to merge these two plots into one.
plot_CR<-function(x,y,agentid,CRagent){
library(ggplot2)
agent<-CRagent[[agentid]] # To make following expression shorter
ggplot((data.frame(x=CRX,y=CRY,sr=agent$sr)))+
geom_point(aes(x,y,colour=cut(sr,c(0,-10,-20,-30,-40,-50,-60,-70,-80))))+
geom_text(aes(x,y,color=cut(sr,
2011 Nov 10
2
ggplot2 - regression statistics how to display on plot
Hello -
So I am trying to use ggplot2 to show a linear regression between two variables, but I want to also show the fit of the line on the graph as well.
I am using ggplot2 for other graphics in what I am working on, so even though this would be a fairly easy thing to do in Excel, I would prefer to do it in R to keep my look and feel, and I think ggplot2 is just cooler.
Here is a sample
2010 Sep 01
2
ggplot2 multiple group barchart
hi there.. i got a problem with ggplot2.
here my example:
library (ggplot2)
v1 <- c(1,2,3,3,4)
v2 <- c(4,3,1,1,9)
v3 <- c(3,5,7,2,9)
gender <- c("m","f","m","f","f")
d.data <- data.frame (v1, v2, v3, gender)
d.data
x <- names (d.data[1:3])
y <- mean (d.data[1:3])
pl <- ggplot (data=d.data, aes (x=x,y=y))
pl