similar to: Seeking a more efficient way to read in a file

Displaying 20 results from an estimated 3000 matches similar to: "Seeking a more efficient way to read in a file"

2008 Jan 07
3
Seeking a more efficient way to find partition maxima
Hi. Suppose I have a vector that I partition into disjoint, contiguous subvectors. For example, let v = c(1,4,2,6,7,5), partition it into three subvectors, v1 = v[1:3], v2 = v[4], v3 = v[5:6]. I want to find the maximum element of each subvector. In this example, max(v1) is 4, max(v2) is 6, max(v3) is 7. If I knew that the successive subvector maxima would never decrease, as in the example,
2007 Dec 10
4
Reading through a group of .RData files
Hi. I have a procedure that reads a directory, loops through a set of particular .RData files, loading each one, and feeding its object(s) into a function, as follows: cvListFiles<-list.files(fnDir); for(i in grep(paste("^",pfnStub,".*\\.RData$",sep=""),cvListFiles)){ load(paste(fnDir,cvListFiles[i],sep="/")); myFunction(rliObject); rm(rliObject); };
2008 Jan 07
1
numerical data frame
Dear All, I've successfully import my synteny data to R by using scan command. Below show my results. My major problem with my data is how am i going to combine the column names with the data( splt) where i have tried on cbind but a warning message occur. I have realized that the splt data only have 5 column instead of 6. Please help me with this!! I want my data to be a numerical
2007 Feb 28
1
Efficient way to repeat rows (or columns) of a matrix?
Hi. If I have a vector, v_1, and another vector of positive integers, i_1, the same length as v_1, then rep(v_1,i_1) will repeat v_i[j] exactly i_1[j] times, like so: >rep(c(1,2,3),c(3,2,1)) [1] 1 1 1 2 2 3 > I'd like to do the same sort of thing where I replace v_1 with a matrix, and the jth row of the matrix is repeated i_1 times. Obviously, I could do this with for loops, like
2007 Dec 26
1
Can you recover default argument values of a function?
Hi. Maybe this is a stupid question. If so, I apologize, but here goes. Suppose I have a function f1(x,...) that calls a function f2(y1,y2,...,yn) in the following way: if x satisfies a certain condition, then I want to call f2(x,y2,...,yn); otherwise I want to use the default value of y1, if there is one. I could do something like the following: v <- ifelse ( is.null(x), f2( , y2,...,
2007 Dec 19
1
Function reference
Hi. I'm looking for an R equivalent to something like function pointers in C/C++. I have a search procedure that evaluates the fitness of each point it reaches as it moves along, and decides where to move next based on its fitness evaluation. I want to be able to pass different fitness functions to this procedure. I am trying to find a good way to do this. I was thinking of passing in
2012 May 17
2
Importing ASCII flat
I am trying to import Indian National Sample Survey Data. It is ASCII flat and an example is below 001460306025001117101011117111201*01*000000211 270104070204093 002460306025001117101011117111201*02*0000008011116104910519572 022 2600 1150 30 55 170 4005 003460306025001117101011117111201*03* 0000111039204112 222 Previous post don't seem to provide much help. I have an document
2011 May 06
1
read a netcdf file _Fill_value=-32768
Hello I am a new user of R . and I ve problem with R and netcdf . I succed installation , I could use all examples . But when I take my netcf it is different . I want to do statistic on this kind of file . 1) first calculate mean . my data is like that through ncdump -h test.nc netcdf test { dimensions: lat = 301 ; lon = 401 ; time = UNLIMITED ; // (80 currently)
2007 Dec 20
1
Quote: An embedded and charset-unspecified text was scrubbed...
Occasionally when I click on a posting in the archives, I don't see the actual message, but instead, something like the following: An embedded and charset-unspecified text was scrubbed... Name: not available Url: https://stat.ethz.ch/pipermail/r-help/attachments/200712XX/aXXXXXXX/attachment.pl In fact, this is what has happened with the past few messages I have posted. Is this because
2007 Mar 05
2
Linear programming with sparse matrix input format?
Hi. I am aware of three different R packages for linear programming: glpk, linprog, lpSolve. From what I can tell, if there are N variables and M constraints, all these solvers require the full NxM constraint matrix. Some linear solvers I know of (not in R) have a sparse matrix input format. Are there any linear solvers in R that have a sparse matrix input format? (including the
2005 May 08
2
detaching console from background asterisk
This puzzles me. If I start asterisk in the background, and then attach to it to perform some chores, is there a way to detach again without stopping the background process? Entering "stop now" kills both the console attachment as well as the background process. I need to attach to the running asterisk in order to do "init keys" but once I do that, it seems I cannot just
2007 Jul 27
2
Matrix Multiplication, Floating-Point, etc.
Hi. I recently tried the following in R 2.5.1 on Windows XP: >ev2<-c(0.8,-0.6) >ev1<-c(0.6,0.8) >ev1%*%ev2 [,1] [1,] -2.664427e-17 >sum(ev1*ev2) [1] 0 > (I got the same result with R 2.4.1 on a different Windows XP machine.) I expect this issue is very familiar and probably has been discussed in this forum before. Can someone please point me to some
2009 Apr 15
2
Split string
> (FICB[,"temp"]) [1] "0.30" "0.55" "0.45" "2.30" "0.45" "0.30" "0.25" "0.30" "0.30" "1.05" "1.00" "1.00" [13] "0.30" "0.30" "0.30" "0.55" "0.30" "0.30" "0.30" "0.25" "1.00"
2007 Jan 11
1
rank function and NA in 2.3.1
Hi. I am using R 2.3.1 on WIndows XP, and I am having trouble with the rank function in the presence of numerical NA data. I want the NA's all to get the same rank, but they don't. Here is an example from my session: >ct_align_rets_f2$liq[6851:6859] [1] 115396 NA 362595 NA 242986 340805 NA 692905 251533
2007 May 15
2
Testing for existence inside a function
Hi. I'm having trouble testing for existence of an object inside a function. Suppose I have a function: f<-function(x){ ... } and I call it with argument y: f(y) I'd like to check inside the function whether argument y exists. Is this possible, or do I have to either check outside the function or pass the name of the argument as a separate argument? If I do exists(x) or
2007 Feb 02
1
Another loop - deloop question
Hi. You folks are so clever, I thought perhaps you could help me make another procedure more efficient. Right now I have the following setup: p is a vector of length m g is a list of length n, g[[i]] is a vector whose elements are indices of p, i.e., integers between 1 and m inclusive); the g[[i]] cover the full set 1:m, but they don't have to constitute an exact partition, theycan
2007 Sep 12
1
"Save to File..." option on File menu
Hi. There was an interesting thread about a year ago, called 'Command equivalent of rgui "File, Save to File"?' (http://tolstoy.newcastle.edu.au/R/e2/help/06/09/0553.html) started by Michael Prager, and contributed to by Duncan Murdoch (I didn't notice anything beyond the four entries they posted). The question was how to replicate programmatically the "Save to
2006 Dec 29
1
Failure loading library into second R 2.3.1 session on Windows XP
Hi. I am using R 2.3.1 on Windows XP. I had installed a library package into my first session and wanted the same package in my second session, so I went out to the CRAN mirror and tried to install the package, and got the following message: ********************************************************************* >utils:::menuInstallPkgs() trying URL
2007 Feb 01
3
Can this loop be delooped?
Hi. I have the following code in a loop. It splits a vector into subvectors of equal size. But if the size of the original vector is not an exact multiple of the desired subvector size, then the first few subvectors have one more element than the last few. I know that the cut function could be used to determine where to break up the vector, but it doesn't seem to provide control over
2008 Jul 09
2
Parsing
Dear R users, I have a big text file formatted like this: x x_string y y_string id1 id1_string id2 id2_string z z_string w w_string stuff stuff stuff stuff stuff stuff stuff stuff stuff // x x_string1 y y_string1 z z_string1 w w_string1 stuff stuff stuff stuff stuff stuff stuff stuff stuff // x x_string2 y y_string2 id1