search for: nline

Displaying 20 results from an estimated 314 matches for "nline".

Did you mean: inline
2003 Nov 05
1
read.table leaves out data when reading multiple-line records (PR#4955)
..."\"c\",\"d\"" "\"e" [4] "newline\",\"\\\"quoted simpleline\\\"\"" > > # double pushback is fine > pushBack(c(lines,lines), fc) > > # but nlines tells us we had 4 lines, which in fact are only 3 > nlines <- length(lines) > nlines [1] 4 > > # and the first scan eats up more than the first pushback > scan(fc, what="string", sep=",", nlines=nlines) Read 8 items [1] "a" &quot...
2010 Jul 29
1
[PATCH] Reflow logic to make it easier to follow
...*/ - if (!(action_flags & USE_OVERLAY)) { - ppix = NVGetDrawablePixmap(pDraw); + if (action_flags & USE_OVERLAY) { + if (pNv->Architecture == NV_ARCH_04) { + NV04PutOverlayImage(pScrn, pPriv->video_mem, offset, + id, dstPitch, &dstBox, 0, 0, + xb, yb, npixels, nlines, + src_w, src_h, drw_w, drw_h, + clipBoxes); + } else { + NV10PutOverlayImage(pScrn, pPriv->video_mem, offset, + uv_offset, id, dstPitch, &dstBox, + 0, 0, xb, yb, + npixels, nlines, src_w, src_h, + drw_w, drw_h, clipBoxes); + } + + pPriv-...
2008 Nov 18
1
"deparse" with "nlines" argument produces empty elements (PR#13299)
Full_Name: Kamil Barto? Version: 2.8.0 OS: windows xp Submission from: (NULL) (212.33.92.187) According to the "deparse" function documentation "nlines" is the *maximum* number of lines to produce. But, when "nlines" argument is supplied, it produces exactly nlines of result, and the result contains empty elements at the end. Example: > deparse(quote(foo(1,2,3)), width.cutoff = 20, nlines=7) [1] "foo(1, 2, 3)" "...
2001 Dec 29
1
Slow 'read.table' in R 1.4.0 (PR#1232)
...hat it was rewritten in R 1.4.0. I think I found out what part of the problem might be. I was comparing R1.3.1 and R1.4.0 code and it appears that a statement is missing in some of the code for R 1.4. This is the section of code at the beginning of read.table. The loop starting with 'while (nlines < 5)' will read in the entire file, because there is no increment of 'nlines' in the loop. I traced through the code and this is what was happening. It then does a 'pushBack' of the entire file. In tracing through the code, this is where is appears to be taking the time....
2002 Feb 22
1
Summary: read.table on Mac OS X, CARBON vs. DARWIN
Thanks a lot, James!! The problem is fixed. On the version 1.4.0 Mac/darwin (the latest available version for this system) the function read.table (which is called from read.delim etc., too) has the bug you explained. Inserting the row nlines <- nlines+1 after lines <- c(lines, line) removes this bug. M. On Friday, February 22, 2002, at 02:33 PM, james.holtman at convergys.com wrote: > > If you can not the the latest 1.4.1, here is a patch (adds one line to > read.table) that will fix it on your current system. &g...
2004 Dec 23
2
Get rid of space padding
...atrix <- function (x, file = "", sep = "\t", blocksize=2000) { x <- as.matrix(x) p <- ncol(x) cn <- colnames(x) if (!missing(blocksize) && blocksize > 0) { cat(cn, file = file, sep = c(rep(sep, p - 1), "\n")) nlines <- 0 nr <- nrow(x) while (nlines < nr) { nb <- min(blocksize, nr - nlines) cat(format(t(x[nlines + (1:nb), ])), file = file, append = TRUE, sep = c(rep(sep, p - 1), "\n")) nlines <- nlines + nb...
2007 May 15
1
Efficiently reading random lines form a large file
...wo different random lines at a time from a large ASCII file (120 x 296976) containing space delimited 0-1 entries. The following code does the job and it's reasonable fast for my needs: lineNumber = sample(120, 2) line1 = scan(filename, what = "integer", skip=lineNumber[1]-1, nlines=1) line2 = scan(filename, what = "integer", skip=lineNumber[2]-1, nlines=1) > system.time(for (i in 50){ + lineNumber = sample(120, 2) + line1 = scan(filename, what = "integer", skip=lineNumber[1]-1, nlines=1) + line2 = scan(filename, what = "integer", s...
2003 Nov 10
3
Reading an upper triangular matrix
...data file is delimited by white space. (Part of) script to read: myfile <- file("Paises.dat", open="r") # opens a connection which stays open until closed by close(myfile) name <- readLines(con=myfile, n=1) varnames <- scan( myfile, what=character(0), nlines=1 ) stopifnot( length(varnames) == 21 ) Paises <- matrix(0, 21, 21) colnames(Paises) <- varnames rownames(Paises) <- varnames for (i in 1:21) { temp <- scan(myfile, what=list("a", rep(0,22-i) ), nlines=1, sep="") Paises[i, i:21] <- temp[[2]] } I get...
2007 Aug 29
4
How to signal the end of the table?
...cord){ current.row=scan(file=fp, sep=',', what=list(count=1, cusip6="", idate=1, spread=1.1, vol252=1.1, vol1000=1.1, st_debt=1.1, lt_debt=1.1 , total_liab= 1.1, cr=1.1, shrout=1.1, prc=1.1, mkt_cap=1.1, rtng=1.1, sec=1.1, cr3m=1.1, cr5y=1.1, ust3m=1.1, ust5y=1.1), flush=TRUE, nlines=1,quiet=T) ... } I need to know the number of records in the table and put it in the variable named "number.of.records". When I have a new table that I do not know how many records it has, I use excel to open the file to figure it out and put it in variable " number.of.records&...
2007 Dec 19
1
unexpected behavior from gzfile and unz
...readLines(file, 1) : seek not enabled for this connection > close(file) However, if I instead use "scan" to read the file, then there are no errors and I get the rewind/no rewind behavior described above. > file <- unz("file.zip", "file.txt") > scan(file,nlines=1,sep="\t",what=character(0)) Read 3 items [1] "a" "b" "c" > scan(file,nlines=1,sep="\t",what=character(0)) Read 3 items [1] "a" "b" "c" > close(file) > file <- unz("file.zip", "file.txt&qu...
2009 Nov 10
3
Error: cannot allocate vector of size...
I'm trying to import a table into R the file is about 700MB. Here's my first try: > DD<-read.table("01uklicsam-20070301.dat",header=TRUE) Error: cannot allocate vector of size 15.6 Mb In addition: Warning messages: 1: In scan(file, what, nmax, sep, dec, quote, skip, nlines, na.strings, : Reached total allocation of 1535Mb: see help(memory.size) 2: In scan(file, what, nmax, sep, dec, quote, skip, nlines, na.strings, : Reached total allocation of 1535Mb: see help(memory.size) 3: In scan(file, what, nmax, sep, dec, quote, skip, nlines, na.strings, : Reached to...
2011 May 15
2
Unexpected behaviour as.data.frame
I use the following code to create two data.frames d1 and d2 from a list: types <- c("integer", "character", "double") nlines <- 10 d1 <- as.data.frame(lapply(types, do.call, list(nlines)), stringsAsFactor=FALSE) l2 <- lapply(types, do.call, list(nlines)) d2 <- as.data.frame(l2, stringsAsFactors=FALSE) I would expect d1 and d2 to be the same, however, in d1 the second column is a factor while...
2006 Apr 11
1
pattern in history
...uot;, ...) { file1 <- tempfile("Rrawhist") savehistory(file1) rawhist <- scan(file1, what = "", quiet = TRUE, sep = "\n") rawhist <- rawhist[grep(pattern, rawhist, ...)] #** if(unique) rawhist <- unique(rawhist) #** unlink(file1) nlines <- length(rawhist) inds <- max(1, nlines - max.show):nlines if (reverse) inds <- rev(inds) file2 <- tempfile("hist") write(rawhist[inds], file2) file.show(file2, title = "R History", delete.file = TRUE) } -- visit the R Graph Galle...
2007 Apr 16
1
Dataimport with readLines using skip= and nlines= ?
...es", because the measurments have letters and numbers (e.g. S=0.00012) witch have to be filtered for using a matrix (scan make errors). -The second problem is, that the number of measurments is variable. My idea. I have the position (skip=r2) of the beginning of the measurments, the length (nlines=r1) and the number of all measurments (for (i in i:r3)). My problem and question. I need a command to read my measurments. The readLine command has no possibility to skip lines. And the read.file command can't filter my data.dat for (S= , S=, x=, y=). I hope you have an idea. Thank's for...
2010 Jan 30
2
drawing a line that shifts from solid to broken
I am graphing longitudinal data from three time points. I'd like to draw a solid line from point 1 to point 2, and then a dashed line from point 2 to point 3. It works if I do it in two steps: > first.vector <- c(mean(year1$variable1), mean(year2$variable1)) > second.vector <- c(NA, mean(year2$variable1), mean(year3$variable1)) > plot(first.vector, type="b",
2008 Sep 19
4
Novice question about getting data into R
...ound it easy to use R when typing data manually into it. Now I need to read data from a file, and I get the following errors: > refdata = > read.table("K:\\MerchantData\\RiskModel\\refund_distribution.csv", header > = TRUE) Error in scan(file, what, nmax, sep, dec, quote, skip, nlines, na.strings, : line 1 did not have 42 elements > refdata = > read.table("K:\\MerchantData\\RiskModel\\refund_distribution.csv") Error in scan(file, what, nmax, sep, dec, quote, skip, nlines, na.strings, : line 2 did not have 42 elements > (I'd tried the first versio...
2016 Nov 10
2
Memory leak with tons of closed connections
...the parent daemon via stdin and stdout. Everything works perfectly fine except for having some memory leaks somewhere. Simplified version of the R app: while (TRUE) { con <- file('stdin', open = 'r', blocking = TRUE) line <- scan(con, what = character(0), nlines = 1, quiet = TRUE) close(con) } This loop uses more and more RAM as time passes (see more on this below), not sure why, and I have no idea currently on how to debug this further. Can someone please try to reproduce it and give me some hints on what is the problem? Sample bash script...
2008 Jul 30
2
problem with read.table()
...s <- c(rep("factor", 63), rep("numeric",7), rep ("of", 12)) Table<-read.table("Table.txt",header=TRUE,row.names=1, na.strings="NA" ,colClasses = Classe82) I get this error-message: Fehler in scan(file, what, nmax, sep, dec, quote, skip, nlines, na.strings, : scan() erwartete 'a real', bekam '8,5' Error in scan(file, what, nmax, sep, dec, quote, skip, nlines, na.strings, : scan() expected 'a real', got '8,5' It seems that the error is in the colClasses-argument. Without this argument it reads...
2008 Sep 04
1
read.table error
...and 259201 rows (including the column headers). I've been using the following commands, but receive an error each time which prevents the data from being read in: > Jan <- read.table("JanuaryAvBurntArea.txt", header=TRUE) Error in scan(file, what, nmax, sep, dec, quote, skip, nlines, na.strings, : line 1 did not have 6 elements I tried removing the 'header' argument, but receive a similar message: > Jan <- read.table("JanuaryAvBurntArea.txt") Error in scan(file, what, nmax, sep, dec, quote, skip, nlines, na.strings, : line 2 did not have 6 e...
2013 May 03
0
[PATCH] nouveau_xv: Avoid reading off the end of the source image on NV50+
...eau_xv.c index f7dc2bc..8eafcf0 100644 --- a/src/nouveau_xv.c +++ b/src/nouveau_xv.c @@ -1095,7 +1095,7 @@ NVPutImage(ScrnInfoPtr pScrn, short src_x, short src_y, short drw_x, NVCopyNV12ColorPlanes(buf + s2offset, buf + s3offset, dst, line_len, srcPitch2, - nlines, line_len); + nlines, npixels); } } else { for (i = 0; i < nlines; i++) { @@ -1161,7 +1161,7 @@ CPU_copy: NVCopyNV12ColorPlanes(buf + s2offset, buf + s3offset, map, dstPitch, srcPitch2, - nlines, line_len); + nlines, npi...