Re: [R] bzip2

2016-10-31 Thread David Winsemius
> On Oct 31, 2016, at 5:29 PM, Nordlund, Dan (DSHS/RDA) > wrote: > > I don't know what version Linux or other OS you are using, but have you > installed the bzip2 development package? It would be named something like > libbz2-dev (that is what it is in Ubuntu, I believe). This question has

[R] Resetting Baseline Level of Predictor in svyglm Function

2016-10-31 Thread Courtney Benjamin
Hello R Users: I am using the survey package in R for modeling with complex survey data. I am trying to reset the baseline level of certain predictor variables being used in a logistic regression without success. The following is a reproducible example: library(RCurl) library(survey) data <-

Re: [R] bzip2

2016-10-31 Thread Nordlund, Dan (DSHS/RDA)
I don't know what version Linux or other OS you are using, but have you installed the bzip2 development package? It would be named something like libbz2-dev (that is what it is in Ubuntu, I believe). Dan Daniel Nordlund, PhD Research and Data Analysis Division Services & Enterprise Support Adm

Re: [R] function ave() with seq_along returning char sequence instead of numeric

2016-10-31 Thread Nordlund, Dan (DSHS/RDA)
Jeff, Thanks for the response. You are right of course. I went back and reread the help page. I guess I just glossed over the 'x is numeric' statement because the default FUN was the mean, and seq_along doesn't care about type. I should know better than to disregard what I read in the help p

[R] bzip2

2016-10-31 Thread Josef Eschgfaeller
I am not able to compile R 3.3, configure halting with: -- checking for BZ2_bzlibVersion in -lbz2... yes checking bzlib.h usability... yes checking bzlib.h presence... yes checking for bzlib.h... yes checking if bzip2 version >= 1.0.6... no checking w

[R] store result of meta analysis by Rstudio

2016-10-31 Thread Elham Dallalbashi
hi everyone, how can I store result of meta analysis by Rstudio,I can not save the result of metaseq and metaDE package,I want to use sink to store the output in a file. in metaseq package there are several objects to store:(I copy example of this package) > head(F$Upper) 1/2-SBSRNA4 A1BG A1BG-AS

Re: [R] function ave() with seq_along returning char sequence instead of numeric

