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
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
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
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) <
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
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
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)
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
}
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
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
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
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
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
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
14 matches
Mail list logo