Re: [R] Help with r script

2018-09-04 Thread Jeff Newmiller
On Tue, 4 Sep 2018, Nathan D Jennings wrote: ?To the R Project: This is the R-help mailing list, populated by various people who use R including the occasional R-core developer. I am using R Studio and I need help sum product exponents with R Script. a) This is the R-help mailing list, n

Re: [R] Multi-word column names in a data frame

2018-09-04 Thread Jeff Newmiller
a) missing ggplot2 library b) cannot word wrap in the middle of a string in R without introducing newlines c) aes is not recommended for working with string variables as names... use aes_string d) Because aes_string will parse the string, you need to add the backticks e) paste0() is a shorter v

Re: [R] Multi-word column names in a data frame

2018-09-04 Thread Jim Lemon
Hi Philip, This may work: library(dplyr) `RefDate` <- as.Date(c("2010-11-1","2010-12-01","2011-01-01")) `Number of vegetables` <- c(14,23,45) `Number of people` <- c(20,30,40) MyData <- data.frame(RefDate,`Number_of_vegetables`, `Number_of_people`,check.names=FALSE) MyVars <- c("Number of vegetab

[R] Multi-word column names in a data frame

2018-09-04 Thread philipsm
I am having trouble working with column names in a data frame. My column names are multi-word text strings and I like it that way. I want to loop through the columns, plotting graphs for each one, and I want to use the column names in the chart labels and in the file names when I save the c

[R] Help with r script

2018-09-04 Thread Nathan D Jennings
 To the R Project: I am using R Studio and I need help sum product exponents with R Script.  Every time I type at the very start in the R Script window like 25* 30 nothing happens.  Where can I go to find the complete commands for basic functions in the r script window? Sincerely, Nathan Je

Re: [R] Equal Standard Error bar

2018-09-04 Thread Ogbos Okike
Hi David, You are right. Thanks for your time. The problem is certainly with the data. Plotting part of it gives different results, usually quite different from the output when the total data is used. In fact, just as you mentioned, it will look as if it is not the same code that is used to plot

Re: [R] Round down numeric values with decimals

2018-09-04 Thread Bert Gunter
Note also that if you wish to include 0 and negative numbers, and your intent is to truncate to 1 digit towards 0, then you must of course check for 0 separately and modify what I suggested for x != 0 to: k <- floor(log10(abs(x))) ifelse(x <0, ceiling(x*10^(-k)), floor(x*10^(-k))) *10^k Note that

Re: [R] Equal Standard Error bar

2018-09-04 Thread David L Carlson
Thank you for the reproducible data, but it is not the data used in the plot you attached and does not plot anything with the code you included. The ylim= argument must be modified: plot(-5:10, oomean, type="b", ylim=c(4, 12), xlab="days (epoch is the day of Fd)", ylab="strikes/day",

[R] Equal Standard Error bar

2018-09-04 Thread Ogbos Okike
Dear List, I have a dataset of high variability. I conducted epoch analysis and attempted to plot the standard error bar alongside. I am, however, surprised that the error bars are of equal length. I do not think that the variability in the data is captured, except there is a kind of averaging th

Re: [R] leave-one-out cross validation in mixed effects logistic model (lme4)

2018-09-04 Thread Bert Gunter
Please post on the r-sig-mixed-models list, where you are more likely to find the requisite expertise. However, FWIW, I think the reviewer's request is complete nonsense (naïve cross validation requires iid sampling). But the mixed models experts are the authorities on such judgments (and may tell

Re: [R] Round down numeric values with decimals

2018-09-04 Thread Bert Gunter
This is *not* "rounding down." But this should do it I think: ## (see ?floor) x <- 3.896e09 k <- floor(log10(x)) > floor(x*10^(-k))*10^k [1] 3e+09 There may be even slicker ways, but this is as slick as I can muster... Cheers, Bert Bert Gunter "The trouble with having an open mind is that

[R] leave-one-out cross validation in mixed effects logistic model (lme4)

2018-09-04 Thread Pedro Vaz
Hello, So, I have this (simplified for better understanding) binomial mixed effects model [library (lme4)] Mymodel <- glmer(cross.01 ~ stream.01 + width.m + grass.per + (1| structure.id), data = Mydata, family = binomial) stream is a factor with 2 levels; width.m is continuous; grass.per is a

Re: [R] Display time of PDF plots

2018-09-04 Thread Rich Shepard
On Mon, 3 Sep 2018, Rich Shepard wrote: Is there a process by which these plots can be 'thinned' so they show the same overall patterns but with fewer points so they display more quickly? Bert/Paul/David/John: Thanks very much for the suggestions. I think an appropriate way to illustrate th

[R] Round down numeric values with decimals

2018-09-04 Thread Nelly Reduan
Hello, How can I round down numeric values with decimals? For example, > signif(3.896037e+09, digits = 1) [1] 4e+09 The expected result is 3e+09 (and not 4e+09). > signif(8.68542378e-10, digits = 1) [1] 9e-10 The expected result is 8e-10 (and not 9e-10). Thank you very much for

Re: [R] Account for a factor variability in a logistic GLMM in lme4

2018-09-04 Thread Martin Maechler
> Jim Lemon > on Tue, 4 Sep 2018 08:36:22 +1000 writes: > Hi Pedro, > I have encountered similar situations in a number of areas. Great care > is taken to record significant events of low probability, but not the > non-occurrence of those events. Sometimes this is due