Re: [R] Selecting non-empty elements after strsplit of string

2010-12-14 Thread Jinyan Huang
unlist(strsplit(output," +")) On Tue, Dec 14, 2010 at 2:09 PM, Scott Chamberlain wrote: > Hello, > > I am attempting to manipulate strings in which there are differing amounts of > whitespace before and after each element taht I want to keep (any word, > letter, or number). However, after strs

Re: [R] Selecting non-empty elements after strsplit of string

2010-12-14 Thread Ivan Calandra
Hi, I have just recently started to use regular expression, so I'm not sure that my solution would be valid in every case. But it works in yours: > unlist(strsplit(output, split=" +")) [1] "a""b""" "6" It would split them whatever the number of spaces between them is (because of t

[R] Selecting non-empty elements after strsplit of string

2010-12-14 Thread Scott Chamberlain
Hello, I am attempting to manipulate strings in which there are differing amounts of whitespace before and after each element taht I want to keep (any word, letter, or number). However, after strsplit and unlist, I know how to select specific elements with "[ ]", but I want to select instead all e

[R] Selecting non-empty elements after strsplit of string

2010-12-14 Thread Scott Chamberlain
Hello, I am attempting to manipulate strings in which there are differing amounts of whitespace before and after each element taht I want to keep (any word, letter, or number). However, after strsplit and unlist, I know how to select specific elements with "[ ]", but I want to select instead a