2016-10-31 Thread Jeff Newmiller
The help page describes the first argument x as a numeric... it is not designed to accept character, so the fact that you get anything even close to right is just a bonus. As the doctor says, "if it hurts, don't do that". ave( rep( 1, length( v ), v, FUN=seq_along ) -- Sent from my phone. Plea

[R] function ave() with seq_along returning char sequence instead of numeric

2016-10-31 Thread Nordlund, Dan (DSHS/RDA)
Given the following R statements v <- c('a', 'a', 'a', 'b', 'b', 'b', 'c', 'c', 'c', 'c') ave(v, list(v), FUN=seq_along) [1] "1" "2" "3" "1" "2" "3" "1" "2" "3" "4" I was expecting to get a numeric vector back. I apparently have missed something in the documentation. If vector v is charact

Re: [R] Permutations in matched-pair study where combinations of pairs change

2016-10-31 Thread Bert Gunter
You may get a reply here, but this post belongs on a statistics list like stats.stackexchange.com, not r-help, which is concerned about R programming issues rather than statistical methodology. Cheers, Bert Bert Gunter "The trouble with having an open mind is that people keep coming along and s

Re: [R] Installing polycor package

2016-10-31 Thread Kevelson, Marisol J
Thank you. I understand that it's best to use the current versions of R packages. Neither the current version of polycor nor the current version of mvtnorm would install when I used the most recent version of R, 3.3.1: > install.packages("polycor", repos="http://R-Forge.R-project.org";) Warning

Re: [R] Installing polycor package

2016-10-31 Thread Jeff Newmiller
"any advice" is to use the latest R and packages. Unfortunately the number of things that can go wrong trying to keep an old version of R working is too extensive for this list to support (per Posting Guide). If you wish to proceed without support then by all means download any older versions o

Re: [R] Simple loop problem

2016-10-31 Thread William Dunlap via R-help
Did you mean 'tolower' instead of 'to lower' in your example? Or is there a similarly named function that converts the levels of a factor to lower case instead of converting the factor to a character vector and then lower-casing that? > d %>% dplyr::mutate_if(is.factor, tolower) NumF1 F2 1

Re: [R] Simple loop problem

2016-10-31 Thread William Dunlap via R-help
Use tolower on the levels of the factor columns. E.g., > d <- data.frame(Num=1:3, F1=c("One","Two","Three"), F2=c("A","B","a")) > str(d) 'data.frame': 3 obs. of 3 variables: $ Num: int 1 2 3 $ F1 : Factor w/ 3 levels "One","Three",..: 1 3 2 $ F2 : Factor w/ 3 levels "a","A","B": 2 3 1 > fo

Re: [R] Simple loop problem

2016-10-31 Thread David L Carlson
This looks like homework and r-help has a policy of not providing answers for homework. But first you need to research what happens when you convert a data frame to a matrix. Also in your loop, i is a numeric value between 1 and the length of x: What is x (what class)? What is the length of an

[R] Installing polycor package

2016-10-31 Thread Kevelson, Marisol J
I have been trying to install the R polycor package without any success. I want to install version 0.7-8 because it is supposed to work with R version 3.1.0, which I have to use to run an R plug-in for SPSS. But I get a message that polycor is not available for R version 3.1.0: > install.packa

[R] Permutations in matched-pair study where combinations of pairs change

2016-10-31 Thread Luke Gaylor
Friends, Matched pairs studies are well documented, but what happens if we were to alter the manner in which events were paired to one another. Say we change the order of our data and pair without replacement, so that event 1 may pair with event 23 in one instance, but also event 36 or 102 in

[R] Simple loop problem

2016-10-31 Thread Yahya Laraki
Hi everybody, I’m new to R and i’m trying to learn fundamentals. I’m facing a small problem for which i can’t find a solution online. What i want to do: write a function to lower case for all the columns in my data.frame if they respect a condition (class = factor) This code works, but for all

Re: [R] The equivalent of which() when accessing slots in an object

2016-10-31 Thread Bob Rudis
Aye, Bill. I figured others wld include a `vapply()` example (didn't want to "hog" the answer :-). I went with bland `sapply()` as an alternative since I made an assumption Thomas (like the large % of R users I've come in contact with - albeit a biased sample) aren't really familiar with `vapply()

Re: [R] The equivalent of which() when accessing slots in an object

2016-10-31 Thread William Dunlap via R-help
vapply(buylist, slot, "reqstock", FUN.VALUE=0.0) is closer in spirit than sapply() to purrr::map_dbl() - FUN.VALUE gives the expected type and size of f's output. vapply() is usually quicker than sapply(), uses less memory, gives the right results when given a vector of length 0, and gives an erro

Re: [R] The equivalent of which() when accessing slots in an object

2016-10-31 Thread Bert Gunter
But if all the OP want is a count, wouldn't sum(sapply(buylist, slot, "reqstock") > 100) suffice? -- Bert Bert Gunter "The trouble with having an open mind is that people keep coming along and sticking things into it." -- Opus (aka Berkeley Breathed in his "Bloom County" comic strip ) On Mon

Re: [R] The equivalent of which() when accessing slots in an object

2016-10-31 Thread Bob Rudis
which(purrr::map_dbl(buylist, slot, "reqstock") > 100) or which(sapply(buylist, slot, "reqstock") > 100) ought to do the trick. On Mon, Oct 31, 2016 at 10:09 AM, Thomas Chesney wrote: > I have the following object > > setClass("buyer", > representation( > reqstock="numeric", > buyout="

[R] The equivalent of which() when accessing slots in an object

2016-10-31 Thread Thomas Chesney
I have the following object setClass("buyer", representation( reqstock="numeric", buyout="numeric"), ) nBuy <- 5 #Set buyer parameters here buylist <- list() for (i in 1:nBuy){ buylist[[i]] <- new("buyer") buylist[[i]]@reqstock <- sample(c(50:200),1) } and want to count the number of objects in

Re: [R] How to copy and paste a row at the end of each group of a table?

2016-10-31 Thread PIKAL Petr
Hi Another approach is to use function like following fff<-function(x, ...) { temp <- x[which(x[,"day"]==1),] temp$day <- 361 x <- rbind(x, temp) x[order(x$site, x$day),] } fff(dat) Cheers Petr > -Original Message- > From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of jim >

Re: [R] How to copy and paste a row at the end of each group of a table?

2016-10-31 Thread jim holtman
try this: > dat<-structure(list(site = c(1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2), day = c(1, 31, 61, 91, 121, + 151, 181, 211, 241, 271, 301, 331, 1, 31, 61, 91, 121, 151, 181, + 211, 241, 271, 301, 331), temp = c(8.3, 10.3, 9.4, 6.1, 3, 1.3, + 1, 0.8, 1, 1.4, 2.7

[R] R 3.3.2 is released

2016-10-31 Thread Peter Dalgaard
The build system rolled up R-3.3.2.tar.gz (codename "Sincere Pumpkin Patch") this morning. The list below details the changes in this release. You can get the source code from http://cran.r-project.org/src/base/R-3/R-3.3.2.tar.gz or wait for it to be mirrored at a CRAN site nearer to you. Bin

[R] Predicition and CI for lognormal model

2016-10-31 Thread Chien-Pang Chin
Hi, everyone I have a model like. cpue=catch*1000/Hook glmmodel=glm(log(cpue)~yy+qq+cc+pp, family=gaussian) and I want to estimate yy, qq, cc, pp effect and CI A senior scientist suggested to use model <- cbind(yhat=predict.glm(glmmodel, se.fit=T), DATA

Re: [R] Error Message when executing wordcloud(bd_clean)

2016-10-31 Thread Jeff Newmiller
A) Please post in plain text so your code doesn't get mangled by HTML. B) Please provide a reproducible example. [1] [2] C) RStudio is probably not the problem, but if it is then this is the wrong place to ask about that (see the RStudio website for help with that software). Simply try your cod