Re: [R] Arguments become nonnumeric

From: Mag. Ferri Leberl <ferri.leberl_at_gmx.at>
Date: Sun, 09 Dec 2007 22:36:24 +0100

Thank you, this seems promissing. How can I address then a certain element e.g. to add the second and the third component? Faithfully,
Mag. Ferri Leberl

Am Sonntag, den 09.12.2007, 07:11 -0800 schrieb jim holtman:
> You program contains:
>
> de.dd<-c("Dresden",51,2,13,44)
>
> and since you are mixing characters with numerics and putting them
> into a single vector, the data is coerced to a common data type, which
> in this case is numeric. What are you trying to do? Do you want to
> use a list?
>
> > de.dd
> [1] "Dresden" "51" "2" "13" "44"
> > de.dd<-list("Dresden",51,2,13,44)
> > de.dd
> [[1]]
> [1] "Dresden"
>
> [[2]]
> [1] 51
>
> [[3]]
> [1] 2
>
> [[4]]
> [1] 13
>
> [[5]]
> [1] 44
>
> A list will maintain the mode of each element.
>
> On Dec 9, 2007 6:14 AM, Mag. Ferri Leberl <ferri.leberl_at_gmx.at> wrote:
> > Dear Everybody,
> > Enclosed are the tiny beginning of a program and its output.
> > As a pity, if I load the image <load("kanal.RData")> the elements of
> > <de.dd> are non numerical; <de.dd[2]+de.dd[3]> returns <Fehler in
> > de.dd[2] + de.dd[3] : nicht-numerisches Argument für binären Operator>.
> > How can I keep the numbers numerical?
> > Thank you in advance.
> > hopefully,
> > Mag. Ferri Leberl
> >
> > ______________________________________________
> > R-help_at_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.
> >
> >
>
>
>



R-help_at_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. Received on Sun 09 Dec 2007 - 21:43:19 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Sun 09 Dec 2007 - 23:30:18 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.