Re: [R] c() coverts real numbers to integers?
John Poulsen jpoulsen at ufl.edu writes: I know I am forgetting to do something silly. I typed coordinates in vectors (as below) but when I call them in R they come out as integers, and I want them to be real numbers. I have tried using as.numeric, as.real, etc... but they are still read by R as integers. STX-c(16.0962, 16.1227, 16.0921, 16.1498) STY-c(2.0387, 2.0214, 1.9877, 1.9846) Your should tell us what come out means. If str(STX) gives integer, then I am lost and you probably have a pre-0.01 version of R. If you see STX [1] 16 16 16 16 then somewhere in your code you have set options(digits=1). Dieter __ 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.
[R] c() coverts real numbers to integers?
Hello, I know I am forgetting to do something silly. I typed coordinates in vectors (as below) but when I call them in R they come out as integers, and I want them to be real numbers. I have tried using as.numeric, as.real, etc... but they are still read by R as integers. STX-c(16.0962, 16.1227, 16.0921, 16.1498) STY-c(2.0387, 2.0214, 1.9877, 1.9846) What am I doing wrong? Thanks for your help, John __ 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.
Re: [R] c() coverts real numbers to integers?
There are real numbers: STX-c(16.0962, 16.1227, 16.0921, 16.1498) STY-c(2.0387, 2.0214, 1.9877, 1.9846) str(STX) num [1:4] 16.1 16.1 16.1 16.1 str(STY) num [1:4] 2.04 2.02 1.99 1.98 So what is your question? On Fri, Mar 6, 2009 at 1:47 PM, John Poulsen jpoul...@zoo.ufl.edu wrote: Hello, I know I am forgetting to do something silly. I typed coordinates in vectors (as below) but when I call them in R they come out as integers, and I want them to be real numbers. I have tried using as.numeric, as.real, etc... but they are still read by R as integers. STX-c(16.0962, 16.1227, 16.0921, 16.1498) STY-c(2.0387, 2.0214, 1.9877, 1.9846) What am I doing wrong? Thanks for your help, John __ 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. -- Jim Holtman Cincinnati, OH +1 513 646 9390 What is the problem that you are trying to solve? __ 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.
Re: [R] c() coverts real numbers to integers?
STX-c(16.0962, 16.1227, 16.0921, 16.1498) STY-c(2.0387, 2.0214, 1.9877, 1.9846) STX [1] 16.0962 16.1227 16.0921 16.1498 STY [1] 2.0387 2.0214 1.9877 1.9846 Did you perhaps redefine c()? Or: options()$digits If not, then what do these say: str(STX) str(STY) On Mar 6, 2009, at 1:47 PM, John Poulsen wrote: I know I am forgetting to do something silly. I typed coordinates in vectors (as below) but when I call them in R they come out as integers, and I want them to be real numbers. I have tried using as.numeric, as.real, etc... but they are still read by R as integers. STX-c(16.0962, 16.1227, 16.0921, 16.1498) STY-c(2.0387, 2.0214, 1.9877, 1.9846) What am I doing wrong? David Winsemius, MD Heritage Laboratories 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.
[R] c() coverts real numbers to integers?
Hello, I know I am forgetting to do something silly. I typed coordinates in vectors (as below) but when I call them in R they come out as integers, and I want them to be real numbers. I have tried using as.numeric, as.real, etc... but they are still read by R as integers. STX-c(16.0962, 16.1227, 16.0921, 16.1498) STY-c(2.0387, 2.0214, 1.9877, 1.9846) What am I doing wrong? Thanks for your help, John __ 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.
Re: [R] c() coverts real numbers to integers?
Thanks! That solved it. I obviously had done something stupid. I just redefined my options(digits=7) and they are all there. Sorry for the silly question, and thanks for the suggestion towards options(). Thanks! John David Winsemius wrote: STX-c(16.0962, 16.1227, 16.0921, 16.1498) STY-c(2.0387, 2.0214, 1.9877, 1.9846) STX [1] 16.0962 16.1227 16.0921 16.1498 STY [1] 2.0387 2.0214 1.9877 1.9846 Did you perhaps redefine c()? Or: options()$digits If not, then what do these say: str(STX) str(STY) On Mar 6, 2009, at 1:47 PM, John Poulsen wrote: I know I am forgetting to do something silly. I typed coordinates in vectors (as below) but when I call them in R they come out as integers, and I want them to be real numbers. I have tried using as.numeric, as.real, etc... but they are still read by R as integers. STX-c(16.0962, 16.1227, 16.0921, 16.1498) STY-c(2.0387, 2.0214, 1.9877, 1.9846) What am I doing wrong? David Winsemius, MD Heritage Laboratories 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.