Re: [R] Creating New Variable Using Ifelse

2017-08-09 Thread Ismail SEZEN
> On 10 Aug 2017, at 06:54, Courtney Benjamin wrote: > > Hello R Help List, > > I am an R novice and trying to use the ifelse function to create a new binary > variable based off of the responses of two other binary variables; NAs are > involved. I pulled it off almost successfully, but when

[R] Creating New Variable Using Ifelse

2017-08-09 Thread Courtney Benjamin
Hello R Help List, I am an R novice and trying to use the ifelse function to create a new binary variable based off of the responses of two other binary variables; NAs are involved. I pulled it off almost successfully, but when I checked the counts of my new variable for accuracy, I found that

Re: [R] Fill in empty spaces modified

2017-08-09 Thread William Dunlap via R-help
The following, locf2(), does what you want using only base R functions: locf2 <- function(x, initial=NA, IS_BAD = is.na) { # Replace 'bad' values in 'x' with last previous non-bad value. # If no previous non-bad value, replace with 'initial'. stopifnot(is.function(IS_BAD)) good <-

Re: [R] Fill in empty spaces modified

2017-08-09 Thread David Winsemius
> On Aug 9, 2017, at 3:39 PM, Ek Esawi wrote: > > Thank you so much Jim. I forgot to state that i was hoping to get it > without loops if possible. > > library(zoo) > is.na(eedf$nam) <- eedf$nam == "" > eedf$nam <- na.locf(eedf$nam) > eedf nam val 1 mandy 1 2 mandy 2 3 John 3 4 Jo

[R] Fill in empty spaces modified

2017-08-09 Thread Ek Esawi
Thank you so much Jim. I forgot to state that i was hoping to get it without loops if possible. Thanks again, EK [[alternative HTML version deleted]] __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mai

Re: [R] Fill in empty spaces modified

2017-08-09 Thread Jim Lemon
Hi Ek, As I may have mentioned previously, if you don't mind stepping through the data frame row by row you can do it like this: eedf<-read.table(text="nam,val mandy,1 ,2 John,3 ,4 ,5 ,6 Zara,7 ,8",sep=",",header=TRUE,stringsAsFactors=FALSE) for(row in 1:nrow(eedf)) if(eedf$nam[row] == "") eedf

Re: [R] Use case for HDF5 dataspace interface

2017-08-09 Thread Michael Sumner
Not sure about your questions but I use rhdf5 to read statistical daily bins from remote sensing ocean colour products (L3bin) https://github.com/AustralianAntarcticDivision/ocean_colour/blob/master/modis_daily_bins_init.R#L31 I'm working on database-like exploratory tools for HDF5 too, this is

Re: [R] Package nleqslv ERROR

2017-08-09 Thread J C Nash
Maybe it's simpler to point out that nonlinear EQUATIONS need n equations for n unknowns. 4 only equals 2 through the looking glass. Alternatively, maybe the OP wants to adjust the 2 parameters to best fit the 4 relationships, in which case nlsr package function nlfb() would be appropriate. No

Re: [R] Package nleqslv ERROR

2017-08-09 Thread Mark Sharp
Santi, In the second line of your function you have the following: f <- numeric(length(x)) This sets the length of this numeric vector (i.e., "f") to the length of the vector "x". Later, inside the function you assign to values to 4 elements of the vector "f". This assumes that "f" is at least

[R] Fill in empty spaces modified

2017-08-09 Thread Ek Esawi
Hi All— I was looking at a posting from June-17. I managed to solve it. However, when I changed the example in the posting, my solution will work only once at a time which was mentioned by Jim Lemon on his response to the original posting. This means that my solution will have to be repeated as m

[R] Package nleqslv ERROR

2017-08-09 Thread Santi Burone
Dear all, I am relatively new to R and have had some difficulty in understanding an error i get when running a code to solve a system of non-linear equations, with four equations and two variables. This is my code: ALPHA <- c(-0.0985168033402, 0.1, 0.15, 0.2, 0.25, 0.3, 0.35, 0.4) BETA <- c(-

Re: [R] generating cran package list matching R minor version

2017-08-09 Thread William Dunlap via R-help
I believe that https://mran.microsoft.com/packages contains daily snapshots of CRAN and you can use the 'checkpoint' package to retrieve packages as they were on any given day. Bill Dunlap TIBCO Software wdunlap tibco.com On Wed, Aug 9, 2017 at 9:38 AM, David Winsemius wrote: > > > On Aug 9, 20

Re: [R] generating cran package list matching R minor version

2017-08-09 Thread David Winsemius
> On Aug 9, 2017, at 5:38 AM, Christian Meesters wrote: > > Dear All, > > It is a common problem to update R for distributors. My challenge is to > maintain R module files for a cluster, using easybuild. > > My question is: Is there a way to derive a list of cran packages and their > version

[R] Plotting log transformed predicted values from lme

2017-08-09 Thread Alina Vodonos Zilberg
Hi, I am performing meta-regression using linear mixed-effect model with the lme() function that has two fixed effect variables;one as a log transformed variable (x) and one as factor (y) variable, and two nested random intercept terms. I want to save the predicted values from that model and sh

Re: [R] Problem with serialization via readRDS() on a textConnection()

2017-08-09 Thread Duncan Murdoch
On 09/08/2017 9:01 AM, Duncan Murdoch wrote: (Sorry for not linking to your message; I accidentally deleted the original copy of your message.) Your code > zz = textConnection('tempConnection', 'wb') > saveRDS(c("a", "b", "c"), zz, ascii = TRUE) > serialized_obj = paste(textConnectionValue(z

Re: [R] Problem with serialization via readRDS() on a textConnection()

2017-08-09 Thread Duncan Murdoch
(Sorry for not linking to your message; I accidentally deleted the original copy of your message.) Your code > zz = textConnection('tempConnection', 'wb') > saveRDS(c("a", "b", "c"), zz, ascii = TRUE) > serialized_obj = paste(textConnectionValue(zz), collapse='\n') > readRDS(textConnection(seri

[R] generating cran package list matching R minor version

2017-08-09 Thread Christian Meesters
Dear All, It is a common problem to update R for distributors. My challenge is to maintain R module files for a cluster, using easybuild. My question is: Is there a way to derive a list of cran packages and their version for a given version of R? In case addressing the R-help list is addres

Re: [R] map_data

2017-08-09 Thread Jeff Newmiller
Please keep the mailing list copied in replies. Yes, apparently the map_data function is in the ggplot2 package, not the maps package. -- Sent from my phone. Please excuse my brevity. On August 8, 2017 11:18:35 PM PDT, "Полтораднев Максим Сергеевич" wrote: >Dear Jeff, I figured out what the p