[R] emmeans (component = " response", type = "response")

2024-06-26 Thread Cade, Brian S via R-help
estimated in emmeans? I was led to believe that components="response" , type = "response" would do that but that does not seem to be the case. Thank you Brian Brian S. Cade, PhD U. S. Geological Survey (emeritus) Fort Collins Science Center 2150 Centre Ave., Bldg. C Fort Colli

[R] Interpreting the result of a model with random effects

2022-06-11 Thread Frank S .
ents and p-values for the 5 baseline variables, so I assumed that it was due to the small number of levels (in fact, too few ). However, when computing anova(model.rand, model.fix), the output indicates a p-value < 0.001 in favour of the "model.rand". What's happ

Re: [R] [EXTERNAL] Is there a canonical way to pronounce CRAN?

2022-05-04 Thread Cade, Brian S via R-help
CRAN as in cranberry. Just my minor thought. Brian Brian S. Cade, PhD U. S. Geological Survey Fort Collins Science Center 2150 Centre Ave., Bldg. C Fort Collins, CO 80526-8818 email: ca...@usgs.gov<mailto:brian_c...@usgs.gov> tel: 970 226-9326 From:

[R] complicated time series filtering issue

2022-04-04 Thread Cade, Brian S via R-help
-08 57084544 16741008.5984.31 252 10-Aug-08 57084544 16841002.8 1008.5 10 253 22-Oct-08 57084544 1757 977.6 1002.8 73 254 2-Dec-08 57084544 17981000.6977.6 41 Brian Brian S. Cade, PhD U

Re: [R] Filtering a dataframe

2021-05-17 Thread Saneesh C S
Country <- c('Angola', 'Angola','Botswana', 'Botswana','Zimbabwe','Zimbabwe') year <- c('2006', '2007', '2008', '2009', '2010', '2006') bank_ratio <- c(24,25,38,34,42,49) Reserve_ratio <- c(77,59,64,65,57,86) broad_money <- c(163,188,317,361,150,288) id <- (c(1,1,2,2,3,3)) df <- data.frame(Country

Re: [R] [EXTERNAL] Re: overlaying graphs in xYplot (Hmisc)

2020-04-22 Thread Cade, Brian S via R-help
All the xYplot() functions using Cbind() or cbind() does just exactly what I want (Cbind provides aplot of 3 summary statistics and cbind provides the raw values). I just cannot find anyway to overlay them. Brian Brian S. Cade, PhD U. S. Geological Survey Fort Collins Science Center 2150

[R] overlaying graphs in xYplot (Hmisc)

2020-04-22 Thread Cade, Brian S via R-help
separately, but I would really like to have them overlayed on each other. I've tried various approaches with add=T, new=T, etc and none of those seem to work with xYplot(). Any pointers? Brian Brian S. Cade, PhD U. S. Geological Survey Fort Collins Science Center 2150 Centre Ave., Bl

Re: [R] Efficient way to update a survival model

2019-09-04 Thread Frank S .
Chris, thank you so much for your answer!! Best, Frank S. De: Andrews, Chris Enviado: martes, 3 de septiembre de 2019 14:14 Para: Frank S. Cc: r-help@r-project.org Asunto: Re: [R] Efficient way to update a survival model library("survival") set

Re: [R] Efficient way to update a survival model

2019-09-04 Thread Frank S .
Charles, thank you for your suggestion! Frank S. De: Berry, Charles Enviado: s�bado, 31 de agosto de 2019 19:21 Para: Frank S. Cc: Andrews, Chris ; r-help@r-project.org Asunto: Re: Efficient way to update a survival model The i^th model is included in the Cox

Re: [R] Efficient way to update a survival model

2019-08-30 Thread Frank S .
that, when computing Cox[[1]], the term Cox[[k -1]] does not exist. Is it possible to perform some "trick" (e.g. re-indexing) in order to achieve this? Best, Frank De: Andrews, Chris Enviado: viernes, 30 de agosto de 2019 15:08 Para: Frank S. ; Vito

Re: [R] Efficient way to update a survival model

2019-08-30 Thread Frank S .
date(Cox0, substitute(. ~ . + Z[, 1:k]), data = pbc) attr(Cox[[k]]$coefficients, "names")[2:(k+1)] <- paste0("sin(", 1:k, "* v)") } Cox Best, Frank De: Frank S. Enviado: jueves, 29 de agosto de 2019 12:38 Para: Vito Michele Rosa

