Hi,
Try:
segmentf_df <- function(df) {
out.lm<-lm(deltaWgt~Cycle, data=df)
segmented(out.lm,seg.Z=~Cycle,
psi=(Cycle=NA),control=seg.control(stop.if.error=FALSE,n.boot=0))
}
library(plyr)
library(segmented)
dlply(df,.(Lot.Run),segmentf_df)
$`J062431-1`
Call: segmented.lm(obj = out.lm, seg.Z =
Hi,
A slight modification would be:
hist(xxx,main=bquote("Heart Attack " ~ bar(x) == .(mean(xxx
#or use ?substitute()
hist(xxx,main=substitute("Heart Attack "~ bar(x) == mx,list(mx=mean(xxx
A.K.
On Saturday, October 12, 2013 1:26 AM, Rolf Turner
wrote:
On 10/12/13 11:39, Emily Jean Fa
Better, I don't know...
But alternatively, and maybe thinning the fog a bit:
set.seed(42)
xxx <- rnorm(300,10,2)
hist(xxx,main=bquote(Heart~~Attackbar(x) == .(mean(xxx
Cheers,
Bert
On Fri, Oct 11, 2013 at 10:23 PM, Rolf Turner wrote:
> On 10/12/13 11:39, Emily Jean Fales wrote:
>>
>>
You have posted neither code nor your data, contrary to what the
posting guide asks.
How do you expect anyone to help?
Cheers,
Bert
On Fri, Oct 11, 2013 at 4:54 AM, Aya Anas wrote:
> Dear all,
> I am using the DEoptim package. My optimization syntax has three decesion
> variables. If I increas
Your examples are the problem:
On Fri, Oct 11, 2013 at 2:43 PM, arun wrote:
> Seems like a bug in the code:
> x<- c(3,4,1)
> n<- 3
> matrix(rep(rep(c(1,0),n),rbind(x,n-x)),nc=n,byr=TRUE)
> #Error in rep(rep(c(1, 0), n), rbind(x, n - x)) : invalid 'times' argument
## This can't work since x spec
On 10/12/13 11:39, Emily Jean Fales wrote:
I am trying to get the calculated mean and the symbol of x-bar to show in
the title of multiple histograms in R. Here is the code I have for one of
the histograms:
hist(outcome[,11], main= "Heart Attack (expression(bar(x))) =
(mean(outcome[,11]))", xla
Hello,
I'm trying to find a solver that will work for the mixed complementarity
problem (MCP). I've searched the CRAN task view page on optimization and
mathematical programming as well as many google searches to no avail. Does
anyone know if there is an MCP solver available for R?
Thanks very
I am trying to get the calculated mean and the symbol of x-bar to show in
the title of multiple histograms in R. Here is the code I have for one of
the histograms:
hist(outcome[,11], main= "Heart Attack (expression(bar(x))) =
(mean(outcome[,11]))", xlab ="30-day Death Rate", xlim = c(min(hist_min)
Hello,
Iâm unsuccessfully trying to apply piecewise linear regression over each of
22 groups. The data structure of the reproducible toy dataset is below. Iâm
using the âsegmentedâ package, it worked fine with a data set that
containing only one group (âLot.Runâ).
$ Cycle : int
On 10/11/2013 11:45 PM, Mubar wrote:
Hi
I have a question regarding plots in R. I have data from the S&P 500 in the
format:
date close change
1980-01-07 109.92 3.4
I plotted the data with plot(spdata$date, log(spdata$close), type="p")
Now I want to ad the colors green and red
Thanks.
--
View this message in context:
http://r.789695.n4.nabble.com/labeling-abscissa-using-a-function-of-the-plotted-scale-tp4678075p4678103.html
Sent from the R help mailing list archive at Nabble.com.
__
R-help@r-project.org mailing list
https
I have a java class with routines (and their tests) that I would like to
use in R so I don't have to have two copies of important subroutines.
I have looked at rjava, but can't grasp it all and don't know what are
the important items to observe first so I don't get into too much
trouble later. I
Hi Ben,
No problem.
Try:
df1 <- do.call(rbind,lapply(split(df,df$group),function(x) {
data.frame(dt2=dt[dt>=x[1,1] & dt
wrote:
Hi Arun,
Many thanks for that solution; it works well :)
I also have some data where times and dates don't follow a 15 min intervals,
so, for example:
dates=rep("01
Hi Marco,
Thanks for the clarification. For my immediate purposes I think using the
likelihood weighting method will suffice. I'm calculating conditional
probabilities based on a single instantiation each time I use the function. The
evidence I use for instantiation changes for each i+1 in my l
Hello,
Working on an ubuntu 13.04 with a sessionInfo() specified below, I try to
update my packages, and RSQLite update consistently fails like this:
> update.packages(checkBuilt=TRUE, ask=FALSE)
Warning: package 'RUnit' in library '/usr/lib/R/site-library' will not be
updated
trying URL 'http://
Thanks Marco,
The cpquery function is definitely easier to use given that my evidence is
contained in lists.
Thanks for your help!
---
Ryan
Ryan Morrison, PE
PhD Candidate
University of New Mexico
Department of Civil Engineering
Centennial Engineering Center, Room 3057
Phone: 505-633-5506
Ema
Dear all,
I am using the DEoptim package. My optimization syntax has three decesion
variables. If I increase the upper bound of the first or third variables,I
get an error related to singularity of a matrix. However, I need to
increase the upper bound of the first and third variables. The true boun
Hi
I have a question regarding plots in R. I have data from the S&P 500 in the
format:
date close change
1980-01-07 109.92 3.4
I plotted the data with plot(spdata$date, log(spdata$close), type="p")
Now I want to ad the colors green and red to the data frame. if the change
is po
Seems like a bug in the code:
x<- c(3,4,1)
n<- 3
matrix(rep(rep(c(1,0),n),rbind(x,n-x)),nc=n,byr=TRUE)
#Error in rep(rep(c(1, 0), n), rbind(x, n - x)) : invalid 'times' argument
n<- 4
matrix(rep(rep(c(1,0),n),rbind(x,n-x)),nc=n,byr=TRUE)
#Error in rep(rep(c(1, 0), n), rbind(x, n - x)) : invalid
Nice, thanks Petr :)
Ben Gillespie, Research Postgraduate
o---o
School of Geography, University of Leeds, Leeds, LS2 9JT
o---o
Tel: +44(0)113 34 33345
Mob: +44(0)770 868
Hi Arun,
Many thanks for that solution; it works well :)
I also have some data where times and dates don't follow a 15 min intervals,
so, for example:
dates=rep("01/02/13",times=20)
times=c("12:03:50","12:15:32","12:29:08","12:45:09","13:01:00","13:14:06","13:30:20","13:47:00","13:58:00","14:15
Thanks Dennis. I noticed I didn't take the "0" value into consideration and
also didn't check the unsorted vector.vec1<- c(2,4,1)
is.numeric(vec1)
#[1] TRUE
makeMat(as.integer(vec1))
makeMatrix2<- function(x){
if(is.numeric(x)){
x <- as.integer(round(x))
x}
stopifnot(is.integer(x))
m1<- matr
simpler (and sloppier) but with **no looping or apply's **
**IFF* the matrix is structured as in the OP's example, then lower.tri
(or upper.tri) should be used:
n <- 4 ## number of columns in matrix -- note that I changed it from
the example; does not have to be square
x <- 1:3 ## the number of
On Oct 11, 2013, at 9:48 AM, Hurr wrote:
> Is it easy or difficult to label the abscissa of a scatter graph as
> 1/trueScaleValue at that point?
It's easy.
?axis
>
> --
> View this message in context:
> http://r.789695.n4.nabble.com/labeling-abscissa-using-a-function-of-the-plotted-scale-tp4
Attempting to follow the OP's conditions and assuming I understood
them correctly, here is one way to wrap this up into a function:
makeMat <- function(x)
{
stopifnot(is.integer(x))
nr <- length(x)
nc <- max(x)
# Initialize a matrix of zeros
m <- matrix(0, nr, nc)
# Condit
Dear Ryan,
On 11 October 2013 20:44, Ryan Morrison wrote:
> Thanks for the clarification. For my immediate purposes I think using the
> likelihood
> weighting method will suffice. I'm calculating conditional probabilities
> based on a
> single instantiation each time I use the function. The evi
Dear Ryan,
On 11 October 2013 16:50, Ryan Morrison wrote:
> The cpquery function is definitely easier to use given that my evidence is
> contained in lists.
For the record, this is not a general solution to the bug. It's true
that likelihood weighting (method = "lw") is easier to use in a
progra
I think you want 'assign' at that point. Would suggest using a 'list'
to store the input instead of unique named objects. 'list's are
easier to manage.
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.
On Fri
Hi everybody,
I thought I was using the get() fn correctly here to loop over multiple
data frame names in an R for() loop. Can someone advise?
> miss<-c("#NULL!","999")
> d<-c("d1","d2","d3","d4")
>
> for(i in 1:4){
+
+ miss1<-ifelse(i<=2,miss[1],miss[2])
+ miss1
+
+ get(d[i])<-read.csv(paste("C
On 10.10.2013 21:40, Sheri wrote:
Hi everyone,
I am hoping someone can help with my attempted use of the expression
function. I have a long series of text and variable to paste together
including a degree symbol. The text is to be placed on my scatter plot
using the mtext function.
Using expres
Look at the ?Startup help page in R. It shows a couple of ways to have
code run automatically when R starts (and can depend on which folder R
starts from). So you could have the windows task scheduler run R and use
the above to set the script to run.
Also look at ?Rscript for a way to run a scri
Thanks to Henrik and David for responses. Both were right. A small edit
to my description of the problem (which has now been solved). I said
that the first version of system2 ( system2("sed -i s/oldword/newword/g
d:/junk/x/test.tex")) worked fine but in fact it was not working, it
just wasn't g
Are you familiar with the sos package? Consider the following:
library(sos)
op <- findFn('orthogonal polynomial') # 165 links in 35 pkgs
ops <- findFn('orthogonal polynomials')#158 links in 35 pkgs
op. <- op |ops# 194 links in 43 pkgs
save(op., file='orthopoly.rda')
summary(op.)
inst
system2("sed", args=c("-i", "s/oldword\\s/newword/g", "d:/junk/x/test.tex"))
/Henrik
On Fri, Oct 11, 2013 at 8:58 AM, David Winsemius wrote:
>
> On Oct 10, 2013, at 8:16 AM, Zev Ross wrote:
>
>> Hi All,
>>
>> I'm trying to edit a file in place using system2 and sed from within R. I
>> can get m
> I think all of the above call lapply(split()) at some point and that can use
> a lot of memory when there are lots of unique values in x. You can use
> a sort-based algorithm to avoid that problem.
E.g.,
Sequence <-
function(nvec) {
# like base::sequence, but faster for long nvec. If sum(
At this point 3 functions have been suggested and I'll add a 4th:
f1 <- function(x)unlist(lapply(unname(split(rep.int(1L,length(x)), x)),
cumsum))
f2 <- function(x)unlist(sapply(rle(x)$lengths, function(k) 1:k ))
f3 <- function(x)ave(x,x,FUN=seq)
f4 <- function(x)ave(seq_along(x), x, FUN=s
Is it easy or difficult to label the abscissa of a scatter graph as
1/trueScaleValue at that point?
--
View this message in context:
http://r.789695.n4.nabble.com/labeling-abscissa-using-a-function-of-the-plotted-scale-tp4678075.html
Sent from the R help mailing list archive at Nabble.com.
__
Hi,
In the example you showed:
m1<- matrix(0,length(vec),max(vec))
1*!upper.tri(m1)
#or
m1[!upper.tri(m1)] <- rep(rep(1,length(vec)),vec)
#But, in a case like below, perhaps:
vec1<- c(3,4,5)
m2<- matrix(0,length(vec1),max(vec1))
indx <-
cbind(rep(seq_along(vec1),vec1),unlist(tapply(vec1,l
On Oct 10, 2013, at 8:16 AM, Zev Ross wrote:
> Hi All,
>
> I'm trying to edit a file in place using system2 and sed from within R. I can
> get my command to work unless there is a backslash in the command in which
> case I'm warned about an "unrecognized escape". So, for example:
>
> system2(
> -Original Message-
> I'm using R version 3.0.0 on a mac. I'm having trouble getting order to
> behave as I expect it should. I'm trying to sort a data.frame according
> to a character vector. I'm able to sort the data.frame, but it retruns an
> unexpected result. I have no idea where t
And if you need some extra digits:
require(Rmpfr)
testfn<-function(x){2^x+3^x-13}
myint<-c(mpfr(-5,precBits=1000),mpfr(5,precBits=1000))
myroot<-unirootR(testfn, myint, tol=1e-30)
myroot
John Nash
On 13-10-11 06:00 AM, r-help-requ...@r-project.org wrote:
Message: 33
Date: Thu, 10 Oct 2013 21:0
I'd wager that the problem lies in the expectations. Karl: Read up on what
order() actually does; it is not what I think you think it does.
Perhaps
str.dat[match(gen.names, str.dat$ind.names),]
or
rownames(str.dat) <- str.dat$ind.names
str.dat[gen.names,]
was intended? (Both untested, some
Also,
df1 <- do.call(rbind,lapply(split(df,df$group),function(x)
data.frame(dt2=seq(x[1,1],x[nrow(x),1],by="15 min"),group=x[1,2])))
id1<- df1[,2][match(as.POSIXct(dt),df1[,1])]
id1[is.na(id1)]<- 0
identical(id1,id)
#[1] TRUE
A.K,
On Thursday, October 10, 2013 9:29 PM, arun wrote:
Hi Ben,
I
Success!
Thanks to everyone who helped. I needed to have the right file encoding
parameter when using read.table().
test08 = read.table("test.csv", sep = ",", header = TRUE,
stringsAsFactors = FALSE, fileEncoding = "UCS-2")
Upon further research:
http://technet.microsoft.com/en-us/library/bb3
On 11-10-2013, at 15:26, Steven Ranney wrote:
> Hello all -
>
> I have an example column in a dataFrame
>
> id.name
> 123.45
> 123.45
> 123.45
> 123.45
> 234.56
> 234.56
> 234.56
> 234.56
> 234.56
> 234.56
> 234.56
> 345.67
> 345.67
> 345.67
> 456.78
> 456.78
> 456.78
> 456.78
> 456.78
> 456.7
Hi
I named your data test
test$x<-1
test$x<-unlist(lapply(split(test$x, test$id.name), cumsum))
> test
id.name x
1 123.45 1
2 123.45 2
3 123.45 3
4 123.45 4
5 234.56 1
6 234.56 2
7 234.56 3
8 234.56 4
9 234.56 5
10 234.56 6
11 234.56 7
12 345.67 1
13 345.67 2
14 345.67 3
Steps:
1. write your code in R command line format
2. save to a .sh file
3. Add to cron of linux machine
Regards,
Vivek
-Original Message-
From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On
Behalf Of Johnson, Alex
Sent: Friday, October 11, 2013 4:05 PM
To: r-help
To close the loop on this, I can report that I solved the convergence issue by
updating the original semBoot code. I thought I might be using something out of
date, so I ran sem:::bootSem.sem and grabbed the function code.
I updated the gist where I create bootSem2() to stop R from crashing on
Hello everybody,
I have count data and with these data, I would like to build a mixed
model by using the function glmer(). In a first time, I calculated the c-hat of
a simple model with glm() to verify overdispersion and I found a c-hat = 18. I
also verified overdispersion in the mixed model
Also,
it might be faster to use ?data.table()
library(data.table)
dt1<- data.table(dat1,key='id.name')
dt1[,x:=seq(.N),by='id.name']
A.K.
On , arun wrote:
Hi,
Try:
dat1<-
structure(list(id.name = c(123.45, 123.45, 123.45, 123.45, 234.56,
234.56, 234.56, 234.56, 234.56, 234.56, 234.56, 345
OK It is right
Thank you Petr
Michel
Le 11/10/2013 14:58, PIKAL Petr a écrit :
Hi
I usually use scale
something like
scale_fill_discrete(name = "Fancy Title")
shall do the trick
Regards
Petr
-Original Message-
From: r-help-boun...@r-project.org [mailto:r-help-bounces@r-
project.
Hello all -
I have an example column in a dataFrame
id.name
123.45
123.45
123.45
123.45
234.56
234.56
234.56
234.56
234.56
234.56
234.56
345.67
345.67
345.67
456.78
456.78
456.78
456.78
456.78
456.78
456.78
456.78
456.78
...
[truncated]
And I'd like to create a second vector of sequential values
Hi
not sure if it is the most efficient and clever solution
ifelse(b<7, NA, cumsum(c(0,diff(!(b<7)))==1))
Regards
Petr
> -Original Message-
> From: r-help-boun...@r-project.org [mailto:r-help-bounces@r-
> project.org] On Behalf Of Benjamin Gillespie
> Sent: Thursday, October 10, 2013 1
Hi
I usually use scale
something like
scale_fill_discrete(name = "Fancy Title")
shall do the trick
Regards
Petr
> -Original Message-
> From: r-help-boun...@r-project.org [mailto:r-help-bounces@r-
> project.org] On Behalf Of Arnaud Michel
> Sent: Friday, October 11, 2013 11:02 AM
>
On 10/10/2013 11:33 PM, Rebecca Stirnemann wrote:
> Hi Michael,
> Thanks! That worked. Which is so brilliant!
> A couple of questions. In regards to display.
> Do you know how to add labels on to the graph? The code below doesn't
> work.
Not surprising, since your data, mao1, is not in the lme4 pa
> I have recently installed R and am trying to do some work on it.
Congratulations; you are learning one of (possibly the) world's most powerful
statistics environments.
> To be honest I'm finding it a PAIN to [use?].
You can have cheap, powerful, easy to use statistics software. Pick any two.
(I'm afraid this post didn't reach the list on last Wednesday, here it is again
)
hi R-list,
And sorry for my frenglish !
I am running R < Good Sport > release ( i386-w64-mingw32/i386 (32-bit) ) )
under Windows 7 Professional, Service Pack 1.
My perl executable is ActivePerl build 817 [257965]
Hi R wizards,
Can any one tell me how to code to remove the title panels in a lattice
graph and to make my confidence intervals black instead of coloured?
I have the following code:
> library(effects)
> library(lme4)
> data(mao1, package="lme4")
> fm1 <- lmer(frat ~ flandusenumb + ground.cover_lo
if you want to use R itself, you could try --
# check your time zone's abbreviation
Sys.time()
# subtract the time you want the program to run from the current time,
# including your time zone..mine is EDT
Sys.sleep( as.POSIXct( "2013-10-11 06:30:00 EDT" ) - Sys.time() )
-- at the very top of
Le jeudi 10 octobre 2013 à 21:45 -0700, Ira Sharenow a écrit :
> Thanks for the suggestion. From R version 3.0.2, I tried
>
>
>
> > testDF7 = iconv(x = test07 , from = "UCS-2", to = "")
>
> > Encoding(testDF7)
>
> [1] "unknown"
>
>
>
> > testDF7[1:6]
>
> [1] NA NA NA NA NA NA
>
>
>
Hello
I don't arrive to change the title of the legend
My code is :
library(ggplot2)
ma <- max(General$AgeChangCat) ; mi <- min(General$AgeChangCat)
Test$Recrutement <- factor(Test$CadNonCadRecrut)
p <-
ggplot(Test, aes(x=factor(Cat1), y=AgeChangCat )) +
ylim(mi,ma) +
geom_point() +
geom_boxplot(a
Hi,
I was wondering if there is there a way you can schedule an R script to
run automatically through a scheduled task in windows or similar?..
Would R have to be open on the user's PC or could it be closed providing
we pointed it correctly at R?...
Thank you
Alex
Alex Johnson
Opera
62 matches
Mail list logo