... and learn to use the Help system to avoid wasting space on this
list and wasting your time waiting for an answer.
?NA
(what else?!) would have immediately gotten what you were looking for.
Cheers,
Bert
On Sun, Aug 4, 2013 at 9:09 AM, William Revelle wrote:
> Bruce,
> use the is.na functi
Bruce,
use the is.na function, e.g.,
Bats.cast[is.na(Bats.cast)] <- 0
Bill
On Jul 28, 2013, at 8:12 AM, Bruce Miller wrote:
> Hi all,
>
> I am using reshape2 to reformat a data frame and all is great using:
>
> Bats.melt <- melt(data = Bats)
>
> Bats.cast <- dcast(data = Bats.melt, formul
The mechanics of replacing missing values are very easy in R
> tmp <- data.frame(a=1:4,b=c(5,6,NA,8))
> tmp
a b
1 1 5
2 2 6
3 3 NA
4 4 8
> tmp[is.na(tmp)] <- 0
> tmp
a b
1 1 5
2 2 6
3 3 0
4 4 8
>
But pay attention to Bert's warning. This is most likely the wrong
statistical way to respon
Inline.
--Bert
On Sun, Jul 28, 2013 at 6:19 AM, Neotropical bat risk assessments
wrote:
> Hi all,
>
> I am using reshape2 to reformat a data frame and all is great using:
>
> Bats.melt <- melt(data = Bats)
>
> Bats.cast <- dcast(data = Bats.melt, formula = Species ~ Location)
>
> dput(Bats.cast,
- Original Message
From: Shang Liu <[EMAIL PROTECTED]>
Subject: [R] how to replace NA values in a list
I have a matrix named "spec" (see below), it is a 6x3 matrix, and each element
of spec is a list. For example, spec[1,"wavenumber"] is a list, and it contains
1876 numeric numbers and
Hi,
to be honest, I never created a matrix of lists before, but hopefully
this code will help you?
set.seed(12345)
my.pool <- c(NA, 0:10)
n <- 25
alist <- list(sample(x=my.pool, size=n, replace=TRUE))
alist
mymatrix <- matrix(rep(alist, 6*3), nrow=6)
mymatrix2 <- lapply(X=mymatrix, FUN=funct
6 matches
Mail list logo