Re: [R] Efficient way to update a survival model

2019-08-29 Thread Frank S .
hat OK? Additionally, in my original question I wondered about the possibility of reducing the 10 lines of code to one general expression or some loop. Is it possible? Best, Frank De: Vito Michele Rosario Muggeo Enviado: jueves, 29 de agosto de 2019 8:54 Para: Frank S.

[R] Efficient way to update a survival model

2019-08-28 Thread Frank S .
Hello everybody, I come with a question which I do not know how to conduct in an efficient way. In order to provide a toy example, consider the dataset "pbc" from the package "survival". First, I fit the Cox model "Cox0": library("survival") set.seed(1) v <- runif(nrow(pbc), min = 0, max = 2) Co

Re: [R] Fwd: high p values

2019-03-19 Thread S Ellison
How many data points do you have in each group? - How much do the two groups overlap? If the answers are 'not many' or 'lots' (in that order), and especially if both apply, you can't expect a significant test result. S Ellison *

Re: [R] Help with gsub function

2019-03-18 Thread S Ellison
> tb2a$TID2 <- gsub(tb2a$TID, pattern="-[0-0]{0,7}", replacement = "") Just to add something on why this didn't work ... It looks like you were trying to match a hyphen followed by a number up to seven digits. by mistake(?) you gave the digit range as [0-0] so it would repmatch a hyphen followe

Re: [R] R help

2019-02-15 Thread S Ellison
> I am having an issue with creating a code in which i can hold information such > as the author of a paper, the year of publication, and the title. This doesn't really tell me what the trouble is. But ... > Also would like > to add into this data frame a logical variable which would show some >

Re: [R] pattern evaluation in electron microscopy images

2019-02-11 Thread S Ellison
Not really my field, but would you not approach this using FFT on selected regions? I think IMageJ has some capability in that area; see example at https://imagej.nih.gov/ij/docs/examples/tem/. Steve Ellison > -Original Message- > From: R-help [mailto:r-help-boun...@r-project.org] On

Re: [R] CRAN Task View: Optimization and Mathematical Programming

2019-02-06 Thread S Ellison
> Limited water resources need to be apportioned among various competing > users > (e.g,, agriculture, fish and wildlife, Tribes, potable human water > supplies). Water management is definitely not my field, but for interest - and maybe to help other folk respond - can I ask what the loss functio

Re: [R] Printing a list of simultaneous equations

2019-01-21 Thread S Ellison
> -Original Message- > From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of Michael > Friendly > Check out the `matlib` package on CRAN and devel on github: Very nice! Thanks for the pointer. Steve E *** This

Re: [R] Printing a list of simultaneous equations

2019-01-18 Thread S Ellison
You can drop the quote marks by calling print() explicitly with quote=FALSE, by using as.data.frame round your cbind, or - perhaps best - by constructing your output matrix as a data frame in the first place. (print.data.frame defaults to quote=FALSE). And if you suppress name checking in a dat

Re: [R] Colors on box plots in ggplot

