Re: [R] List of data frame

2019-10-17 Thread Jim Lemon
Hi ani, Sorry, a typo in the function - should be: makeNA(x)<-function(x,varname,value) { x[,varname][x[,varname]==value]<-NA return(x) } Jim On Fri, Oct 18, 2019 at 2:01 PM Jim Lemon wrote: > > Hi ani, > You say you want to replace with NA, so: > > # it will be easier if you don't use n

Re: [R] List of data frame

2019-10-17 Thread Jim Lemon
Hi ani, You say you want to replace with NA, so: # it will be easier if you don't use numbers for the names of the data frames names(test) <- paste0("Y",1986:2015) makeNA(x)<-function(x,varname,value) { x[,varname][x[,varname]<-value]<-NA return(x) } lapply(test,makeNA,list("RR",)) War

Re: [R] R unable to locate base unix commands (tar, sh etc)

2019-10-17 Thread Jeff Newmiller
To be clear for the OP... PATH variables on a POSIX platform are separated using the ':' character... on Windows a ';' character is used. This is a user error... your environment variables are messed up... possibly independent of R. On October 17, 2019 6:14:11 PM PDT, stephen sefick wrote: >I w

Re: [R] [FORGED] NA value in list of data frame

2019-10-17 Thread Rolf Turner
On 18/10/19 2:43 PM, ani jaya wrote: Dear R-Help, I have a list of data frame that I import from excel file using read.xlsx command. sheets <- openxlsx::getSheetNames("rainfall.xlsx") test <- lapply(sheets,function(i) read.xlsx("rainfall.xlsx", sheet=i, startRow=8, cols=1:2)) names(test) <

Re: [R] [FORGED] Re: NA value in list of data frame

2019-10-17 Thread Rolf Turner
On 18/10/19 2:58 PM, Thevaraja, Mayooran wrote: Hello You can use the following function, ## replace_missings <- function(x, replacement) { is_missings <- is.na(x) x[is_missings] <- replacement message(sum(is_missings), " miss

Re: [R] List of data frame

2019-10-17 Thread ani jaya
Thank you Mr. Bert, but my data frame is in the list, here 'test' list of data frame have 30 data frames (elements), names '1986' ~ '2015', and each data frame contain two variables, date and R. >a2<-rbind(test$`1987`) >is.na(a2$RR)<- a2$RR== Above is good enough but only for '1987'. Is it po

[R] replace_missings

2019-10-17 Thread Thevaraja, Mayooran
Hello You can use the following function, ## replace_missings <- function(x, replacement) { is_missings <- is.na(x) x[is_missings] <- replacement message(sum(is_missings), " missings replaced by the given value ", replacement)

Re: [R] NA value in list of data frame

2019-10-17 Thread Thevaraja, Mayooran
Hello You can use the following function, ## replace_missings <- function(x, replacement) { is_missings <- is.na(x) x[is_missings] <- replacement message(sum(is_missings), " missings replaced by the given value ", replacement) x }

Re: [R] List of data frame

2019-10-17 Thread Bert Gunter
I'm a little unclear, but maybe ?is.na . As in: > x <- c(1:3,) > x [1]123 > is.na(x) <- x== ## rhs is an "index vector" of logicals > x [1] 1 2 3 NA Bert Gunter "The trouble with having an open mind is that people keep coming along and sticking things into it." -- O

[R] NA value in list of data frame

2019-10-17 Thread ani jaya
Dear R-Help, I have a list of data frame that I import from excel file using read.xlsx command. sheets <- openxlsx::getSheetNames("rainfall.xlsx") test <- lapply(sheets,function(i) read.xlsx("rainfall.xlsx", sheet=i, startRow=8, cols=1:2)) names(test) <- sprintf("%i", 1986:2015) And I got a dat

[R] List of data frame

2019-10-17 Thread ani jaya
Dear R-Help, I have a list of data frame that I import from excel file using read.xlsx command. sheets <- openxlsx::getSheetNames("rainfall.xlsx") test <- lapply(sheets,function(i) read.xlsx("rainfall.xlsx", sheet=i, startRow=8, cols=1:2)) names(test) <- sprintf("%i", 1986:2015) And I got a data

Re: [R] R unable to locate base unix commands (tar, sh etc)

2019-10-17 Thread stephen sefick
I work on a Mac now. I believe .profile gets sourced first and then .bashrc. I set PATH in my .bashrc. I set a git token in .Renviron and a blank .Rprofile because I use packrat quite often. I have no problem with my environment at a shell or in Rstudio. I would start by commenting where you set t

Re: [R] R unable to locate base unix commands (tar, sh etc)

2019-10-17 Thread peter dalgaard
Semicolons in PATH on a Unix derivative like MacOS could well do that to you. It is not clear how they got there, but apparently not from your ~/.Environ file. However, multiple settings of the same PATH variable in .Environment is not something I'd think would work. Persumably the last setting

[R] Surprisingly large amount of memory used by tibble with lots of nested tibbles within

2019-10-17 Thread Jocelyn Ireson-Paine
I'm using the Tidyverse group_nest() function to nest data about families and people within households, and have found that this seems to use astonishing quantities of memory. It's more than I'd expect from the number of nested tibbles created. I'll outline what was happening with my actual data, t