On Sep 5, 2010, at 8:48 AM, rajesh j wrote:
Hi,
Is it possible to convert a string vector to integer or numeric
vector? In
my situation I receive data in a string vector and have to convert
it based
on a given type.
Can you give an example? I don't understand either what sort of
conversion you desire or what you mean by "convert it based on a given
type."
There are a couple of function you may want to consider but I am
having difficulty convincing myself they answer the problem posed:
?charToRaw
?stroi
> strtoi(charToRaw("123 this is a string"), base=16) # convert to
decimal ASCII
[1] 49 50 51 32 116 104 105 115 32 105 115 32 97 32 115 116
114 105 110 103
--
David Winsemius, MD
West Hartford, CT
______________________________________________
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 provide commented, minimal, self-contained, reproducible code.