2019-01-18 Thread S Ellison
) which uses default colours. Once you have an aes mapping you can change the scale, so ( p + scale_colour_manual(values = c("red", "blue", "green")) ) gives you the colour ordering you want. ( p + scale_colour_manual(values = c("red", "blue", "gr

Re: [R] NA rows appeared in data.frame

2019-01-14 Thread S Ellison
subset(t1, apply(t1, 1, function(x) !all(is.na(x (or the equivalent '[' usage) and, as an aside, using '==' for floating point numbers is not generally safe; for example > sqrt(2)^2 == 2.0 [1] FALSE See R FAQ 7.31 for details of why '==' is bad for floating poin

Re: [R] Tinn-R: new web site

2019-01-14 Thread S Ellison
> From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of Jose > Claudio Faria > > The Tinn-R project has a new web page: > http://nbcgib.uesc.br/tinnr/en/index.php > Thanks for this - and thanks, also, for maintaining Tinn-R and keeping it available as free software. The effort is muc

[R] Question

2019-01-08 Thread S. Mahmoud Nasrollahi
install.packages : package ‘xyplot’ is not available (for R version 3.5.2) Do you know how I can solve that? -- S. M. Nasrollahi Postdoctoral Researcher French National Institute for Agricultural Research Unite´ Mixte de Recherches sur les Herbivores, 63122 St Gene`s Champanelle, France sayyed

Re: [R] Request for aid in first R script

2018-11-19 Thread S Ellison
Pointers inline below: > > Since I'm a newbie on R, I was wondering if you could help me to achieve a > > small project that I think it's possible with this project (I cant seem to > > find a similar tool) > > > > I have a data file with about 2000 value lines, organized like this: > > > > x;y;z;j

Re: [R] extrat non diagonal

2018-11-14 Thread S Ellison
> With your code you just remove diagonal elements from your matrix. Worse; it removed _all_ elements from the matrix that match _anything_ in the diagonal! Which, in that example, was everything ... *** This email and any attach

Re: [R] extrat non diagonal

2018-11-14 Thread S Ellison
i) Your code creates w2 but references w1 to create aa. So you needed aa <- matrix(rep(c(0.4, 0.1, 0.2), 3), 3,3) for a working example. ii) This > matrix(as.numeric(aa)[!as.numeric(aa) %in% diag(aa)],2,3) removes any value that is present in the diagonal of aa. Look up ?"%in%" to see what that

Re: [R] How to create gridded data

2018-11-13 Thread S Ellison
You might take a look at the reshape package, which switches from 'long' to 'wide' formats and vice versa in a fairly flexible way. S Ellison > -Original Message- > From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of lily li > Sent: 13 Novemb

[R] How to add a dummy code for (G)LMER

2018-11-04 Thread Yune S. Lee
Dear R experts -- I never needed to add a dummy column and always query statistical results by querying summary(model) for GLMER. However, I was recently asked to add a dummy column for interaction variables when performing GLMER. Could anyone tell me if it's necessary to add a dummy column for GL

Re: [R] savehistory()

2018-10-05 Thread Nancy S
tions are not currently implemented there." > > > https://www.rdocumentation.org/packages/utils/versions/3.5.1/topics/savehistory > or > ?savehistory > > If my wild guess is wrong, then you'll need, at a minimum, to provide the > output of > sessionInfo() > for anyone to be able

[R] savehistory()

2018-10-04 Thread Nancy S
Hi, I just start to learn R, but I have problem to use "savehistory()" When I run, it pops out "Error in .External2(C_savehistory, file) : 'savehistory' is not currently implemented". I searched a little bit online, but I still cannot figure out how to fix that. thanks, Suy [[alterna

Re: [R] getting 21 very different colours

2018-09-11 Thread S Ellison
You could look at combning a number of palettes from the RColorBrewer package to get the palette length you want. S Ellison > -Original Message- > From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of Federico > Calboli > Sent: 11 September 2018 08:35 &g

Re: [R] ANOVA Permutation Test

2018-09-03 Thread S Ellison
> This package uses a modified version of aov() function, which uses > Permutation Tests > > I obtain different p-values for each run! Could that be because you are defaulting to perm="Prob"? I am not familiar with the package, but the manual is informative. You may have missed something when r

Re: [R] exponential day

2018-08-09 Thread S Ellison
x likelihood, maybe nlme in the nlme package. For other ideas, look up 'non-linear fitting with R' on any search engine, or check the R Task Views S Ellison *** This email and any attachments are confidential. Any use, copyi

Re: [R] security using R at work

2018-08-09 Thread S Ellison
> If I install R on my work network computer, will the data ever leave our > network? As far as I know, if you run R locally (and not, say, on an amazon EC2 instance) your data - indeed anything about you or your machine - will only leave your desktop if you download and run an R package that tr

Re: [R] Submit your own R package - @examples

2018-08-08 Thread S Ellison
> Most of my methods, are not exported to the namespace using the > @examples > options. Joanna, You normally need to export _all_ the objects/functions that you expect users to be able to run. And if you are giving an example of a function, it seems likely that you expect users to use it, so it

Re: [R] loop over matrix: subscript out of bounds

2018-08-08 Thread S Ellison
> > Eric Bergeron Wed, 8 Aug 2018 12:53:32 +0300 writes: > > > You only need one "for loop" > > for(i in 2:nrow(myMatrix)) { > >myMatrix[i-1,i-1] = -1 > >myMatrix[i-1,i] = 1 > > } Or none, with matrix-based array indexing and explicit control of the indices to prevent overrun i

Re: [R] [FORGED] Adding % sign to ticks in persp()

2018-08-06 Thread S Ellison
Another possible approach, using the transformation returned by persp() to locate axes explicitly and using base graphics to place labels etc, is given at http://entrenchant.blogspot.com/2014/03/custom-tick-labels-in-r-perspective.html > -Original Message- > From: R-help [mailto:r-help-

Re: [R] Questions for Licensing

2018-08-03 Thread S Ellison
g your business. S Ellison *** This email and any attachments are confidential. Any use, copying or disclosure other than by the intended recipient is unauthorised. If you have received this message in error, please notify the

Re: [R] Combinations of true/false values where one pair is mutually exclusive

2018-08-03 Thread S Ellison
> Given that clarification, I'd just generate the full set and remove > the ones you aren't interested in, as in: I'd agree; that is probably the most efficient thing to do with only half a dozen binary variables and a single condition. A way of going about it for a more complex case might be to

Re: [R] Philip Morris International - Windows10 migration assessment

2018-08-02 Thread S Ellison
Suggest you take a look at the R website at www.r-project.org; the most important answers are evident there. If you 'require' more authoritative answers within a particular timescale, I suggest you engage an R consultant and pay for them. This is a voluntary list. S Ellison >

Re: [R] Combinations of true/false values where one pair is mutually exclusive

2018-08-02 Thread S Ellison
> On Thu, Aug 2, 2018 at 11:20 AM, R Stafford > wrote: > > But I have the extra condition that if E is true, then F must be false, and > > vice versa, Question: Does 'vice versa' mean a) "if E is False, F must be True" or b) "if F is True, E must be False"? ... which are not the same. b) (and

Re: [R] Using apply function to merge list of data frames

2018-07-27 Thread S Ellison
xpected results. S Ellison > -Original Message- > From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of Naresh > Gurbuxani > Sent: 25 July 2018 07:17 > To: R-help@r-project.org > Subject: [R] Using apply function to merge list of data frames > > I have

Re: [R] extract and re-arrange components of data frame

2018-06-12 Thread S Ellison
> #I need to get this final result > r<-data.frame(i=c(1,1,1,2,2,3), s=c(97, 98, 99, 103, 105, 118)) Nothing magic to suggest. But maybe: list.s <- strsplit(d$s,",") r <- data.frame(i=rep(d$i, times=sapply(list.s, length)), s=unlist(list.s), stringsAsF

Re: [R] internet routines cannot be loaded, R 3.5.0

2018-06-08 Thread S Ellison
", not the menu function or the package installation function "install.packages" The latter needs a list of packages to install. The former tells you what is already installed. S Ellison *** This email and

Re: [R] Change the legend order by order function

2018-05-23 Thread S Ellison
levels=c("name_b", "name_c", "name_a")) #or, for a more obviously likely example lmh <- factor(sample(c("High", "Medium", "Low"), 30, replace=T), levels=c("Low&qu

Re: [R] strange behavior of plotmath

2018-05-21 Thread S Ellison
need_ the enclosiong {}, though; > expression(NO[3]^'-'~(mg/L)) works as you intended S Ellison *** This email and any attachments are confidential. Any use...{{dropped:8}} __

Re: [R] BoxPlot Adding Mean and Median Values

2018-05-10 Thread S Ellison
ats[3,], names, pos=1) #labels just below the medians #And for placing means on the plot: RTFmeans <- with(AmbientTr, tapply(RTF, batch, mean)) points(1:length(RTFmeans), RTFmeans, pch=19) text(1:length(RTFmeans), RTFmeans, paste(round(RTFmeans,0)), pos=

Re: [R] Fill down a new column in data frame with a number

2018-05-10 Thread S Ellison
> I am traying to create a a column in my data frame filled down with a > number. > > > df$newcolumn <- number > > How can I do it? I am considering use rep() but in this case it is > necessary know the number of rows in each data base that I have and I would > like to do it in a faster ( and m

Re: [R] Bivariate Normal Distribution Plots

2018-04-12 Thread S Ellison
> -Original Message- > From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of JEFFERY > REICHMAN > # Standard deviations and correlation > sig_x <- 1 > sig_y <- 1 > rho_xy <- 0.0 > > # Covariance between X and Y > sig_xy <- rho_xy * sig_x *sig_y > > # Covariance matrix > Sig

Re: [R] convert numeric variables to factor

2018-04-10 Thread S Ellison
rn tells me that you have not constructed your data frame correctly. I can't tell you what you did wrong there. - As another poster has said, data.frame is the name of a function - one that construicts a data frame. R can often tell which you want, but it is never safe to use the na

Re: [R] Obtain gradient at multiple values for exponential decay model

2018-04-06 Thread S Ellison
he differential function from your function for y; see ?D S Ellison *** This email and any attachments are confidential. Any use...{{dropped:8}} __ R-help@r-project.org mailing list --

[R] Unable to load a package --- UnivRNG

2018-04-04 Thread Gagandeep S. Datta
Hi, I want to access the R code for UnivRNG but unable to load the files. I am new to R platform. The link is https://cran.r-project.org/web/packages/UnivRNG/ Regards, Gagandeep [[alternative HTML version deleted]] __ R-help@r-project.org

Re: [R] Shading specific region in R

2018-03-27 Thread S Ellison
> Following the given codes below, I generated a plot that has 6 regions around > a > center point (IL), with 5 regions containing > > a point (L1, L2 to L5) and sixth vacant region. I want background of all the > filled > regions turned "green", while "red" for the > > vacant region. Can it be

Re: [R] How to Find the value of r-square change in hierarchical multiple linear regression

2018-03-19 Thread S Ellison
t? See ?summary.lm For a linear model L summary(L)$r.squared gives R^2 and the adjusted R^2 is summary(L)$adj.r.squared S Ellison *** This email and any attachments are confidential. Any use...{{dropped:8}} __

Re: [R] Set Difference Problem

2018-03-19 Thread S Ellison
, "P3", "P4"}} Note the double parentheses ... this is still a set of sets with one member, not a set of character strings with four members. Hope that helps ... S Ellison > -Original Message- > From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of Neha

Re: [R] stats 'dist' euclidean distance calculation

2018-03-15 Thread S Ellison
ors constructed from allele data, you will usually get complete nonsense in genetic terms. You should probably look at something like dist.gene in the ape package: see https://www.rdocumentation.org/packages/ape/versions/5.0/

[R] Error - PMML Conversion of a Random-Forest Model using the randomForest Package

2018-03-12 Thread Karthiko S
Hi All, I am trying to convert random forest model developed into a pmml file. randomForest package was used to build the model. The input to the model is in the form of a matrix (term frequency matrix used for text analytics). While i try to convert the model into a pmml file an error pops. Err

Re: [R] alternative for multiple if_else statements

2018-02-26 Thread S Ellison
ps something that picks the minimum year for a subject or other relevant group might work? For example paste("survey", ave(year, studyno, FUN=min), sep="_") S Ellison > -Original Message- > From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of Kevin >

Re: [R] stem - strange leaves

2018-02-16 Thread S Ellison
> > From: Leif Ruckman [mailto:leif.ruck...@kau.se] > > Sent: Friday, February 16, 2018 3:27 PM > > To: PIKAL Petr > > Subject: RE: stem - strange leaves > > > > Thank you, I also found that solution but I think it is strange that > > this happens at all. I have tried different data and sometimes

[R] Tukey and extracting letters in multcomp

2018-02-13 Thread Rachel S Smith
Hi Lauren, Did you ever receive an answer on this? I’ve been having the same errors, and am stumped, so I’d love to hear how you sorted this out with your models. Thanks for your help! Cheers, Rachel -- Rachel Smith PhD Candidate Odum School of Ecology University of Georgia Athens, GA 30602

[R] SamplingStrata R package

2017-11-02 Thread Chris S
Hi all I am hoping to use the SamplingStrata R package for a dataset describing a population of businesses wherein I have information on the type of business, as well as, for designated employment number bands, number of employees and business turnover information. So ideally the stratification wi

[R] Cox Regression : Spline Coefficient Interpretation?

2017-11-01 Thread Kosta S.
Hi, I'm using a Cox-Regression to estimate hazard rates on prepayments. I'm using the "pspline" function to face non-linearity, but I have no clue how to interpret the result. Unfortunately I did not find enough information on the "pspline" function wether in the survival package nor using google

Re: [R] SamplingStrata R package

2017-10-31 Thread Chris S
nd is that people keep coming along and > sticking things into it." > -- Opus (aka Berkeley Breathed in his "Bloom County" comic strip ) > > On Tue, Oct 31, 2017 at 4:43 AM, Chris S wrote: > >> Hi all >> >> I am hoping to use the SamplingStrata R pac

[R] SamplingStrata R package

2017-10-31 Thread Chris S
Hi all I am hoping to use the SamplingStrata R package for a dataset describing a population of businesses wherein I have information on the type of business, as well as, for designated employment number bands, number of employees and business turnover information. So in this context the employmen

[R] Deletion in Binary Search Tree

2017-10-03 Thread Karthiko S
Dear All, I am unable to complete the R code for deleting nodes in a binary search tree. Have provided the code snippet below for an usecase where the node to be deleted would have a leftnode and no rightnode. I am stuck up at how to release the node pertaining to the key value given by the funct

Re: [R] Interesting behavior of lm() with small, problematic data sets

2017-09-06 Thread S Ellison
standard errors. So this particular example is apparently version-specific. S Ellison *** This email and any attachments are confidential. Any use...{{dropped:8}} __ R-help@r-project.o

Re: [R] [FORGED] Re: Block comment?

2017-09-05 Thread S Ellison
e thing. So there's probably more than one reason // was added to C. That and better editors. S Ellison *** This email and any attachments are confidential. Any use...{{dropped:8}} ___

Re: [R] Strange lazy evaluation of default arguments

2017-09-05 Thread S Ellison
Mathias, If it's any comfort, I appreciated the example; 'expected' behaviour maybe, but a very nice example for staff/student training! S Ellison > -Original Message- > From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of Matthias > Gondan > Se

Re: [R] Suggestion for installation of R

2017-08-17 Thread S Ellison
> >Is it possible to download and run R on Asus ZenFone, if yes, which > >version Try Googling 'R on Android' The top link is https://www.r-bloggers.com/install-r-in-android-via-gnuroot-no-root-required/ *** This email and any a

Re: [R] ANOVA test to decide whether to use multiple linear regression or linear mixed effects model

2017-08-15 Thread S Ellison
anova is defaulting to anova.lm, and that doesn't expect a mixed effects model. Switch them round to put model2 first: anova (model2, model1) S Ellison *** This email and any attachments are confid

Re: [R] weight in lm

2017-08-14 Thread S Ellison
that there is a difference across three types, is there a reason not to use something like Levene's test to confirm that the variances differ by more than chance? S Ellison *** This email and any attachments are con

Re: [R] problem with R. program

2017-08-11 Thread S Ellison
ify Upper limit and Lower limit, though I've not tried omitting them. S Ellison *** This email and any attachments are confidential. Any use, copying or disclosure other than by the intended recipient is unauthorised. If you have

Re: [R] Latin hypercube sampling from a non-uniform distribution

2017-08-10 Thread S Ellison
istician and explain what you are trying to achieve. They should be able to tell you either how to get there or, perhaps, why it's not sensible to start and what to do instead. Sorry I can't help further S. *** This ema

Re: [R] Latin hypercube sampling from a non-uniform distribution

2017-08-08 Thread S Ellison
> However, my variable is simulated from the cumulative distribution function > of the Poisson distribution. Then I am afraid I don't know what you're trying to achieve. Or why. However, the principle holds; write a function that maps [0,1] to the 'pattern' you want, do that and apply it to the

Re: [R] Nested for loop

2017-08-08 Thread S Ellison
ke a list of either subpopulations or sets of population parameters, lapply your simulation generator over the list and (assuming the output from each of those is a vector) use c(that.list, recursive=TRUE) to concatenate the resulting list of

Re: [R] Latin hypercube sampling from a non-uniform distribution

2017-08-07 Thread S Ellison
> How can I draw a Hypercube sample for the variable mortality_probability so > that this variable exhibits the same pattern as the observed distribution? One simple way is to use the uniform random output of randomLHS as input to the quantile function for your desired distribution(s)

Re: [R] switch of cex adjustment with mfrow?

2017-08-03 Thread S Ellison
> use > > par(mfrow=c(2,2), cex = 1) This does work as written. But when I first checked single-call setting, an mfrow change to cex in the same call superseded cex=1; hence my suggestion to use separate calls to par(). Further checking confirms that the result of a call to par is dependent on

Re: [R] switch of cex adjustment with mfrow?

2017-08-02 Thread S Ellison
Checking ?par, " In a layout with exactly two rows and columns the base value of '"cex"' is reduced by a factor of 0.83: if there are three or more of either rows or columns, the reduction factor is 0.66." You should be able to simply set cex to 1/0.83 for a 2x2 layout and by 1/0.66 for

Re: [R] metRology package

2017-07-13 Thread S Ellison
> I'm having trouble with a simple application with metRology. Well, what you probably need is to contact the maintainer of the metRology package. Fortunately that's me. An immediate problem that I have is that I don't quite understand what you're doing (in the measurement), so I may need to

[R] Hunting a histogram variant

2017-06-21 Thread S Ellison
I'm looking for a histogram variant in which data points are plotted as labelled rectangles 'piled up' to form a histogram. I've posted an example at https://www.dropbox.com/s/ozi8bhdn5kqaufm/labelled_histogram.png?dl=0 It seems to have a long pedigree, as I see it (as

[R] How to write an estimated seasonal ARIMA model from R output?

2017-06-20 Thread Y S
I'm trying to use the following command. arima (x, order = c(p,d,q), seasonal =list(order=c(P,D,Q), period=s) How can I write an estimated seasonal ARIMA model from the outputs. To be specifically, which sign to use? I know R uses a different signs from S plus. Is it correct that the mod

Re: [R] understanding I() in lmer formula

2017-06-15 Thread S Ellison
u run the product on the command line, either inside I() or not, what's the class of the result? If that is order-dependent for the object types you're combining, while I don't know why that might be it would go some way to explaining

Re: [R] Keep only those values in a row in a data frame which occur only once.

2017-06-12 Thread S Ellison
appear. > > How can I do this? Use unique() on each row and pad with NA? Example: uniq10 <- function(x, L=10) { u <- unique(x) c(u, rep(NA, L-length(u)) ) } as.data.frame( t( apply(tmp, 1, uniq10) ) ) assuming tmp is

Re: [R] organizing data in a matrix avoiding loop

2017-05-26 Thread S Ellison
atrix with the available flow data dT.m[as.matrix(dataTrade.ag[1:2]) ] <- dataTrade.ag$Flow #This relies on a default conversion from data frame factors to a character matrix, together #with R's facility for matrix indexing by 2-column matrix #Then dataTrade.ag[1:10

Re: [R] [FORGED] Logical Operators' inconsistent Behavior

2017-05-19 Thread S Ellison
very, very circumspect about presuming to know better than > SQL It's a choice. I understand and respect R's. But I can also understand why someone might have expected something different. S *** This email

Re: [R] [FORGED] Logical Operators' inconsistent Behavior

2017-05-19 Thread S Ellison
] #Which returns # # FALSE which - particularly since it appears without warning - is not an obviously sensible outcome. I am not suggesting a change to R's logical operations, which have clearly been thought through (that is evident from NA&FALSE == FALSE&NA == FALSE). But

[R] Fwd: Cannot generate a *.docx file

2017-05-14 Thread Yves S. Garret
I'm using R 3.4.0. -- Forwarded message -- From: Yves S. Garret Date: Sun, May 14, 2017 at 2:35 PM Subject: Cannot generate a *.docx file To: r-help Hello, I have the following code example: library(ReporteRs) # Create a word document to contain R outputs doc &l

[R] Cannot generate a *.docx file

2017-05-14 Thread Yves S. Garret
Hello, I have the following code example: library(ReporteRs) # Create a word document to contain R outputs doc <- docx() # Add a title to the document doc <- addTitle(doc, "Simple Word document", level = 1) # Add a paragraph of text into the Word document cat("Output 1\n") doc <- addParagraph(

Re: [R] R function stopped working

2017-04-04 Thread S Ellison
Maybe a daft question arising from lack of reproducible example, but have you run ls() manually to make sure there are objects that _exactly_ match "_Figs_" ? The simplest explanation for a loop doing nothing is that there are no cases. S Ellison > The following function is suppo

Re: [R] Plot Arrows with Angle and length - correction

2017-03-29 Thread S Ellison
radians=azimuth ) arrows(x, y, x+cos(az.rad)*size, y+sin(az.rad)*size, ...) } plot(0:6, 0:6, type="n") arrows.az(x, y, Azimuth, Length) "..." means you can pass all the other options to arrows() S Ellison > > > Thanks, > > Julio > >

Re: [R] Plot Arrows with Angle and length

2017-03-29 Thread S Ellison
<- switch(units, degrees=azimuth*pi/180, radians=azimuth ) arrows(x, y, x+cos(az.rad)*length, y+sin(az.rad)*length, ...) } plot(0:6, 0:6, type="n") arrows.az(x, y, Azimuth, Length) "..." means you can pass all the

Re: [R] argument to 'which' is not logical

2017-03-23 Thread S Ellison
recommend you avoid using common function names as variable names) If you do need to test elements for zeroes, though, note that '==' and '!=' are not usually recommended for comparisons with zero owing to finite numerical representation. So that may well be unwise. See the N

Re: [R] force axis to extend

2017-03-16 Thread S Ellison
b="") barplot(height = df$Percent[df$Sex == "Males"], add = TRUE, axes = F, col="#f8bb85", ylab="", names.arg=c("18-29", "30-44", "45-59", "60+")) axis(side=2, at = seq(-35,35,by=5), labels=format(abs(seq

[R] Works outside but not inside!

2017-02-15 Thread Keith S Weintraub
Folks, The following function works like a charm! > #Amortization for multiple rows > createAmorts<-function(ams, numPer, term) { > fctrs<-rep(1:term, each = numPer) > > oneRow<-function(am, fac){ > tdf<-data.frame(ams = c(am), yrs=fac) > agg<-aggregate(ams ~ yrs, data

[R] Extract input and filter data using extracted value.

2017-01-24 Thread Sathiaraj S P via R-help
Hi, I raised this question @ stack overflow and got below partial answer. Hope this mailing list can help on rest to complete. library(dplyr) library(tidyr) input <- "1.8 - versicolor" temp <- data.frame(input = input) %>% tidyr::separate(input, c("Petal.Width", "Species"),sep = " -

Re: [R] Match ISO 8601 week-of-year numbers to month-of-year numbers on Windows with German locale

2017-01-18 Thread S Ellison
format.Date # weekday is the (numerica) day of the week to be used to place the week # in a specific month. The default, 4, takes the Thursday. #Get the year as a character vector Y <- format(as.Date(yw, yearformat), "%Y&

[R] rstan error: C:/Rtools/mingw_64/bin/g++: not found

2016-12-02 Thread S Ellison
Apologies for posting a possibly package-specific question, but I'm not sure whether this is an R or rstan ussue. Running rstan under R 3.1.1 in windows 10 I get the well-known error "Compilation ERROR, function(s)/method(s) not created! C:/Rtools/mingw_64/bin/g++: not found"

Re: [R] Variable 'A' is not a factor Error message

2016-11-16 Thread S Ellison
ot factors. You will then get a numerical gradient for each factor instead of a single offset for each upper level. That isn't really what Placket and Burman had in mind, so I would not normally start with a P-B design if I wanted to do that. Consider a response surface model instead. S

Re: [R] Issues with the way Apply handled NA's

2016-11-16 Thread S Ellison
NA) > plabor A slightly more compact variant that avoids the intermediate 'vals' variable is to apply an anonymous function that does the check internally: plabor$colD <- apply(plabor, 1, function(x) if(all(is.na(x))) NA else prod(x, na.rm=TRUE)) S Ellison ***

  1   2   3   4   5   6   7   8   9   10   >