A variation is to remove Well and then we can use dot to refer to the
remaining columns.
aggregate(cbind(OD, ODnorm) ~ . , subset(df, select = - Well), mean)
On Tue, Oct 24, 2023 at 8:32 AM Luigi Marongiu wrote:
>
> Hello,
> I have a data frame with different groups (Time, Target, Conc) and
It is best to use Date, rather than POSIXct, class if there are no times.
Use the cumsum expression shown to group the dates and then summarize
each group.
We assume that the dates are already sorted in ascending order.
library(dplyr)
mydf <- data.frame(date = as.Date(c("2012-02-05",
The header has white space in it so skip over it, use header = FALSE
and specify the
column headers yourself. Also use fill=TRUE since the first row does
not have 3 entries.
# generate test file
cat("Date Adj Close lret
02-01-1997 737.01
03-01-1997 748.03 1.48416235
06-01-1997 747.65
Also try
apply(Filter(is.numeric, mydf), 1, sum)
On Tue, Feb 7, 2023 at 8:42 AM PIKAL Petr wrote:
>
> Hi Naresh
>
> If you wanted to automate the function a bit you can use sapply to find
> numeric columns
> ind <- sapply(mydf, is.numeric)
>
> and use it in apply construct
> apply(mydf[,ind],
If the equations are in the form shown in your post then take the log of
both sides, expand the logs and replace log(whatever) with new variables so
now the equations are in linear form and are easy to solve.
__
R-help@r-project.org mailing list -- To
A Cullen & Frey graph (fitdistrplus::descdist) can be used to compare certain
common distributions.
On Wed, Oct 26, 2022 at 9:42 AM Paul Bernal wrote:
>
> Dear friends from the R community,
>
> Hope you are all doing great. So far, whenever I need to perform
> distribution fitting on a
Create a pdf using latex that has only page numbers and then
superimpose that with your pdf using the free utility pdftk. The
animation R package has an interface to pdftk. Google to locate
pdftk and again to locate instructions.
There are also freeware GUI Windows programs that are easy
to
The zoo package implements tolerances internally. Converting the ts
object to zoo:
library(zoo)
identical(as.integer(time(as.zoo(x))), true.year)
## [1] TRUE
On Sat, Oct 15, 2022 at 3:26 AM Andreï V. Kostyrka
wrote:
>
> Dear all,
>
>
>
> I was using stats::time to obtain the year as a
Look at the examples at the end of ?xts for more info.
library(quantmod)
getSymbols("AAPL")
class(AAPL)
## [1] "xts" "zoo"
range(time(AAPL))
## [1] "2007-01-03" "2022-07-08"
# everything up to indicated date
a1 <- AAPL["/2018-02-01"]
# remove non consecutive dates
d <-
Soren Hojsgaard had also written a tcltk based editor R package and although
it is deprecated too it may be simpler than rite in which case it is
more likely to work. Contact him (he has other packages on CRAN)
and see if he would send it to you and if it fits your needs.
On Sun, May 22, 2022 at
Since you are dealing with graphs you could consider using
the igraph package. This is more involved than needed for
what you are
asking but it might be useful for other follow on calculations.
We first define a 2 column matrix of edges, then convert it to
an igraph and simplify it to remove
In case it is of interest this problem can be solved with an
unconstrained optimizer,
here optim, like this:
proj <- function(x) x / sqrt(sum(x * x))
opt <- optim(c(0, 0, 1), function(x) f(proj(x)))
proj(opt$par)
## [1] 5.388907e-09 7.071068e-01 7.071068e-01
On Fri, May 21, 2021
Also, it might be better to simply use seconds as the time. In that
case both plot and xyplot run without error.
time(DF.w) <- as.POSIXlt(time(DF.w))$sec
# now run plot or xyplot as before
On Mon, Feb 22, 2021 at 11:56 AM Gabor Grothendieck
wrote:
>
> I assume that this is a lattic
I assume that this is a lattice problem. Replacing xyplot with plot
and using all the same arguments there is no error.
On Mon, Feb 22, 2021 at 11:26 AM Laurent Rhelp wrote:
>
> Dear R-Help-List,
>
> I have to process time series with a sampling frequency of 1 MHz.
> I use the POSIXct
I personally use the packages you mention and
would describe them as well thought out and relatively
bug free through widespread use and years of improvement
and maintenance. There are literally dozens of other packages
that depend on these packages so if you use them you will
also be able to
The start= argument should be as follows:
nls(y ~ x/(x - a[z]),start=list(a = strt),data=xxx)
On Fri, Dec 11, 2020 at 6:51 PM Rolf Turner wrote:
>
>
>
> I want to fit a model y = x/(x-a) where the value of a depends
> on the level of a factor z. I cannot figure out an appropriate
> syntax for
Recursively walk the formula performing the replacement:
g <- function(e, ...) {
if (length(e) > 1) {
if (identical(e[[2]], as.name(names(list(...) {
e <- eval(e, list(...))
}
if (length(e) > 1) for (i in 1:length(e)) e[[i]] <- Recall(e[[i]], ...)
}
Probably simplest to assign the names afterwards as others have
suggested but it could be done like this:
library(sqldf)
write.csv(BOD, "BOD.csv", quote = FALSE, row.names = FALSE) # test data
read.csv.sql("BOD.csv", "select Time as Time2, demand as demand2 from file")
giving the column
seem to work ...
>
> con <- data.frame(V1 = c(1, 2, 3, 4, 5, 6, 7, 8, 9, 10))
> sqldf()
> sqldf(c("pragma count_changes = 1", "update con set V1 = 0 where V1 > 5 "))
> ans <- sqldf("select * from main.con")
> sqldf()
>
> -Original
Here is an example. Ignore the warning or use the workaround discussed here
https://github.com/ggrothendieck/sqldf/issues/40
to avoid the warning.
library(sqldf)
sqldf() # use same connection until next sqldf()
sqldf(c("pragma count_changes = 1", "update BOD set demand = 99
where Time >
We can use nls2 to try each value in 10:100 as a possible split point
picking the one with lowest residual sum of squares:
library(nls2)
fm <- nls2(Y ~ cbind(1, pmin(X, X0)), start = data.frame(X0 = 10:100),
algorithm = "plinear-brute")
plot(Y ~ X)
lines(fitted(fm) ~ X, col = "red")
> fm
It seems CG is having problems with the cube root. This converges while
still using CG:
S1 <- optim(1001,function(x) (production1(x)^3), method = "CG",
control = list(fnscale=-1))
On Thu, Mar 12, 2020 at 9:34 AM Skyler Saleebyan
wrote:
>
> I am trying to familiarize myself with optim() with
That is use the 1st 2nd, 3rd, 5th, etc. point in each year from the
305 series. This aligns them by throwing away 305-256=49
points per year in the 305 series so that both series can be
set up with a frequency of 256 points per year.
On Wed, Feb 19, 2020 at 10:37 AM Gabor Grothendieck
wrote
Assuming that they both cover the same period of time then
if you are willing to throw away some points then
consider using only these 256 elements from the 305 series
round(seq(1, 305, length = 50))
## [1] 1 7 13 20 26 32 38 44 ...etc...
That is use the 1st ,7th, 13th, etc. point
Normally one uses match.fun to avoid such problems.
This will give the error shown even if FUN is defined in the global environment.
test <- function(FUN, args) {
FUN <- match.fun(FUN)
print(FUN)
FUN(args)
}
test(NULL, 1:10)
## Error in match.fun(FUN) : 'NULL' is not a
oin = "left"))
>
> The second argument to do.call is a list which becomes the arguments to
> the function being called. Your time series should be unnamed entries
> in the list, while other arguments to merge() should be named.
>
> Duncan Murdoch
>
> >
> >
t; > join="left"
> > parameter to the do.call() command but I could not get the syntax to work
> > (assuming it's even possible).
> >
> > Thanks,
> > Eric
> >
> >
> > On Thu, Jan 2, 2020 at 3:23 PM Gabor Grothendieck
> > wrote:
&
orks in this case.
> Suppose that instead of the default "outer" join I wanted to use, say, a
> "left" join.
> Is that possible? I tried a few ways of adding the
> join="left"
> parameter to the do.call() command but I could not get the syntax to work
> (as
You don't need Reduce as xts already supports mutliway merges. This
perfroms one
multiway merge rather than k-1 two way merges.
do.call("merge", L)
On Thu, Jan 2, 2020 at 6:13 AM Eric Berger wrote:
>
> Hi,
> I have a list L of about 2,600 xts's.
> Each xts has a single numeric column.
package. That would give priority for
> any functions in the stats package over the newly loaded package (but
> also give priority for any other packages earlier on the search path).
>
> On Sat, Nov 23, 2019 at 6:25 AM Gabor Grothendieck
> wrote:
> >
> > library and re
library and require have new args in 3.6 giving additional control
over conflicts. This seems very useful but I was wondering if there
were some, preferabley simple, way to give existing loaded packages
priority without knowing the actual conflicts in advance. For example
library(dplyr,
If I run this (which is identical to your code except I supplied some
random input since your
post did not include any) I get no error:
library(vrtest)
library(zoo)
set.seed(123)
x <- rnorm(100)
y <- zoo(x)
z <- rollapply(y,50, function(x) AutoBoot.test(x,nboot=30,
lag.zoo supports vector-based lags on zoo objects.
A few caveats:
- dplyr's lag clobbers the base R lag (which you need to
invoke lag's methods) so if you have dplyr loaded be sure
to refer to stats::lag.
- dplyr's lag works backwards relative to the standard set
in base R so dplyr::lag(x, 1)
which is motivated to some degree by Octave but is actually
quite different and is particularly suitable in terms of performance
for iterative computations where one iteration depends on the prior
one.
On Mon, Jan 28, 2019 at 6:32 PM Gabor Grothendieck
wrote:
>
> R has many similarities to
This would be a suitable application for NetLogo. The R package
RNetLogo provides an interface. In a few lines of code you get a
simulation with graphics.
On Mon, Jan 28, 2019 at 7:00 PM Alan Feuerbacher wrote:
>
> On 1/28/2019 4:20 PM, Rolf Turner wrote:
> >
> > On 1/29/19 10:05 AM, Alan
R has many similarities to Octave. Have a look at:
https://cran.r-project.org/doc/contrib/R-and-octave.txt
https://CRAN.R-project.org/package=matconv
On Mon, Jan 28, 2019 at 4:58 PM Alan Feuerbacher wrote:
>
> Hi,
>
> I recently learned of the existence of R through a physicist friend who
>
There is some discussion of approaches to this here:
https://stackoverflow.com/questions/34096162/dplyr-mutate-replace-on-a-subset-of-rows/34096575#34096575
On Mon, Dec 17, 2018 at 10:30 AM Paul Miller via R-help
wrote:
>
> Hello All,
>
> Season's greetings!
>
> Am trying to replicate some
Replace the week in the date with week 2, say -- a week in which
nothing will go wrong and then add or subtract the appropriate number
of weeks.
d <- c('2016 00 Sun', '2017 53 Sun', '2017 53 Mon') # test data
as.Date(sub(" .. ", "02", d), "%Y %U %a") +
7 * (as.numeric(sub(" (..)
The isChar function used in Parse is:
isChar <- function(e, ch) identical(e, as.symbol(ch))
On Fri, Aug 24, 2018 at 10:06 PM Gabor Grothendieck
wrote:
>
> Also here is a solution that uses formula processing rather than
> string processing.
> No packages are used.
>
>
11:50 AM Paul Johnson wrote:
>
> Thanks as usual. I owe you more KU decorations soon.
> On Wed, Aug 22, 2018 at 2:34 AM Gabor Grothendieck
> wrote:
> >
> > Some string manipulation can convert the formula to a named vector such as
> > the one shown at the end of your
Some string manipulation can convert the formula to a named vector such as
the one shown at the end of your post.
library(gsubfn)
# input
fo <- y ~ 2 - 1.1 * x1 + x3 - x1:x3 + 0.2 * x2:x2
pat <- "([+-])? *(\\d\\S*)? *\\*? *([[:alpha:]]\\S*)?"
ch <- format(fo[[3]])
m <- matrix(strapplyc(ch,
Try this:
plot(1)
tmp <- x >= 3 ~ "&" ~ y <= 3
mtext(tmp)
On Mon, Aug 20, 2018 at 5:00 PM MacQueen, Don via R-help
wrote:
>
> I would like to use plotmath to annotate a plot with an expression that
> includes a logical operator.
>
> ## works well
> tmp <- expression(x >= 3)
> plot(1)
>
or this variation if you don't want the first column to be named init:
Reduce(cbind2, vec, 1:5)
On Tue, Jul 3, 2018 at 10:46 AM, Gabor Grothendieck
wrote:
> Try Reduce:
>
> Reduce(cbind, vec, 1:5)
>
> On Tue, Jul 3, 2018 at 9:28 AM, Viechtbauer, Wolfgang (SP)
> wrote:
Try Reduce:
Reduce(cbind, vec, 1:5)
On Tue, Jul 3, 2018 at 9:28 AM, Viechtbauer, Wolfgang (SP)
wrote:
> Hi All,
>
> I have one vector that I want to combine with another vector and that other
> vector should be the same for every row in the combined matrix. This
> obviously does not work:
>
If you specifically want to know which packages were loaded by the script
then using a vanilla version of R (i.e. one where only base packages are
loaded):
vanilla_search <- search()
source("myRprg.R")
setdiff(search(), vanilla_search)
On Wed, Jun 20, 2018 at 4:08 AM, Sigbert Klinke
There is no `value` column in the `dput` output shown in the
question so using `tmin` instead note that the `width=` argument
of `rollapply` can be a list containing a vector of offsets (-1 is prior
value, -2 is value before that, etc.) and that we can use `rollapplyr`
with an `r` on the end to
split any mixed columns into letter and number columns
and then order can be used on that:
DF <- data.frame(x = c("a10", "a2", "a1"))
o <- do.call("order", transform(DF, let = gsub("\\d", "", x),
no =
as.numeric(gsub("\\D", "", x)),
Using Achim's d this also works to generate z where FUN is a function used
to transform the index column and format is also passed to FUN.
z <- read.zoo(d, index = "time", FUN = as.yearqtr, format = "Q%q %Y")
On Sun, Jan 28, 2018 at 4:53 PM, Achim Zeileis wrote:
> On
I had that in mind, but can't execute the exe due to security
> restrictions.
> Geez, really, treating people who ask questions this way just makes you
> don't want to ask a single one.
>
>
> On Thu, Jan 25, 2018, 11:19 Gabor Grothendieck <ggrothendi...@gmail.com>
> wro
I believe that the ordinary Windows installer for R can produce a
portable result by choosing the appropriate configuration options from the
offered screens when you run the installer Be sure to enter the desired
path in the Select Destination Location screen, choose Yes on the
Startup options
Try that source statement here -- it is running R 3.4.1:
https://www.tutorialspoint.com/execute_r_online.php
On Mon, Oct 30, 2017 at 11:14 AM, Suzen, Mehmet wrote:
> Note that, looks like r-fiddle runs R 3.1.2.
>
> __
>
Maybe one of these are close enough:
xts(c(2, 4, 5), yearqtr(1991:1993))
as.xts(ts(c(2, 4, 5), 1991))
of if you want only a plain year as the index then then use zoo,
zooreg or ts class:
library(zoo)
zoo(c(2, 4, 5), 1991:1993)
zooreg(c(2, 4, 5), 1991)
ts(c(2, 4, 5), 1991)
On
Assuming the input data.frame, DF, is of the form shown reproducibly
in the Note below, to convert the series to zoo or ts:
library(zoo)
# convert to zoo
z <- read.zoo(DF)
# convert to ts
as.ts(z) #
Note:
DF <- structure(list(year = c(1980, 1981, 1982, 1983, 1984), cnsm = c(174,
175, 175,
Here are some more examples:
library(Ryacas)
x <- Sym("x")
yacas("x:=2")
Eval(x*x)
## [1] 4
# vignette has similar example
y <- Sym("y")
Eval(Subst(y*y, y, 3))
## [1] 9
# demo("Ryacas-Function") has similar example to this
f <- function(z) {}
body(f) <- yacas(expression(z*z))[[1]]
f(4)
## [1]
Depending on how you created df maybe your code has the column names
wrong. In any case these 4 alternatives all work. Start a fresh R
session and then copy and paste this into it.
library(zoo)
u <- "https://faculty.washington.edu/ezivot/econ424/sbuxPrices.csv;
fmt <- "%m/%d/%Y"
# 1
sbux1.z
2018-03-3 in your code should be 2018-03-31.
The line
then'201415'
needs to be fixed.
When posting please provide minimal self-contained examples. There was
no input provided and library statements not relevant to the posted
code were included.
Fixing the invalid date and bad line, getting
See FAQ #4 on the sqldf github home page.
On Fri, Aug 11, 2017 at 9:21 AM, Mangalani Peter Makananisa
wrote:
> Dear all,
>
> I recently read the book " R data preperation and manipulation using sqldf
> package" by Djoni Darmawikarta
> However, I have a problem with
Maybe you want this.It computes VaRfun(r[c(i-500, i-1)] for each i for
which the argument to r makes sense.
rollapply(r, width = list(c(-500, -1)), FUN = VaRfun),
On Sat, May 27, 2017 at 5:29 PM, Sepp via R-help wrote:
> Hello,
> I am fairly new to R and trying to
Try this code which does not use rollapply:
w <- 3
Mean <- function(L) Reduce("+", L) / length(L)
lapply(w:length(Data), function(i) Mean(Data[seq(to = i, length = w)]))
On Sun, May 14, 2017 at 6:44 PM, Christofer Bogaso
wrote:
> Hi again,
>
> I am looking to find a
You can use wrapnls from the nlmrt package to get an nls object. Run
it instead of nlxb. It runs nlxb followed by nls so that the output is
an nls object.. Then you can use all of nls' methods.
On occiasion that fails even if nlxb succeeds since the nls
optimization can fail independently of
Assuming that the input is x <- 1:4, try this one-liner:
> embed(c(0*x[-1], x, 0*x[-1]), 4)
[,1] [,2] [,3] [,4]
[1,]1000
[2,]2100
[3,]3210
[4,]4321
[5,]0432
[6,]0043
[7,]0004
On
Recessions are typically shown by shading. The zoo package has
xblocks for this purpose. If app1 is your zoo object then:
plot(app1)
tt <- time(app1)
xblocks(tt, tt >= "1990-07-01" & tt <= "1991-03-31",
col = rgb(0.7, 0.7, 0.7, 0.5)) # transparent grey
See ?xblocks for more info.
On Thu,
Replace newlines and colons with a space since they seem to be junk,
generate a pattern to replace the attributes with a comma and do the
replacement and finally read in what is left into a data frame using
the attributes as column names.
(I have indented each line of code below by 2 spaces so if
If you are not tied to that model the SSasymp() model in R could be
considered and is easy to fit:
# to plot points in order
o <- order(cl$Area)
cl.o <- cl[o, ]
fm <- nls(Retention ~ SSasymp(Area, Asym, R0, lrc), cl.o)
summary(fm)
plot(Retention ~ Area, cl.o)
1. Convert the date from R's origin to the origin used by SQLite's
strftime function and then be sure you are using the correct SQLite
strftime syntax:
library(sqldf)
sqldf("select strftime('%m', Date + 2440588.5) month from log")
2. Alternately use the H2 backend which actually supports
To be precise it's SQLite that does not have date and time data types.
If you use an sqldf backend such as H2 that does have such types then
sqldf will pass them as such. In the case of R's "Date" class such
objects are passed to SQLite as numbers since that is what SQLite can
understand but they
I would be careful about making assumptions regarding what is faster.
Performance tends to be nonintuitive.
When I ran rollapply/lm, rollapply/fastLm and roll_lm on the example
you provided rollapply/fastLm was three times faster than roll_lm. Of
course this could change with data of different
Just replacing lm with a faster version would speed it up. Try lm.fit
or even faster is fastLm in the RcppArmadillo package.
On Thu, Jul 21, 2016 at 2:02 PM, jeremiah rounds
wrote:
> Hi,
>
> A not unusual task is performing a multiple regression in a rolling window
>
Try this:
Reduce(modifyList, list(x, y, z))
On Tue, Jul 19, 2016 at 12:34 PM, Luca Cerone wrote:
> Dear all,
> I would like to know if there is a function to concatenate two lists
> while replacing elements with the same name.
>
> For example:
>
> x <-
Here are two ways that do not use any packages:
s <- paste(letters, collapse = "") # test input
substring(s, first, last)
## [1] "abcde" "fghij" "klmnopqrs"
read.fwf(textConnection(s), last - first + 1)
## V1V2V3
## 1 abcde fghij klmnopqrs
On Wed, May 11, 2016 at
This involves mucking with the internals as well but it is short:
structure(T1, tzone = "UTC")
On Mon, May 9, 2016 at 9:24 AM, Arnaud Mosnier wrote:
> Dear UseRs,
>
> I know two ways to convert dates and time from on time zone to another but
> I am pretty sure that there
osa Aleksandrovic, FRM, CAIA
> Quantitative Analyst - Convertibles
> aljosa.aleksandro...@man.com
> Tel +41 55 417 76 03
>
> Man Investments (CH) AG
> Huobstrasse 3 | 8808 Pfäffikon SZ | Switzerland
>
> -Original Message-
> From: Gabor Grothendieck [mailto:ggrothendi...@gm
Regress on a multivariate polynomial:
lm(y ~ polym(x1, x2, x3, x4, degree = 3))
See ?polym
__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide
This is a quadratic programming problem that you can solve using
either a quadratic programming solver with constraints or a general
nonlinear solver with constraints. See
https://cran.r-project.org/web/views/Optimization.html
for more info on what is available.
Here is an example using a
This manufactures the functions without using eval by using substitute
to substitute i-1 and a[i] into an expression for the body which is
then assigned to the body of the function:
hh <- vector("list", 5)
hh[[1]] <- f(a[1])
for(i in 2:5) {
hh[[i]] <- hh[[1]]
body(hh[[i]]) <-
sqldf does not use Tk so you can ignore this.
On Fri, Feb 19, 2016 at 12:32 PM, Divakar Reddy
wrote:
> Dear R users,
>
> I'm getting Waring message while trying to load "sqldf" package in R3.2.3
> and assuming that we can ignore this as it's WARNING Message and not an
>
See
Example 5. Insert Variables
on the sqldf home page.
https://github.com/ggrothendieck/sqldf
On Wed, Feb 3, 2016 at 2:16 PM, Amoy Yang via R-help
wrote:
> First, MVAR<-c("population) should be the same as "population'". Correct?
> You use tab[[MVAR]] to refer to
Try the mclust package:
library(mclust)
temp.na <- na.omit(temp)
fm <- Mclust(temp.na)
g <- fm$classification
plot(temp.na, pch = g, col = g)
On Tue, Feb 2, 2016 at 6:35 AM, PIKAL Petr wrote:
> Dear all
>
> I have data like this
>
>> dput(temp)
>
> temp <-
signed for slightly different
> problem.
>
> Here is the result with whole data.
>
> fm <- Mclust(temp)
> g <- fm$classification
> plot(1/temp[,1], temp[,2], pch = g, col = g)
>
> I will go through the docs more thoroughly, to be 100% sure I did not miss
>
] 0.6305 -0.1247 -0.0032
$ value : num 473 <=
$ counts : Named int [1:2] 182 NA
..- attr(*, "names")= chr [1:2] "function" "gradient"
$ convergence: int 0
$ message: NULL
On Sat, Nov 14, 2015 at 10:32 AM, Gabor Grothendieck
<ggrothendi...@g
Tyipcally the parameters being optimized should be the same order of
magnitude or else you can expect numerical problems. That is what the
fnscale control parameter is for.
On Sat, Nov 14, 2015 at 10:15 AM, Lorenzo Isella
wrote:
> Dear All,
> I am using optim() for a
I meant the parscale parameter.
On Sat, Nov 14, 2015 at 10:30 AM, Gabor Grothendieck
<ggrothendi...@gmail.com> wrote:
> Tyipcally the parameters being optimized should be the same order of
> magnitude or else you can expect numerical problems. That is what the
> fnscale co
This could be modeled directly using Bayesian techniques. Consider the
Bayesian version of the following model where we only observe y and X. y0
is not observed.
y0 <- X b + error
y <- round(y0)
The following code is based on modifying the code in the README of the CRAN
rcppbugs R
Correction.
Yes, it's the projection of S onto the subspace orthogonal to B which is:
X <- S - (B%o%B) %*% S/ sum(B*B)
and is also implied by Duncan's solution since that is what the residuals
of linear regression are.
On Tue, Oct 20, 2015 at 1:11 PM, Gabor Grothendieck <ggro
Yes, it's the projection of S onto the subspace orthogonal to B which is:
X <- S - B%*%B / sum(B*B)
and is also implied by Duncan's solution since that is what the residuals
of linear regression are.
On Tue, Oct 20, 2015 at 1:00 PM, Paul Smith wrote:
> On Tue, Oct 20, 2015
> do.call(c, lapply(temp, function(x) if (is.list(x)) x else list(x)))
[[1]]
[1] 1 2 3
[[2]]
[1] "a" "b" "c"
$duh
[1] 5 6 7 8
$zed
[1] 15 16 17
On Tue, Sep 29, 2015 at 11:00 AM, Therneau, Terry M., Ph.D. <
thern...@mayo.edu> wrote:
> I'd like to flatten a list from 2 levels to 1 level. This
You may have to do without masking and switch back to nls. dproot2 and fo
are from prior post.
# to mask Rm6 omit it from start and set it explicitly
st <- c(Rm1=1.01, Rm2=1.01, Rm3=1.01, Rm4=6.65, Rm5=1.01, d50=20, c=-1)
Rm6 <- 1
fm.nls <- nls(fo, dproot2, start = st)
AIC(fm.nls)
ng with my function. I tried some
> times but am not sure how to improve it because I am quite new to R.
>
> Could anyone please give me some suggestion.
>
> Thanks a lot!
>
>
> Jianling
>
>
> On 22 September 2015 at 00:43, Gabor Grothendieck
> <ggrothendi...@
1.01, Rm2=1.01, Rm3=1.01, Rm4=6.65, Rm5=1.01, Rm6=1,
d50=20, c=-1))
On Tue, Sep 22, 2015 at 7:04 AM, Gabor Grothendieck <ggrothendi...@gmail.com
> wrote:
> Just write out the 20 terms.
>
> On Mon, Sep 21, 2015 at 10:26 PM, Jianling Fan <fanjianl...@gmail.com>
> wrote:
>
>>
Express the formula in terms of simple operations like this:
# add 0/1 columns ref.1, ref.2, ..., ref.6
dproot2 <- do.call(data.frame, transform(dproot, ref = outer(dproot$ref,
seq(6), "==") + 0))
# now express the formula in terms of the new columns
library(nlmrt)
fitdp1<-nlxb(den ~ (Rm1 *
Your read.csv call works for me under Windows on "R version 3.2.2 Patched
(2015-08-25 r69180)" but not on "R version 3.1.3 Patched (2015-03-16
r68169)".
Suggest you upgrade your R installation and try again.
If you are on Windowsw and don't want to upgrade right now an alternative
is to issue
This uses a regular expression but is shorter:
> gsub("(.).", "\\1", "ABCDEFG")
[1] "ACEG"
It replaces each successive pair of characters with the first of that
pair. If there is an odd number of characters then the last character is
not matched and therefore kept -- thus it works properly for
You can do that with bc if you pass the entire expression to bc(...) in
quotes but in that case you will have to use bc notation, not R notation
so, for example, exp is e and atan is a.
library(bc)
bc(e(sqrt(163)*4*a(1)))
[1]
Sorry if this appears twice but I am not sure the first attempt got through.
This is not much to go on but here is a short self contained example which
creates a longitudinal data frame L in long form from the built in data
frame BOD and then plots it as points and splines using lattice:
L -
On Thu, Jun 18, 2015 at 10:32 AM, Courtney Bryant cbry...@andrew.cmu.edu
wrote:
Good Morning,
I am currently working with a disabled R user who is a student here at
CMU. The student has both sight and mobility issues. The student has
asked for an assistant who is well versed in R to enter
On Fri, May 29, 2015 at 10:12 PM, Mark Drummond m...@markdrummond.ca wrote:
I've been getting a 403 when I try pulling from the Toronto CRAN mirror
today.
http://cran.utstat.utoronto.ca/
Is there a contact list for mirror managers?
See the cran_mirrors.csv file in
R.home(doc)
of your R
On Fri, Mar 13, 2015 at 11:36 AM, Kumsaa waddee...@gmail.com wrote:
How could I extract both month and year from a date? I know how to
separately extract both using lubridate package:
df$month - month(df$date)
df$year- year(df$date)
I wish to extract year and month as one column
On Fri, Feb 27, 2015 at 5:19 PM, Alrik Thiem alrik.th...@gmail.com wrote:
I would like to replace all lower-case letters in a string that are not part
of certain fixed expressions. For example, I have the string:
pmin(pmax(pmin(x1, X2), pmin(X3, X4)) == Y, pmax(Z1, z1))
Where I would like to
there're no integers following the components in the
pmin/pmax functions. Could this be generalized to handle both cases?
Best wishes,
Alrik
-Ursprüngliche Nachricht-
Von: Gabor Grothendieck [mailto:ggrothendi...@gmail.com]
Gesendet: Samstag, 28. Februar 2015 13:35
An: Alrik Thiem
Cc
On Wed, Feb 11, 2015 at 9:45 AM, Doran, Harold hdo...@air.org wrote:
I have a function written and tested using R 3.0.1 and sqldf_0.4-7.1 that
works perfectly. However, using this same code with R 3.1.2 and sqldf_0.4-10
yields the error below that I am having a difficult time deciphering.
1 - 100 of 4302 matches
Mail list logo