A quick google for "ggplot2 change legend text" turns up several hits.
This stackexchange question has several recipes.
http://stats.stackexchange.com/questions/5007/how-can-i-change-the-title-o
f-a-legend-in-ggplot2
including the correct use of the labs() function;
labs(aesthetic='BrandValue in B
- wday(a1$date)
# note can’t have spaces in variable names
week_names <- wday(a1$date, label=TRUE)
*From:* Shivi Bhatia [mailto:shivipm...@gmail.com]
*Sent:* July 26, 2016 12:16 PM
*To:* Tom Wright
*Cc:* David L Carlson ; r-help
*Subject:* Re: [R] Date Time in R
Hello Tom,
Please
Hi again Shiva,
I think what we need to see is the output from:
str(eid$date)
and perhaps
head(eid$date)
If you can send this information before doing any processing on the date
(i.e. before the as.Date() function) we may be able to help.
-Original Message-
From: R-help [mailto:r-help
I'm no expert here but I have recently been playing with the package
'geosphere' it contains plenty of options to calculate distance
between two coordinates specified as lat and long.
install.packages('geosphere') # only needed once
library(geosphere)
coord1 <- c(43.60923,-79.322799)
coord2 <- c(
Does this do what you want?
as.numeric(with(ds_example,paste(1,year2013,year2014,year2015,sep='')))
On Thu, Jun 16, 2016 at 8:57 AM, wrote:
> Hi All,
>
> I need to build a binary vector made of a set of dichotomous variables.
>
> What I have so far is:
>
> -- cut --
>
> ds_example <-
> struct
As you probably already guessed we are going to need to see the
contents of nref, mu.m2 and disp.m2 to help.
dput(nref)
dput(mu.m2)
dput(disp.m2)
k might help too.
On Tue, Jun 14, 2016 at 2:06 PM, JI Cho wrote:
> Dear R users,
>
> I have been using rnorm, rbinom and have been getting the followi
No expert here, and this isn't tested. It seems you can set the
forbid.reuse option which will cause curl to shutdown the connection
after transfer is complete.
if(url.exists("http://www.omegahat.net/RCurl/index.html";)) {
curl <- getCurlHandle()
curlSetOpt(.opts=list(forbid.reuse=1),curl=cu
Did you install the package before loading it?
install.packages("VIM")
On Thu, Jun 9, 2016 at 1:19 PM, Ayyappa Chaturvedula
wrote:
> Dear R users,
> I am trying to use VIM (Visualization and Imputation of Missing Values)
> package in R. When I try to install the VIM library (library(VIM)), I am
Assuming you are on a mac this link may be of assistance:
http://tips.tutorialhorizon.com/2015/10/01/xcrun-error-invalid-active-developer-path-library-developer-commandline-tools-missing-xcrun/
On Wed, Jun 8, 2016 at 7:14 PM, David Howell wrote:
> I am having trouble running aplpack on my Mac. It
My general approach to this is to put the function for loading data
into a separate file which is then sourced in the main analysis file.
Occasionally I'll use a construct like:
if file.exists("loadData_local.R")
{
source("loadData_local.R")
}else{
source("loadData_generic.R")
}
Whe
Hi Óscar,
Not really sure what you mean by the time variable being a "character"
vector. Unless you are plotting a barchart or boxplot (or similar), I
don't this this makes sense. If you can post a sample of your data,
preferably using the dput() command we can probably help more.
On Thu, May 26,
It may not be the problem, but with RStudio this error pops up when
the area reserved for plotting is too small. Typically this area is in
the right hand column, if you have this minimised (perhaps to maximise
space for typing) you will hit this problem. Try making it bigger.
Edit: Just ran your c
me thinking in the right direction.
> One thing I should have mentioned that I did not is that the number of
> rows in the data frame will be a little over 40,000 rows.
>
>
> On 5/24/2016 4:08 PM, Tom Wright wrote:
>
> Using dplyr
>
> $ library(dplyr)
> $ x
Using dplyr
$ library(dplyr)
$ x<-data.frame(Length=c(321,350,340,180,198),
ID=c(rep('A234',3),'B123','B225') )
$ x %>% group_by(ID) %>% summarise(m=mean(Length))
On Tue, May 24, 2016 at 3:46 PM, Matthew
wrote:
> I have a data frame with 10 columns.
> In the last colum
I just tested your code on my debian install with no problems. RStudio
server logs messages to /var/log/messages (on redhat). Does running:
$ cat /var/log/messages |grep rsession
$ cat /var/log/messages |grep rserver
in the shell give any clues?
R version 3.2.5 (2016-04-14)
Platform: x86_64-p
As pointed out somewhere in the replies to this you can always use the
exists() function.
for(i in 1:5){
if(exists(output)){
output <- c(output, i )
}else{
output <- i
}
}
On Wed, Apr 27, 2016, 11:15 AM Gordon, Fabiana <
fabiana.gor...@imperial.ac.uk> wrote:
> Hello,
>
>
o change this
behaviour.
On Mon, May 2, 2016 at 11:01 AM, wrote:
> I just changed all the names in Command to lowercase, then this
> str_extract works fine for "pd" and "t2", but not for "PDT2". Do you have
> any idea how I can bring PDT2 also in str_ext
PDT2')// I create a vector with these conditions
> str_extract(df$Command,paste(v1,collaps='|')) //returning patterns,
> using stringr library
>
> here I see no pattern named PDT2 but there are only PD and t2 patterns.
> On Monday, May 2, 2016 8:18 AM, Tom Wright wro
),df$Command) I get this error:
> Argument "x" is missing, with no default. Actually I don't know how to fix
> this. Do you have any idea?
>
> Tom's code was missing a ")" but not where you put one. He probably also
> didn't intend to capita
If you can address your columns by name then order shouldn't matter. If the
column order does matter, perhaps a matrix is a better structure to use?
On Sun, May 1, 2016, 10:56 AM Jan Kacaba wrote:
> Hello dear R users,
>
> Is there a function or package which can insert row, column or array in
>
I think what you ask isn't ideal.Each column in a dataframe should be the
same data type. While column names are stored in the first row when the df
is exported to CSV, they are not stored as columns in the data frame.
Instead the column names are stored as a separate attribute of the df. This
is w
$Command)
On Sat, Apr 30, 2016, 7:07 PM Tom Wright wrote:
> subset(df,grepl("t2|pd",x$Command))
>
>
> On Sat, Apr 30, 2016 at 2:38 PM, ch.elahe via R-help > wrote:
>
>> Hi all,
>>
>> I have one factor variable in my df and I want to extract the names
subset(df,grepl("t2|pd",x$Command))
On Sat, Apr 30, 2016 at 2:38 PM, ch.elahe via R-help
wrote:
> Hi all,
>
> I have one factor variable in my df and I want to extract the names from
> it which contain both "t2" and "pd":
>
> 'data.frame': 36919 obs. of 162 variables
>$TE:
Never let it be said there's only one way to do a thing:
require(ggplot2)
require(dplyr)
#create a sample dataset
dat <- data.frame(y1=sample(c(1:10,NA),20,replace=TRUE),
y2=sample(c(1:10,NA),20,replace=TRUE),
y3=sample(c(1:10,NA),20,replace=TRU
On heroku the database uri is stored in an environment variable.
> db_uri = Sys.getenv(''DATABASE_URL')
I'm not sure if you can use that directly or if you will need to parse
it for username, password etc.
On Thu, 2016-04-21 at 16:49 +0100, Izaak Rogan wrote:
> Hi,
>
> I'm having trouble connec
Assuming your dataframe is in a variable x:
> require(dplyr)
> x %>% group_by(ID) %>% summarise(maxVal = max(Value,na.rm=TRUE))
On Fri, 2016-04-22 at 13:51 +, Saba Sehrish via R-help wrote:
> Hi
>
>
> I have two columns in data frame. First column is based on "ID" assigned to
> each grou
I don't have my debian box available so can't confirm. But I would try
$apt-get install libpng
On Tue, Apr 19, 2016 at 11:23 AM, Lorenzo Isella
wrote:
> Dear All,
> I have never had this problem before. I run debian testing on my box
> and I have recently update my R environment.
> Now, see what
On Fri, 2015-09-11 at 07:48 -0700, massmatics wrote:
> AM.warpbreaks<=30
The above command is not returning what you expected, what part of the
AM.warpbreaks dataframe is expected to be <= 30?
Effectively you are using a two stage process.
1) Create a logical vector identifying rows in the datafr
table(unique(df)$PROJECT)
On Tue, 2015-03-31 at 14:51 -0500, Walter Anderson wrote:
> I have a data frame that shows all of the parks (including duplicates)
> that are impacted by a projects 'footprint':
>
> PROJECT PARKNAME
> A PRK A
> A PRK B
> A PRK A
> B PRK C
> B
Not entirely sure I understand your problem here (your first email was a
lot of reading).
Would it make sense to add an extra column device_name
Thus ending up with something like:
Host Device Type
host_Aada0ssd
host_Aada1ssd
host_Aada2hdd
...
host_Nda3 ssd
Nice clean-up!!!
On Tue, 2015-03-31 at 14:19 -0400, Ista Zahn wrote:
> library(tidyr)
> library(dplyr)
> bw <- gather(bw, key = "tmp", value = "value",
> matches("^d[a-z]+[0-9]+"))
> bw <- separate(bw, tmp, c("disc", "var"), "_", extra = "merge")
> bw <- spread(bw, var, value)
___
samples<-sample(c(rep(1,10),rep(2,10),rep(3,10)),30)
samples[samples==1]<-1001:1010
samples[samples==2]<-2001:2010
samples[samples==3]<-3001:3010
fullDf<-rbind(df1,df2,df3)
fullDf[sort(order(samples),index.return=TRUE)$ix,]
On Tue, 2015-03-31 at 13:05 -0400, Kevin E. Thorpe wrote:
> Hello.
>
>
First you need to make the data pbc available, perhaps by:
data(pbc, package="survival")
Then the line:
sf2<-summary(...
looks wrong, usually you would use the summary() function to look at the
output from a function, seems to me you are missing the function here. I
have no idea what this functi
I think you need to use a loop to iterate through each of the items in
getlinks
for(link in getlinks)
{
url<-paste0('http://spec.org/jEnterprise2010/results/',link)
output<-readfiles(url)
}
You're probably also going to need to add some error handling when your
sea
I can answer this:
sample(c(0,1),1)
On Fri, 2015-03-06 at 15:04 +0530, Namratha K wrote:
> Dear Sir/Madam,
> I am a student pursuing MCA .As i am doing an project using R language .I
> want to implement A/B testing using R language.I am searching in google
> from past few days and not able to imp
plot(density(as.numeric(dd)),
axes=FALSE,
xlim=c(as.numeric(as.Date("2014-01-01")),
as.numeric(as.Date("2014-12-30")))
rug(as.numeric(dd))
axis(side=1,
at=seq(from=as.numeric(as.Date('2014-01-01')),
to=as.numeric(as.Date('2014-12-1')),length.out=12),
lab
If all you want is to add a row of na's could you just do something
like:
nExpectedRows<-length(unique(animals)) * length(unique(animalYears)) * 2
newDf<-data.frame(animals=rep(NA,nExpectedRows-nrow(comAn)),
animalYears=rep(NA,nExpectedRows-nrow(comAn)),
animal
> -Original Message-
> From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of Tom Wright
> Sent: Wednesday, February 4, 2015 2:08 PM
> To: Rui Barradas
> Cc: r-h...@stat.math.ethz.ch
> Subject: Re: [R] Still trying to avoid loops
>
> Thanks, I was not aware of
; S D visit
> 1 a 5 1
> 2 a 1 2
> 3 b 3 1
> 4 c 2 1
> 5 c 3 2
> 6 c 4 3
>
>
>
>
> Jim Holtman
> Data Munger Guru
>
> What is the problem that you are trying to solve?
> Tell me what you want to do, not how you want to do it.
&
>
> > Aren't the levels of your example wrong? If the levels are
> > levels=c('a','b','c'), not c('b', 'a', 'c'), then the following will do the
> > job.
> >
> > unname(unlist(tapply(dat$D, dat$S, or
,'b','c'), not c('b', 'a', 'c'), then the following will do
> the job.
>
> unname(unlist(tapply(dat$D, dat$S, order)))
>
>
> Hope this helps,
>
> Rui Barradas
>
> Em 04-02-2015 19:34, Tom Wright escreveu:
> > G
For the introduction to R I strongly suggest you look at the materials
published by software-carpentry www.software-carpentry.org. The lessons
are all open-source, hosted on github and are under active development.
On Tue, 2015-02-03 at 12:08 +0100, Michael Haenlein wrote:
> Dear all,
>
> I am Pr
Given a dataframe:
dat<-data.frame(S=factor(c(rep('a',2),rep('b',1),rep('c',3)),levels=c('b','a','c')),
D=c(5,1,3,2,3,4))
where S is a subject identifier and D a visit (actually a date in my
real dataset). I would like to generate another column giving the visit
number
R=c(2,1,1,1
uot;A","B");return(x)})
> do.call(rbind,t)
>
>
> On Mon, Feb 2, 2015 at 4:00 PM, Tom Wright wrote:
> Hi all,
>
> I'm trying to avoid loops (no real reason, just as an
> exercise).
>
> Given a list:
>
Hi all,
I'm trying to avoid loops (no real reason, just as an exercise).
Given a list:
list(data.frame(a=1:3,b=letters[1:3]),data.frame(x=1:5,b=LETTERS[1:5]))
Is there an easy way to collapse this to a single dataframe
result<-data.frame(a=c(1:3,1:5),b=c(letters[1:3],LETTERS[1:5]))
Thanks
_
replacing png(...) and dev.off() with
dev2bitmap('test.png')
seems to work.
On Mon, 2015-02-02 at 15:56 -0200, Antonio Silva wrote:
> Hi R users
>
> I want to save a plot after using the command identify.
>
> I use identify to place labels manually near the points in order to avoid
> overlapping
nation of some data and an aching desire for an answer does not
> ensure that a reasonable answer can be extracted from a given body of data.
> ~ John Tukey
>
>
> Van: R-help [r-help-boun...@r-project.org] namens Tom Wright [
> t...@maladmin.co
Hi,
I would like to plot the following data such that each plot represents the
data from a single id and the plots are grouped according to the group
variable.
data<-data.frame(id=factor(rep(1:6,each=3)),
group=factor(c('a','a','b','c','c','c')),
x=runif(18,0,10),
y=rnorm(18,0,1))
The followi
Thanks Duncan,
Dropping the extra columns might be the way forward. I'm sure I can work
out how to embed latex into a markdown document ;-)
On Tue, Nov 25, 2014 at 4:37 PM, Duncan Murdoch
wrote:
> On 25/11/2014 3:12 PM, Tom Wright wrote:
>
>> Hi,
>> This problem has me s
em?
>
> Mark
> > On Nov 25, 2014, at 2:12 PM, Tom Wright wrote:
> >
> > Hi,
> > This problem has me stumped so I thought I'd ask the experts. I'm trying
> > to create a pretty summary table of some data (which patients have had
> > what tes
Hi,
This problem has me stumped so I thought I'd ask the experts. I'm trying
to create a pretty summary table of some data (which patients have had
what tests at what times). Ideally I'd like to knitr this into a pretty
PDF for presentation.
If anyone has pointers I'll be grateful.
require(tables)
A couple of observations:
1) I'm not sure what the variable i is doing, looks like you are trying
to loop through years but perhaps you left that bit of code out for
clarity.
2) On the first loop of i you are assigning the values of
Samaru56[sow_day,] to all values in Samaru56. For future loops all
plot(x=range(x),y=range(c(y1,y2,y3.y4),type='n')
lines(x=x,y=y1,lty=1)
lines(x=x,y=y2,lty=2)
lines(x=x,y=y3,lty=3)
lines(x=x,y=y4,lty=4)
legend('bottomright',c('Y1','Y2','Y3','Y4','Y5'),lty=1:4)
or something like that.
On Fri, 2014-09-19 at 14:11 -0500, Marc Schwartz wrote:
> On Sep 19, 2014,
ggplot(data,aes(x = z1, y = x, fill=x2)) +
geom_boxplot() +
geom_point(alpha=0.5,
position=position_jitterdodge(jitter.width=0.1),
aes(group=x2))
On Mon, 2014-09-08 at 13:10 -0400, Tom Wright wrote:
> Hi,
> I'm trying to create a boxplot overlayed with points where
Hi,
I'm trying to create a boxplot overlayed with points where the data is
split by two factor groups.
So far:
x1<-factor(rep(LETTERS[1:4],5))
x2<-factor(rep(letters[1:2],10))
z<-runif(20,0,10)
data<-data.frame(x1=x1,x2=x2,z=z)
ggplot(data,aes(x=x1,y=z,fill=x2)) +
geom_boxplot() +
ort still works, not everything has moved to
linkedin and stackoverflow.
Thanks again,
Tom
On Fri, 2014-08-15 at 12:18 -0400, Tom Wright wrote:
> Hi,
> Can anyone please assist.
>
> given the string
>
> > x<-"/mnt/AO/AO Data/S01-012/120824/"
>
> I would lik
Hi,
Can anyone please assist.
given the string
> x<-"/mnt/AO/AO Data/S01-012/120824/"
I would like to extract "S01-012"
require(stringr)
> str_match(x,"\\/mnt\\/AO\\/AO Data\\/(.+)\\/+")
> str_match(x,"\\/mnt\\/AO\\/AO Data\\/(\\w+)\\/+")
both nearly work. I expected I would use something lik
i is an element in zn so replace zn[i] with just i
for (i in zn){
treat$su[treat$Zugnacht==as.POSIXct(i, "UTC")] <-
min(treat$Vollzeit[treat$Zugnacht==as.POSIXct(zni, "UTC")])
treat$sa[treat$Zugnacht==as.POSIXct(zni, "UTC")] <-
max(treat$Vollzeit[treat$Zugnacht==as.POSIXct(zni, "UTC")])
Thanks everyone,
That's a 3000 fold speedup. Now if only I can get the same improvement on
the stMincuts iGraph algorithm.
On Fri, Apr 25, 2014 at 4:20 AM, Martin Maechler wrote:
> > Stefan Evert
> > on Fri, 25 Apr 2014 09:09:31 +0200 writes:
>
> > On 24 Apr 2014, at 23:56, G
I need to generate a sparse matrix. Currently I have the data held in two
regular matrices. One 'targets' holds the column subscripts while the other
'scores' holds the values. I have written a 'toy' sample below. Using this
approach takes about 90 seconds to populate a 3 x 3 element matrix
Are there any packages implementing graph search algorithms?
I'm looking for the equivalent of matlab findshortestpath in the
bioinfomatics toolbox.
Thanks,
Tom
__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do
-
> David L Carlson
> Department of Anthropology
> Texas A&M University
> College Station, TX 77840-4352
>
> -Original Message-
> From: r-help-boun...@r-project.org
> [mailto:r-help-boun...@r-project.org] On Behalf Of Tom Wrig
I'm no expert on the adonis functions by the error you are getting
usually means the dataset is not quite what you expected. Are you sure
the event dataset is loading as you expect?
On Tue, 2014-03-25 at 16:36 -0400, Maggie Wisniewska wrote:
> Hello,
> I am an R noivce, so excuse my simple questio
Hi all,
I've spent too long in matlab land recently and seem to have forgotten
my R skillz ;-)
I'm sure I'm missing a simple way to do this...
Given a data frame
id<-rep(1:5,2)
eye<-c(rep('l',5),rep('r',5))
age<-rep(round(runif(5,0,12)),2)
response<-round(runif(10,1,10)*10)/10
response2<-sample(c(
Hi,
Given a matrix
set.seed(500)
matrix(round(runif(100,0,1)),
ncol=5,
dimnames=list(Subject=1:20,
Group=c('A','B','C','D','E')))
Is there an easy way to identify which combinations of groups exist,
i.e. subject2 is a member of group 'A+B+D+E' however no one is a member
of
Hi,
Can anyone explain why the nls function is giving an error?
Thanks
Tom
> head(d)
age time
1 23.57 223.0
2 42.63 223.0
3 62.30 222.0
4 32.93 220.5
5 9.37 228.0
6 23.83 227.0
> fit<-nls(d$time~a1*exp(b1*d$age) +
a2*exp(b2*d$age)+c
,start(a1=10
66 matches
Mail list logo