large numbers

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

large numbers

Veerappa Chetty
Hi,
When I import an excel "CSV" file, large numbers such as " 43988014.3" is
imported as "43988014", leaving out the decimal ".4". How to import keeping
the fraction?
Thanks.
Chetty

--
Professor of Family Medicine
Boston University
Tel: 617-414-6221, Fax:617-414-3345
emails: [hidden email],[hidden email]

        [[alternative HTML version deleted]]

______________________________________________
[hidden email] 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.
Reply | Threaded
Open this post in threaded view
|

Re: large numbers

Michael Weylandt
Are you sure its being imported into R without the decimal and that
it's not just a print option? I can't off the cuff think of a reason
why that would happen...

Try print(valueFromImport - 43988014) and see what you get

Michael

On Wed, Oct 12, 2011 at 3:16 PM, Veerappa Chetty <[hidden email]> wrote:

> Hi,
> When I import an excel "CSV" file, large numbers such as " 43988014.3" is
> imported as "43988014", leaving out the decimal ".4". How to import keeping
> the fraction?
> Thanks.
> Chetty
>
> --
> Professor of Family Medicine
> Boston University
> Tel: 617-414-6221, Fax:617-414-3345
> emails: [hidden email],[hidden email]
>
>        [[alternative HTML version deleted]]
>
> ______________________________________________
> [hidden email] 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.
>

______________________________________________
[hidden email] 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.
Reply | Threaded
Open this post in threaded view
|

Re: large numbers

Michael Weylandt
Well that's different. Can you restart R and get the same error
message? If so, change print() to print.default() to get around the
class error for now.

And I just want to make sure of one thing: you did actually change
"valueFromImport" to whatever you named the output of the read.csv()
call, right? I don't know why what would have lead to the error you
got, but one never knows...

If none of the above works, please reply with the result of dput() on
your data and the results of sessionInfo()

Michael

PS -- It's good practice to cc the list as well.

On Wed, Oct 12, 2011 at 3:33 PM, Veerappa Chetty <[hidden email]> wrote:

> Thanks.
> I get this:
> print(valueFromImport - 43988014)
> Error in print(valueFromImport - 43988014) :
>   error in evaluating the argument 'x' in selecting a method for function
> 'print'
>
>
>
>
>
> On Wed, Oct 12, 2011 at 3:20 PM, R. Michael Weylandt
> <[hidden email]> wrote:
>>
>> Are you sure its being imported into R without the decimal and that
>> it's not just a print option? I can't off the cuff think of a reason
>> why that would happen...
>>
>> Try print(valueFromImport - 43988014) and see what you get
>>
>> Michael
>>
>> On Wed, Oct 12, 2011 at 3:16 PM, Veerappa Chetty <[hidden email]>
>> wrote:
>> > Hi,
>> > When I import an excel "CSV" file, large numbers such as " 43988014.3"
>> > is
>> > imported as "43988014", leaving out the decimal ".4". How to import
>> > keeping
>> > the fraction?
>> > Thanks.
>> > Chetty
>> >
>> > --
>> > Professor of Family Medicine
>> > Boston University
>> > Tel: 617-414-6221, Fax:617-414-3345
>> > emails: [hidden email],[hidden email]
>> >
>> >        [[alternative HTML version deleted]]
>> >
>> > ______________________________________________
>> > [hidden email] 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.
>> >
>
>
>
> --
> Professor of Family Medicine
> Boston University
> Tel: 617-414-6221, Fax:617-414-3345
> emails: [hidden email],[hidden email]
>

______________________________________________
[hidden email] 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.
Reply | Threaded
Open this post in threaded view
|

Re: large numbers

David Winsemius
In reply to this post by Veerappa Chetty

On Oct 12, 2011, at 3:16 PM, Veerappa Chetty wrote:

> Hi,
> When I import an excel "CSV" file, large numbers such as "  
> 43988014.3" is
> imported as "43988014", leaving out the decimal ".4". How to import  
> keeping
> the fraction?

"Import from Excel" is a vague problem statement. It's also kind of  
odd that you have a leading space iside the quotes in the example.  
Makes me wonder if you got numbers somehow "factorized" because of non-
numeric entries in the "csv" file. Why not show the code used to do it  
_and_  str() on the object? Or even better dput from a row with a  
"large number"?

>


--

David Winsemius, MD
West Hartford, CT

______________________________________________
[hidden email] 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.