Re: [R] R encountered a fatal error. The session was terminated. + *** caught illegal operation ***

2017-10-26 Thread David Barron
I've seen similar issues reported on the RStudio community site: https://community.rstudio.com/. You might want to check in there, as I think this may well be an RStudio issue rather than a problem with R itself. Dave On 26 October 2017 at 12:11, Eric Berger wrote: >

[R] effect.clm

2016-08-16 Thread David Barron
I'm having a problem using the xlevels option with effect (or Effect) with objects of class clm, which seems to have no impact on the output (whereas it does for models of class polr). Can anyone suggest how to fix this? Thanks, David Here's an example: mod.wvs <- MASS::polr(poverty ~ gender +

Re: [R] simple question on data frames assignment

2016-04-07 Thread David Barron
ifelse is vectorised, so just use that without the loop. colordata$response <- ifelse(colordata$color == 'blue', 1, 0) David On 7 April 2016 at 12:41, Michael Artz wrote: > Hi I'm not sure how to ask this, but its a very easy question to answer for > an R person. > >

Re: [R] generate levels with different number of replications with gl() function

2016-02-10 Thread David Barron
Why not use rep instead of gl: levels <- c('BR', 'CNS', 'CO', 'LE', 'ME', 'LC', 'OV', 'PR', 'RE') reps <- c(4, 6, 7, 6, 10, 9, 7, 2, 8) rep(levels, reps) David On 10 February 2016 at 05:02, hehsham alpukhity via R-help < r-help@r-project.org> wrote: > I am trying to use the function gl

Re: [R] problem with using seq() or rep() inside a for loop

2015-07-07 Thread David Barron
You need to put the expression on the right of the colon in your for statement in parenthesis: for (i in 1:(ncol(MD_dist) - 1)){ ... } On 7 July 2015 at 19:00, Karl Schilling karl.schill...@uni-bonn.de wrote: Dear All: I want to use seq() inside a for-loop and use the looping counter i as the

Re: [R] Formatting YYYY-MM after reading text file

2015-06-26 Thread David Barron
as.yearmon(allchem$sampdate) worked for me. David On 26 June 2015 at 19:44, Rich Shepard rshep...@appl-ecosys.com wrote: Data file 'example.dat' has this format: stream,sampdate,param,quant B,1992-03,Cl,4 B,1992-03,SO4,33 B,1992-03,pH,8.43 B,1992-04,Cl,4 B,1992-04,SO4,32

Re: [R] Lavaan

2015-06-24 Thread David Barron
Does the package semPlot not do what you want? I notice that you got an error when you used library(semPlot) because you don't have all the dependencies installed. When you have semPlot working, it should be able to produce a graphical output of the results, including 'covariance arrows'. David

Re: [R] How to filter data using sets generated by flattening with dcast, when I can't store those sets in a data frame

2015-03-12 Thread David Barron
Most of this question is over my head, I'm afraid, but looking at what I think is the crux of your question, couldn't you achieve the results you want in two steps, like this: dta - data.frame(ID=c(1,1,1,1,2,2,3,3,3,3), Day=c(1,2,4,7,2,3,1,3,4,8),Pain=c(10,9,7,2,8,7,10,6,6,2)) l1 -

Re: [R] %%

2015-02-17 Thread David Barron
It's in the magrittr package. David On 17 February 2015 at 19:41, André de Boer rnie...@gmail.com wrote: Hello, Where can I find info about the operator %%? Never used it but when I search for it I gives no result. Thanks, André __

Re: [R] Regression Overdispersion?

2015-02-01 Thread David Barron
There are two straightforward ways of modelling overdispersion: 1) Use glm as in your example but specify family=quasipoisson. 2) Use glm.nb in the MASS package, which fits a negative binomial model. On 1 February 2015 at 16:26, JvanDyne e283...@trbvm.com wrote: I am trying to use Poisson

Re: [R] get latest dates for different people in a dataset

