Displaying 18 results from an estimated 18 matches for "countlines".
2012 Jun 06
3
extracting values from txt file that follow user-supplied quote
..."
One approach I took was the following:
library(R.utils)
txt_con<-file(description="D:/MCR_BeoPEST - Copy/MCR.out",open="r")
#The above will need to be altered if one desires to test code on the
attached txt file, which will run much quicker
system.time(num_lines<-countLines("D:/MCR_BeoPEST - Copy/MCR.out"))
#elapsed time on full 1Gb file took about 55 seconds on a 3.6Gh Xeon
num_lines
#14405247
system.time(
for(i in 1:num_lines){
txt_line<-readLines(txt_con,n=1)
if (length(grep(" PERCENT DISCREPANCY =",txt_line))) {
pd<-c(pd,as.n...
2017 Jul 15
2
readLines without skipNul=TRUE causes crash
...009.rar' , tf , mode
= 'wb' )
archive::archive_extract( tf , dir = normalizePath( file_folder ) )
unzipped_files <- list.files( file_folder , recursive = TRUE , full.names =
TRUE )
infile <- grep( "DADOS(.*)\\.txt$" , unzipped_files , value = TRUE )
# works
R.utils::countLines( infile )
# works with warning
my_file <- readLines( infile , skipNul = TRUE )
# crash
my_file <- readLines( infile )
# run just before crash
sessionInfo()
# R version 3.4.1 (2017-06-30)
# Platform: x86_64-w64-mingw32/x64 (64-bit)
# Running under: Windows 10 x64 (build 15063)
# Matrix pr...
2017 Jul 16
3
readLines without skipNul=TRUE causes crash
hi, thank you for attempting this. it looks like your unix machine unzipped
the txt file without corruption -- if you copied over the same txt file to
windows 7, i don't think that would reproduce the problem? i think it
needs to be the corrupted text file where R.utils::countLines( txtfile
) gives 809367. i am able to reproduce on two distinct windows machines
but no guarantee i'm not doing something dumb
On Sat, Jul 15, 2017 at 6:29 PM, Jeff Newmiller <jdnewmil at dcn.davis.ca.us>
wrote:
> I am not able to reproduce your segfault on a Windows 7 platform ei...
2017 Jul 16
0
readLines without skipNul=TRUE causes crash
...;hi, thank you for attempting this. it looks like your unix machine
>unzipped
>the txt file without corruption -- if you copied over the same txt file
>to
>windows 7, i don't think that would reproduce the problem? i think it
>needs to be the corrupted text file where R.utils::countLines(
>txtfile
>) gives 809367. i am able to reproduce on two distinct windows
>machines
>but no guarantee i'm not doing something dumb
>
>On Sat, Jul 15, 2017 at 6:29 PM, Jeff Newmiller
><jdnewmil at dcn.davis.ca.us>
>wrote:
>
>> I am not able to reproduce...
2017 Jul 15
0
readLines without skipNul=TRUE causes crash
...> archive::archive_extract( tf , dir = normalizePath( file_folder ) )
>
> unzipped_files <- list.files( file_folder , recursive = TRUE , full.names =
> TRUE )
>
> infile <- grep( "DADOS(.*)\\.txt$" , unzipped_files , value = TRUE )
>
> # works
> R.utils::countLines( infile )
>
> # works with warning
> my_file <- readLines( infile , skipNul = TRUE )
>
> # crash
> my_file <- readLines( infile )
>
>
> # run just before crash
> sessionInfo()
> # R version 3.4.1 (2017-06-30)
> # Platform: x86_64-w64-mingw32/x64 (64-bit)
&g...
2017 Jul 16
2
readLines without skipNul=TRUE causes crash
...ting this. it looks like your unix machine
> >unzipped
> >the txt file without corruption -- if you copied over the same txt file
> >to
> >windows 7, i don't think that would reproduce the problem? i think it
> >needs to be the corrupted text file where R.utils::countLines(
> >txtfile
> >) gives 809367. i am able to reproduce on two distinct windows
> >machines
> >but no guarantee i'm not doing something dumb
> >
> >On Sat, Jul 15, 2017 at 6:29 PM, Jeff Newmiller
> ><jdnewmil at dcn.davis.ca.us>
> >wrote:
&...
2009 Jan 16
5
Value Lookup from File without Slurping
Dear all,
I have a repository file (let's call it repo.txt)
that contain two columns like this:
# tag value
AAA 0.2
AAT 0.3
AAC 0.02
AAG 0.02
ATA 0.3
ATT 0.7
Given another query vector
> qr <- c("AAC", "ATT")
I would like to find the corresponding value for each query above,
yielding:
0.02
0.7
However, I want to avoid slurping whole repo.txt
2017 Jul 16
0
readLines without skipNul=TRUE causes crash
...r unix machine
>> >unzipped
>> >the txt file without corruption -- if you copied over the same txt
>file
>> >to
>> >windows 7, i don't think that would reproduce the problem? i think
>it
>> >needs to be the corrupted text file where R.utils::countLines(
>> >txtfile
>> >) gives 809367. i am able to reproduce on two distinct windows
>> >machines
>> >but no guarantee i'm not doing something dumb
>> >
>> >On Sat, Jul 15, 2017 at 6:29 PM, Jeff Newmiller
>> ><jdnewmil at dcn.davis...
2017 Jul 15
4
readLines without skipNul=TRUE causes crash
...= normalizePath( file_folder ) )
>>
>> unzipped_files <- list.files( file_folder , recursive = TRUE , full.names
>> =
>> TRUE )
>>
>> infile <- grep( "DADOS(.*)\\.txt$" , unzipped_files , value = TRUE )
>>
>> # works
>> R.utils::countLines( infile )
>>
>> # works with warning
>> my_file <- readLines( infile , skipNul = TRUE )
>>
>> # crash
>> my_file <- readLines( infile )
>>
>>
>> # run just before crash
>> sessionInfo()
>> # R version 3.4.1 (2017-06-30)
>>...
2017 Jul 17
1
readLines without skipNul=TRUE causes crash
...zipped
> >> >the txt file without corruption -- if you copied over the same txt
> >file
> >> >to
> >> >windows 7, i don't think that would reproduce the problem? i think
> >it
> >> >needs to be the corrupted text file where R.utils::countLines(
> >> >txtfile
> >> >) gives 809367. i am able to reproduce on two distinct windows
> >> >machines
> >> >but no guarantee i'm not doing something dumb
> >> >
> >> >On Sat, Jul 15, 2017 at 6:29 PM, Jeff Newmiller
> >...
2017 Jul 15
3
readLines without skipNul=TRUE causes crash
...ped_files <- list.files( file_folder , recursive = TRUE ,
>>>> full.names =
>>>> TRUE )
>>>>
>>>> infile <- grep( "DADOS(.*)\\.txt$" , unzipped_files , value = TRUE )
>>>>
>>>> # works
>>>> R.utils::countLines( infile )
>>>>
>>>> # works with warning
>>>> my_file <- readLines( infile , skipNul = TRUE )
>>>>
>>>> # crash
>>>> my_file <- readLines( infile )
>>>>
>>>>
>>>> # run just before cras...
2017 Jul 15
0
readLines without skipNul=TRUE causes crash
...le_folder , recursive = TRUE ,
>>>>> full.names =
>>>>> TRUE )
>>>>>
>>>>> infile <- grep( "DADOS(.*)\\.txt$" , unzipped_files , value = TRUE )
>>>>>
>>>>> # works
>>>>> R.utils::countLines( infile )
>>>>>
>>>>> # works with warning
>>>>> my_file <- readLines( infile , skipNul = TRUE )
>>>>>
>>>>> # crash
>>>>> my_file <- readLines( infile )
>>>>>
>>>>>
>...
2017 Jul 15
0
readLines without skipNul=TRUE causes crash
...;>>
>>> unzipped_files <- list.files( file_folder , recursive = TRUE ,
>>> full.names =
>>> TRUE )
>>>
>>> infile <- grep( "DADOS(.*)\\.txt$" , unzipped_files , value = TRUE )
>>>
>>> # works
>>> R.utils::countLines( infile )
>>>
>>> # works with warning
>>> my_file <- readLines( infile , skipNul = TRUE )
>>>
>>> # crash
>>> my_file <- readLines( infile )
>>>
>>>
>>> # run just before crash
>>> sessionInfo()
>>...
2012 May 16
0
Problem to resolve a step for reading a large TXT and, split in several file
...er.of.lines.in.file %% n
for(i in seq.int(passes)){
[ ... read n lines at a time & process them...]
}
if(remaining){
n <- remaining
[ ...read what's left... ]
}
If you do not know how many lines are there in the file, see
(package::function)
parser::nlines
R.utils::countLines
Hope this helps,
Rui Barradas
Em 16-05-2012 11:00, r-help-request at r-project.org escreveu:
> Date: Tue, 15 May 2012 22:16:42 +0200
> From: gianni lavaredo<gianni.lavaredo at gmail.com>
> To:r-help at r-project.org
> Subject: [R] Problem to resolve a step for reading a large...
2012 Feb 13
4
Reading in csv with footer
Hi,
I have a CSV file that is formatted well, except that the last line is a "summary" not is CSV format.
Toy example:
label_1, label_2, label_3
1,2,3
3,2,4
2,3,4
Total Rows: 3
When I try to import this into R with: d <- read.table("foo.csv", header=T, sep=",")
It fails to import properly because of the last line.
Currently, I have a shell script that strips
2017 Jul 15
2
readLines without skipNul=TRUE causes crash
...UE ,
>>>>>> full.names =
>>>>>> TRUE )
>>>>>>
>>>>>> infile <- grep( "DADOS(.*)\\.txt$" , unzipped_files , value = TRUE )
>>>>>>
>>>>>> # works
>>>>>> R.utils::countLines( infile )
>>>>>>
>>>>>> # works with warning
>>>>>> my_file <- readLines( infile , skipNul = TRUE )
>>>>>>
>>>>>> # crash
>>>>>> my_file <- readLines( infile )
>>>>>>...
2004 Dec 06
6
how to get how many lines there are in a file.
hi all
If I wanna get the total number of lines in a big file without reading
the file's content into R as matrix or data frame, any methods or
functions?
thanks in advance.
Regards
2017 Jul 17
0
readLines without skipNul=TRUE causes crash
...;> full.names =
>>>>>>> TRUE )
>>>>>>>
>>>>>>> infile <- grep( "DADOS(.*)\\.txt$" , unzipped_files , value = TRUE )
>>>>>>>
>>>>>>> # works
>>>>>>> R.utils::countLines( infile )
>>>>>>>
>>>>>>> # works with warning
>>>>>>> my_file <- readLines( infile , skipNul = TRUE )
>>>>>>>
>>>>>>> # crash
>>>>>>> my_file <- readLines( infile )
&...