t: Friday, 18 October 2019 2:43 PM
To: r-help
Subject: [R] NA value in list of data frame
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) rea
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
>for (i in files_rwl) {
> thisfile <- get(i)
> thisfile[is.na(thisfile)] <- 0
> assign(i, thisfile)
> }
>
> It's likely that you could condense it, but using the long form makes it
> clear what's happening.
..it's work
Thanks...
Alfredo
___
Dear K. Elo,
You're right!
cimfasy_rwl=read.table(textConnection("1991 0.92 0.72 0.50
1.29 0.54 1.22
1992 2.15 1.28 1.23 2.26 1.22 3.17
1993 1.50 0.87 1.68 1.97 0.83 2.55
1994 0.69 0.00 0.76 1.89 0.60 0.87
Like this:
for (i in files_rwl) {
thisfile <- get(i)
thisfile[is.na(thisfile)] <- 0
assign(i, thisfile)
}
It's likely that you could condense it, but using the long form makes it
clear what's happening.
Sarah
--
Sarah Goslee
http://www.functionaldiversity.or
Hi,
cimfasy_rwl[ is.na(cimfasy_rwl) ] <-0
Or did I understood Your right?
HTH,
Kimmo
Alfredo Alessandrini wrote:
I'm trying to replace NA with 0 value...
I've write a loop, but don't work...
Where's the problem?
cimfasy_rwl
1991 0.92 0.72 0.50 1.29 0.54 1.22
199
> Don't use a loop for this. Do this.
I need to use a loop...
I've many data.
Alfredo
__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and p
2008 10:37 AM
> To: r-help@r-project.org
> Subject: [R] NA value
>
> I'm trying to replace NA with 0 value...
>
> I've write a loop, but don't work...
>
> Where's the problem?
>
>
> > cimfasy_rwl
> 1991 0.92 0.72 0.50
I'm trying to replace NA with 0 value...
I've write a loop, but don't work...
Where's the problem?
> cimfasy_rwl
1991 0.92 0.72 0.50 1.29 0.54 1.22
1992 2.15 1.28 1.23 2.26 1.22 3.17
1993 1.50 0.87 1.68 1.97 0.83 2.55
1994
9 matches
Mail list logo