2015-01-24 Thread David Barron
Hi Richard, You could also do it using the package dplyr: dta - data.frame(Name=c('John','Mary','Sam','John'), CheckInDate=as.Date(c('1/3/2014','1/3/2014','1/4/2014','1/4/2014'), format='%d/%m/%Y'), Temp=c(97,98.1,97.5,99))

[R] stringr::str_split_fixed query

2015-01-14 Thread David Barron
I'm puzzled as to why I get this behaviour with str_split_fixed in the stringr package. stringr::str_split_fixed('ab','',2) [,1] [,2] [1,]ab stringr::str_split_fixed('ab','',3) [,1] [,2] [,3] [1,]a b In the first example, I was expecting to get [,1] [,2] [1,] a b

Re: [R] R function to convert person-level observations to person-period observations

2015-01-03 Thread David Barron
Your data are wrong. The 'event' variable (dead in your example) needs to be 1 for cases that end in an event and 0 for spells that are censored: yours is the other way around. If you change the 'dead' variable to c(1,0,1) you will get the desired result. If you really need to reverse the

Re: [R] remove outlier

2015-01-02 Thread David Barron
Your problem is that you are subsetting the dataset on line 13 of the function, but then on the following line you attempt to add predicted values from the complete data used to fit the model. You'll have to subset that as well (and the same would be true for the following line where you attempt

Re: [R] How to join data.frames with different row lengths

2014-03-24 Thread David Barron
this helps. Dave David Barron 51 Stratfield Road Oxford OX2 7BG 01865 512938 07595 090381 On 24 March 2014 18:47, Megan Weigel mw5w...@gmail.com wrote: Hello, I need to combine two data sets into one. For example: Dataset1: Code Cap04 2120 6 75 7220 17 4

Re: [R] Question on Counting Factors

2012-04-11 Thread David Barron
This would do it in your example: levels(animals$V1) - c(cat,tiger,dog,fish) table(animals) cattigerdog fish 2 200 HTH David cat tiger dog fish 2 2 0 0 On 11 April 2012 14:21, Daniel Gabrieli daniel.gabri...@gmail.com wrote:

Re: [R] NA as a result of using GLM

2009-06-15 Thread David Barron
Because you have 16 variables but only 10 observations. David On Mon, Jun 15, 2009 at 12:09, poleteiep34 poleteie...@hotmail.com wrote: Hi all! Maybe someone could help me with the following. I know this hasn't directly to do with ecology but I'm also using glm. I have a list of 16 genes

Re: [R] Random number generation

2008-07-31 Thread David Barron
guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- David Barron Said Business School Park End Street Oxford OX1 1HP 01865 288906 [[alternative HTML version deleted

Re: [R] (baseline) logistic regression + gof functions?

2008-06-06 Thread David Barron
Hi, I'm not sure why you think glm doesn't provide goodness of fit tests. Have a look at anova.glm and summary.glm. All the functions you mention can deal with multiple predictors. multinom deals with non-binary data. lrm will deal with ordinal data as well as binary. polr (in the MASS

Re: [R] Using subset in correlation analysis

2008-03-19 Thread David Barron
-guide.html and provide commented, minimal, self-contained, reproducible code. -- David Barron Said Business School Park End Street Oxford OX1 1HP 01865 288906 __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read

Re: [R] How can I extract the AIC score from a mixed model object produced using lmer?

2007-12-18 Thread David Barron
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- David Barron Said Business School Jesus College Park End Street

Re: [R] Very simple question on plot

2007-12-13 Thread David Barron
and provide commented, minimal, self-contained, reproducible code. -- David Barron Said Business School Jesus College Park End Street Oxford Oxford OX1 1HP OX1 3DW 01865 288906 01865 279684

Re: [R] Documentation for Pearson Residuals

2007-10-17 Thread David Barron
guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- David Barron Said Business School Jesus College Park End Street Oxford Oxford OX1 1HP OX1 3DW 01865 288906