l Message -
From: Benjamin Ward (ENV)
To: "r-help@r-project.org"
Cc:
Sent: Monday, January 28, 2013 9:21 PM
Subject: [R] NA and Character(0) in List Element
Hi, This is probably a small query but one I'm struggling with: I have a list
in which I had elements which were NA,
Hi, Benjamin,
have you tried for your list with NA-components to use is.na() as follows
(where x is assumed to be your list)?
x[ !is.na(x)]
Hth -- Gerrit
On Tue, 29 Jan 2013, Benjamin Ward (ENV) wrote:
Hi, This is probably a small query but one I'm struggling with: I have a
list in whi
lapply always yields one output for every input. Try using a for loop and only
copying the element once you know you want it. You will need an output index
counter that is separate from the for loop index, incremented only when you
copy an element.
---
Hi, This is probably a small query but one I'm struggling with: I have a list
in which I had elements which were NA, I removed them, by doing: list2 <-
lapply(list, na.omit),
However this leaves the element there with 'character(0)' in place as well as
attributes:
e.g.
[[978]]
character(0)
at
4 matches
Mail list logo