Hi,
Check if this works:
library(reshape2)
res1 <- acast(FLSAdata_melt, ViolationDesc + ReasonDesc ~ variable, sum,
margins=TRUE)[,-4]
res2 <- within(as.data.frame(res1),`Count of Case ID` <- dcast(FLSAdata_melt,
ViolationDesc + ReasonDesc ~ variable, length, margins=TRUE)[,3])[,c(4,1:3)]
colna
> Hello,
>
> Sorry if this is repeated somewhere, I imagine it must be a common issue
> but I can't find an answer!
>
> I have a data.frame with two responses, example (response variables to x
> are y1 and y2):
>
> df<-data.frame(x=1:10,y1=1:10,y2=11:20)
>
> I would like to see it on the same plot
How about
lattice.plots <- list(xyplot(rnorm(10) ~ 1:10, type = "b"),
xyplot(rnorm(10) ~ 1:10, type = "b"),
xyplot(rnorm(10) ~ 1:10, type = "b"),
xyplot(rnorm(10) ~ 1:10, type = "b"))
do
What in the world is so horrible about for loops?
---
Jeff NewmillerThe . . Go Live...
DCN:Basics: ##.#. ##.#. Live Go...
Live: O
Hi Erin,
In the "xts" package, functions "endpoints" and "period.apply" are
quite flexible. It might helps you to achieve what you are trying to
do.
Regards,
Pascal
On 18 February 2014 12:01, Erin Hodgess wrote:
> Hello again!
>
> Using "as.yearmon" or "as.yearqtr" will produce an xts object.
Hello again!
Using "as.yearmon" or "as.yearqtr" will produce an xts object. Is there
something for annual objects that works in the same way please?
thanks,
Erin
--
Erin Hodgess
Associate Professor
Department of Computer and Mathematical Sciences
University of Houston - Downtown
mailto: erinm.
Hi Erin,
"Best" is subjective, but I like
library(lubridate)
library(plyr)
xb.df <- mutate(xb.df,
time = ymd(time, truncated = 1),
year = year(time),
quarter = quarter(time))
Best,
Ista
On Mon, Feb 17, 2014 at 7:35 PM, Erin Hodgess wrote:
> Hell
Dear Rxperts
Is there a way to control the display order (or simplistically control
panel layout) of a list of trellis objects without using a for loop (or
whatever)?
I just realize that gridExtra has that feature.. (grid.arrange)...
But, converting each of those elements of the list of trellis
Hello!
I generate the following two data frames:
> xa.df <- data.frame(x=rnorm(10),time=2001:2010)
> xa.df
x time
1 -1.73207086 2001
2 -0.84014049 2002
3 -0.02332163 2003
4 -1.47236670 2004
5 -0.17736265 2005
6 -1.27134314 2006
7 -2.53425374 2007
8 0.79132952 2008
9 1.165
Hi,
Try:
library(reshape2)
df2New <- melt(df,id.var="x")
ggplot(df2New,aes(x=x,y=value,colour=variable))+geom_point(shape=1)
A.K.
On Monday, February 17, 2014 5:42 PM, Ramiro Barrantes
wrote:
Hello,
Sorry if this is repeated somewhere, I imagine it must be a common issue but I
can't find
Hello,
Sorry if this is repeated somewhere, I imagine it must be a common issue but I
can't find an answer!
I have a data.frame with two responses, example (response variables to x are y1
and y2):
df<-data.frame(x=1:10,y1=1:10,y2=11:20)
I would like to see it on the same plot with different c
Hello,
Use ?formals.
> formals(myfunction)
$a
$b
$c
$...
Hope this helps,
Rui Barradas
Em 17-02-2014 21:22, Jonathan Greenberg escreveu:
R-helpers:
I'm guessing this is an easy one for some of you, but I'm a bit
stumped. Given some arbitrary function (doesn't matter what it does):
Here are two ways:
## construct formals adding ...
f <- c(formals(myfunction), unlist(alist(... = )))
## replace the formals, excluding the extra ... if it previously existed
formals(myfunction) <- f[!duplicated(names(f))]
## 2nd way, searching for ... and doing the replacement only if it is not
On Feb 17, 2014, at 1:22 PM, Jonathan Greenberg wrote:
> R-helpers:
>
> I'm guessing this is an easy one for some of you, but I'm a bit
> stumped. Given some arbitrary function (doesn't matter what it does):
>
> myfunction <- function(a,b,c)
> {
> return(a+b+c)
> }
>
> I want to test this fun
R-helpers:
I'm guessing this is an easy one for some of you, but I'm a bit
stumped. Given some arbitrary function (doesn't matter what it does):
myfunction <- function(a,b,c)
{
return(a+b+c)
}
I want to test this function for the presence of the ellipses ("...")
and, if they are missing, create
Hello,
Many packages have a movind average function. For instance package
forecast. Or
library(sos)
findFn("moving average")
In your example, what you compute is not exactly a moving average, but
in can be computed with something like the following.
s <- (seq_along(dat) - 1) %/% 3
sapply(s
On Feb 17, 2014, at 10:45 AM, C W wrote:
> Hi list,
> How do I calculate a moving average without using filter(). filter() does
> not seem to give weighted averages.
>
> I am looking into apply(), tapply,... But nothing "moves".
>
> For example,
>
> dat<-c(1:20)
> mean(dat[1:3])
> mean(dat[4:
There are a zillion answers to this, because your question is really:
How do I smooth a time series? So you can search on appropriate
keywords.
My answer is: don't use moving averages -- that's pathetically
ancient. ?loess is one among the zillions of alternatives you might
consider. Post on CV (s
Hi list,
How do I calculate a moving average without using filter(). filter() does
not seem to give weighted averages.
I am looking into apply(), tapply,... But nothing "moves".
For example,
dat<-c(1:20)
mean(dat[1:3])
mean(dat[4:6])
mean(dat[7:9])
mean(dat[10:12])
etc...
I understand the poi
Dear R users,
we are happy to announce that a new package, RoughSets, is available on CRAN at
http://cran.r-project.org/web/packages/RoughSets/index.html
It is a comprehensive package for rough set theory and fuzzy rough set theory,
with a detailed manual and many demos showing it's use. Here
Hi,
Try:
indx <-
which(round(rowSums(abs(sweep(edm[,grep("perturb",colnames(edm))],1,edm[,"base"],`-`))),4)
>=0.0025) ##if there is threshold value
indx
#[1] 22 23 24 25 28 31 33
edm[indx,]
A.K.
On Monday, February 17, 2014 11:49 AM, "Morway, Eric" wrote:
Using the small data set below (w
dear Katie,
Since you are looking for exactly 1 breakpoint (namely you know the
number of breakpoints), I suggest to use bootstrap restarting (default
in segmented) with the rough value from davies.test() as a starting
value, namely
o<-davies.test(reg1.2,~lagBYmean)
start.psi<-as.numeric(o$st
Hi,
May be this helps:
set.seed(49)
mat1 <- matrix(sample(120,40*13,replace=TRUE),ncol=13)
#threshold values
set.seed(38)
th1 <- sample(30,13,replace=TRUE)
indx <- mapply("<",as.data.frame(mat1),th1)
#or
indx1 <- !mapply(findInterval,as.data.frame(mat1),th1)
#or
indx2 <- t((t(mat1)-th1) <0)
identi
Using the small data set below (which is a small snippet of a much larger
dataset), I'd like to get the row(s) that corresponds to the largest,
cumulative, absolute difference between the value in "base" and each of the
remaining columns. For example, in row 2, the three absolute differences of
ab
Hi,
Try:
set.seed(49)
dat1 <- data.frame(year=
rep(2010:2013,c(10,8,9,13)),x=sample(1e4,40,replace=TRUE),y=sample(40,40,replace=TRUE))
plot(x~y,data=dat1,subset=year > 2012)
#or
with(subset(dat1,year > 2012),plot(y,x))
A.K.
Hi R people
This might take me the whole day to figure out, instea
Hello R-Users,
I have a Problem in understanding my results using the davies.test
I read the pdf-documentation on the segmented package and followed the
instructions.
1st performing the Davies.test :
> davies.test(reg1.2,~lagBYmean)
Davies' test for a change in the slop
I too don't understand the error message. However Coefficient Alpha is
easily calculated. To wit:
library("psych")
tt <- cbind(c(1,0.58) , c(0.58,1))
colnames(tt) = rownames(tt) = list("V1" , "V2")
p <- nrow(tt)
alpha <- p/(p-1) * (1-sum(diag(tt))/sum(tt))
Numerous caveats regarding using C-A
At 17:49 16/02/2014, Ramesh Chandra Das wrote:
Dear All,
The data format is like this
Company 2001 2001 2001 2002 2002 2002 2003 2003 2003 2004 2004 2004 3M
India Ltd. 1160.2 2082.7 67.1 1094.3 1069.9 221.6 1160.2 2082.7 67.1 1094.3
1069.9 221.6 A B B India Ltd. 7758 7932.8 698.2 7205.4 7617
Sorry, a typo: vec3 instead of vec2
dat3 <-
data.frame(bank_name=vec3,p_for=rep(seq(18),length(unique(dat$bank_name
A.K.
On , arun wrote:
Hi,
Looks like one column name is missing. I am not sure about the output you
wanted. May be this helps.
dat <- read.table(text="row.names bank
Hi,
Looks like one column name is missing. I am not sure about the output you
wanted. May be this helps.
dat <- read.table(text="row.names bank_name date px_last Q_Y p_made
q_made p_for
1 2 1 11/30/06 1.31 p406-q406 406 406 1
2
On Feb 16, 2014, at 11:54 PM, Michał Wajszczuk wrote:
> Hi,
>
> I just download R and R-studio. I have one problem and i can't make through
> it. I'm trying to use help function in R-studio but after typing something,
> error appears. I already searched in web and asked my friends but no
> one c
Can you please help me to estimate the parameters of a 2phase coxian
distribution using R. I am Nelson Sibanda currently a student doing Msc
Operations Research and Statistics at National University of Science and
Technology, Bulawayo, Zimbabwe. The following code were tried and the data
that
Hi,
I just download R and R-studio. I have one problem and i can't make through
it. I'm trying to use help function in R-studio but after typing something,
error appears. I already searched in web and asked my friends but no
one can help me.
Could you please help me or give any advise?
I have Win
Hi,
I am trying to use DESeq2 but I having troubles determining the reduced
formula for the nbinomLRT. I will like to compare the results with the
DEGs I got by nbinomGLMTest using DESeq.
With DESeq I did the following:
co=read.table("C_LPS_PBS_1h_DS.txt",header=T)
ind=c(1,2,4,5,1,3,4,5)
trt=c(
34 matches
Mail list logo