reading data

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

reading data

Ashta
Hi all,

I am using R to extract  data on a regular basis.
However, sometimes using the same script and the same data I am
getting different observation.
The library I am using and how I am reading  it is as follows.

library(stringr)
namelist <- file("Adress1.txt",encoding="ISO-8859-1")
Name <- read.fwf(namelist,
colClasses="character", skip=2,sep="\t",fill=T,
                          width =c(2,8,1,1,1,1,1,1,9,5)+1,col.names=ccol)

Can some one suggest me how track the issue?
Is it the library issue or Java issue?
May I read as free format instead of fixed format?

Thank you in advance

______________________________________________
[hidden email] mailing list -- To UNSUBSCRIBE and more, see
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: reading data

jholtman
You need to provide reproducible data.  What does the file contain?  Why
are you using 'sep=' when reading fixed format.  You might be able to
attach the '.txt' to your email to help with the problem.  Also you did not
state what the differences that you are seeing.  So help us out here.


Jim Holtman
Data Munger Guru

What is the problem that you are trying to solve?
Tell me what you want to do, not how you want to do it.

On Tue, Jun 13, 2017 at 5:09 PM, Ashta <[hidden email]> wrote:

> Hi all,
>
> I am using R to extract  data on a regular basis.
> However, sometimes using the same script and the same data I am
> getting different observation.
> The library I am using and how I am reading  it is as follows.
>
> library(stringr)
> namelist <- file("Adress1.txt",encoding="ISO-8859-1")
> Name <- read.fwf(namelist,
> colClasses="character", skip=2,sep="\t",fill=T,
>                           width =c(2,8,1,1,1,1,1,1,9,5)+1,col.names=ccol)
>
> Can some one suggest me how track the issue?
> Is it the library issue or Java issue?
> May I read as free format instead of fixed format?
>
> Thank you in advance
>
> ______________________________________________
> [hidden email] mailing list -- To UNSUBSCRIBE and more, see
> 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.
>

        [[alternative HTML version deleted]]

______________________________________________
[hidden email] mailing list -- To UNSUBSCRIBE and more, see
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: reading data

Ashta
Hi Jim,
With a little  dig on my side , I have found the issue as to why the
script is skipping that file. The file is "ISO-8859 text, with CRLF
line terminators"

The file should be ASCII and I changed using  dos2unix  and CRLF line
terminators is eliminated but still I am not reading it. How can I
read those files  with "ISO-8859 text"?







On Tue, Jun 13, 2017 at 7:20 PM, jim holtman <[hidden email]> wrote:

> You need to provide reproducible data.  What does the file contain?  Why are
> you using 'sep=' when reading fixed format.  You might be able to attach the
> '.txt' to your email to help with the problem.  Also you did not state what
> the differences that you are seeing.  So help us out here.
>
>
> Jim Holtman
> Data Munger Guru
>
> What is the problem that you are trying to solve?
> Tell me what you want to do, not how you want to do it.
>
> On Tue, Jun 13, 2017 at 5:09 PM, Ashta <[hidden email]> wrote:
>>
>> Hi all,
>>
>> I am using R to extract  data on a regular basis.
>> However, sometimes using the same script and the same data I am
>> getting different observation.
>> The library I am using and how I am reading  it is as follows.
>>
>> library(stringr)
>> namelist <- file("Adress1.txt",encoding="ISO-8859-1")
>> Name <- read.fwf(namelist,
>> colClasses="character", skip=2,sep="\t",fill=T,
>>                           width =c(2,8,1,1,1,1,1,1,9,5)+1,col.names=ccol)
>>
>> Can some one suggest me how track the issue?
>> Is it the library issue or Java issue?
>> May I read as free format instead of fixed format?
>>
>> Thank you in advance
>>
>> ______________________________________________
>> [hidden email] mailing list -- To UNSUBSCRIBE and more, see
>> 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 -- To UNSUBSCRIBE and more, see
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.