On 05.09.2010 14:48, 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.
?as.interger ?as.numeric
Uwe Ligges
_
great! Thanks
On Sun, Sep 5, 2010 at 9:31 PM, Joshua Wiley wrote:
> On Sun, Sep 5, 2010 at 8:36 AM, rajesh j wrote:
> > No, the examples dont cover it...if i have
> > dat <- list(INT = c("1","2","3"),
> > NUM = c("2.34","4.56","6.78"),
> > INT = c("4", "5", "6"),
> >
On Sun, Sep 5, 2010 at 8:36 AM, rajesh j wrote:
> No, the examples dont cover it...if i have
> dat <- list(INT = c("1","2","3"),
> NUM = c("2.34","4.56","6.78"),
> INT = c("4", "5", "6"),
> NUM = c("3.44"))
>
> I need to do a which on INT[0],NUM[0],INT[0] and NU
Hi,
in a way similar to names(dat), can I address a particular index of every
vector?
like [0] of all the vectors? So that I could do something like,
ints<-which(=="x")
On Sun, Sep 5, 2010 at 8:34 PM, Joshua Wiley wrote:
> Hi Rajesh,
>
> This will work, unfortunately it seems like lapply() drops
this should work great. thanks
On Sun, Sep 5, 2010 at 8:34 PM, Joshua Wiley wrote:
> Hi Rajesh,
>
> This will work, unfortunately it seems like lapply() drops the names
> before it passes each element of the list which lead to my clumsy work
> around using which(). I'm sure there are other ways
No, the examples dont cover it...if i have
dat <- list(INT = c("1","2","3"),
NUM = c("2.34","4.56","6.78"),
INT = c("4", "5", "6"),
NUM = c("3.44"))
I need to do a which on INT[0],NUM[0],INT[0] and NUM[0]...ie the [0] index
of all the vectors...
and test if they
On Sun, Sep 5, 2010 at 8:16 AM, rajesh j wrote:
> Hi,
> in a way similar to names(dat), can I address a particular index of every
> vector?
> like [0] of all the vectors? So that I could do something like,
> ints<-which(=="x")
Not sure I follow you exactly, but you can use which() with any
logica
Hi Rajesh,
This will work, unfortunately it seems like lapply() drops the names
before it passes each element of the list which lead to my clumsy work
around using which(). I'm sure there are other ways.
dat <- list(INT = c("1","2","3"),
NUM = c("2.34","4.56","6.78"),
INT
On Sep 5, 2010, at 10:47 AM, rajesh j wrote:
I'm sorry. you seem to have misunderstood my data representation for
input.
Because you did not follow the Posting Guide's advice regarding
producing examples using valid R code. You give me text; I work on text.
#-
PLEASE do read the
I'm sorry. you seem to have misunderstood my data representation for input.
Here's what I have
c<-list(INT=c("1","2","3"),NUM=c("2.34","4.56","6.78"))
I need
c<-list(INT=c(1,2,3),NUM=c(2.34,4.56,6.78))
On Sun, Sep 5, 2010 at 7:57 PM, David Winsemius wrote:
> So there is one item per line and the
So there is one item per line and the task is to recognize the strings
"INT" and "NUM" and create variables with numeric type and
INT=c(2,3,4)
NUM=c(2.37, 4.56) # ???
I worry that is not a full description of the task if there be
more than just two variable names and if all the INTs ha
The string vector actually comes as a part of a list, and the vector is
named "int", and the numbers are strings. I then have to make it a vector
that is still called "int" and has 4,5,6 etc. the types are either integer
or numeric. The number of items in the vector is unknown.
here's an example,
On Sep 5, 2010, at 9:22 AM, rajesh j wrote:
> for e.g., I get the following as a string vector
> "int" "4" "5" "6"
> after reading the first element, I have to convert this to a integer
> vector
But what is the right answer? And what number of items are possble
per line? And what are the o
for e.g., I get the following as a string vector
"int" "4" "5" "6"
after reading the first element, I have to convert this to a integer vector
On Sun, Sep 5, 2010 at 6:44 PM, David Winsemius wrote:
>
> On Sep 5, 2010, at 8:48 AM, rajesh j wrote:
>
> Hi,
>>
>> Is it possible to convert a string v
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
conve
See
?numeric
?integer
and possible the colClasses argument of
read.table
-Ista
On Sun, Sep 5, 2010 at 12:48 PM, 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
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.
--
Rajesh.J
[[alternative HTML version deleted]]
__
R-help@r-project.or
17 matches
Mail list logo