Assuming your Tree
looks kind of like this
Tree<-list(
"Error",
"<p>Hello</p>",
"<h1>Heading</h1>",
"Error",
"<strong>Bold</strong"
)
then this should work:
Tree[Tree != "Error"]
Question
I'm having trouble "filtering" a list in R because I don't have specific parameters. The function i've created will evaluate 4000 html strings and "decide" if it is a valid or not address:
Tree<-lapply(TreeList,ValURL)
#Returns a list with "Error" or a html string in each element (about 4000 elements total).
I want to create a subset of the Tree list with only the elements that are NOT "Error".I'm used to SQL, so it would be something like:
SELECT * FROM Tree WHERE Column1!="Error"
Obviously it's different in R but I can't seem to get it. I've been trying (to no avail):
Tree$"Error"
Help!
Solution
Assuming your Tree
looks kind of like this
Tree<-list(
"Error",
"<p>Hello</p>",
"<h1>Heading</h1>",
"Error",
"<strong>Bold</strong"
)
then this should work:
Tree[Tree != "Error"]