similar to: Reading a csv file row by row

Displaying 20 results from an estimated 10000 matches similar to: "Reading a csv file row by row"

2007 Apr 06
1
Reading a large csv file row by row
Hi, my friends. When a data file is large, loading the whole file into the memory all together is not feasible. A feasible way is to read one row, process it, store the result, and read the next row. In Fortran, by default, the 'read' command reads one line of a file, which is convenient, and when the same 'read' command is executed the next time, the next row of the same file
2007 Aug 13
2
How to write to a table column by column?
Dear friends. Every loop of my program will result in a list that is very long, with a structure similar to the one below: Lst <- list(name="Fred", wife="Mary", daily.incomes=c(1:850)) Please notice the large size of "daily.incomes". I need to store all such lists in a csv file so that I can easily view them in Excel. Excel cannot display a row of more than 300
2007 Apr 15
1
nls.control( ) has no influence on nls( ) !
Dear Friends. I tried to use nls.control() to change the 'minFactor' in nls( ), but it does not seem to work. I used nls( ) function and encountered error message "step factor 0.000488281 reduced below 'minFactor' of 0.000976563". I then tried the following: 1) Put "nls.control(minFactor = 1/(4096*128))" inside the brackets of nls, but the same error message
2007 Aug 03
2
Saving an expression to a file
Dear Friends. I have a very long expression and I use function D to find its derivative, which will be even longer. I save the resulting expression in a variavle, say bbb. But when I tried to display bbb on the screen, the R screen is not long enough for me to view it. Is there a way to save the expression to a file? Best Wishes Yuchen Luo [[alternative HTML version deleted]]
2007 Jun 21
4
"if" within a function
Dear Friends. I found a puzzling phenomenon in R when you use 'if' within a function: # defining a function aaa aaa=function(a) {if (a==1) {aaa=1}; if (a!=1) {aaa=2} } # using the function: > b=20 > bbb=aaa(b) > bbb [1] 2 > typeof(bbb) [1] "double" > > > c=1 > ccc=aaa(c) > ccc NULL > typeof(ccc) [1] "NULL" It seems that only the last
2007 Jun 23
3
Setting up a blank table with column names in the hard drive
Dear Friends. Greetings! This should be a very common operation and I believe there should be a nice way in R to handle it. I couldn't find it in the manual or by searching on line. I am wondering if I could ask for some help in this community. I am trying to record the results of my program to a csv file in the hard drive so as to save memory space and also to read the results in excel
2007 Aug 29
4
How to signal the end of the table?
I am using a "for" loop to read a table row by row and I have to specify how many records are there in the table. I need to read row by row because the table is huge and the memory not large enough for the whole table.: number.of.records=100 fp=file("abc.csv","r") pos=seek(fp, rw="read") for (i in 1:number.of.record){ current.row=scan(file=fp,
2007 Sep 05
3
'singular gradient matrix’ when using nls() and how to make the program skip nls( ) and run on
Dear friends. I use nls() and encounter the following puzzling problem: I have a function f(a,b,c,x), I have a data vector of x and a vectory y of realized value of f. Case1 I tried to estimate c with (a=0.3, b=0.5) fixed: nls(y~f(a,b,c,x), control=list(maxiter = 100000, minFactor=0.5 ^2048),start=list(c=0.5)). The error message is: "number of iterations exceeded maximum of
2007 Sep 07
1
'initial value not feasible' in constrOptim
Dear friends. I am using function constrOptim(c(0.5,0.3,0.5), fit.error, fit.error.grr, ui=-1*ui,ci=-1*ci) and I am confronted with error message "initial value not feasible" I plug in the initial value of (0.5,0.3,0.5) to function fit.error and fit.error.grr and have pretty reasonable result. I inequality "ui %*% theta - ci >= 0" as suggested in the R manual and it is
2007 Jul 15
1
Looping through a series of (csv) files
Dear Colleagues. This should be a very common operation and I believe there should be a nice way in R to handle it. I couldn't find it in the manual or by searching online. I am wondering if I could ask for some help in this community. I have 48 csv files; each stores the data for a specific month. The 48 corresponding months are consecutively from January, 2001 to December, 2004. I name
2007 Aug 29
1
How to let the program know the end of a file is reached?
Dear collegues. I am using scan( ) to read from a table (a csv file). I am wondering how to let the program know that the end of the file is reached? Your help will be highly appreciated! Best Wishes Yuchen Luo [[alternative HTML version deleted]]
2007 Apr 12
2
How to manipulate the pointer of a file?
Dear friends. With file( ) to obtain a pointer of a file, every time we use scan ( ) to read one row of it, the pointer will point to the next row of the file. In the following example, d1 and d2 are obtained the same way but they correspond to different rows of the same file because the pointer of the file moves down a row when a row of the file is read. The following is an example: a1
2007 Sep 10
2
Are the error messages of ConstrOptim() consisten with each other?
Dear Friends. I found something very puzzling with constOptim(). When I change the parameters for ConstrOptim, the error messages do not seem to be consistent with each other: > constrOptim(c(0.5,0.3,0.5), f=fit.error, gr=fit.error.grr, ui=ui,ci=ci) Error in constrOptim(c(0.5, 0.3, 0.5), f = fit.error, gr = fit.error.grr, : initial value not feasible > constrOptim(c(0.5,0.9,0.5),
2007 Sep 09
2
What does it mean by "initial value not available"?
Dear friends. I use ConstrOptim( ) and got error message "initial value not available". My understanding of "initial value not available" is that one of the following 3 cases happens: 1.The objective function is not well defined at the point of the initial value. 2. The differentiation of the objective function is not well defined at the point of the initial value. 3. The
2007 Aug 12
1
How to store the parameter estimated by nls( ) to a variable?
Dear Colleagues. I believe this should be a problem encountered by many: nls( ) is a very useful and efficient function to use if we are just to display the estimated value on screen. What if we need R to store the estimated parameter in a variable? For example: x=rnorm(10, mean=1000, sd=10) y=x^2+100+rnorm(10) a=nls(y~(x^2+para),control=list(maxiter = 1000, minFactor=0.5
2007 Aug 10
0
set up a blank csv file and write time series to it row by row
Dear Friends. Greetings! I have asked the question of how to set up a blank file and write a list to it as a row for many times, with the number of lists unknown. I have received many beautiful solutions. Thanks go to Professor *Murdoch, Professor *Menne, Professor Grothendieck and Dr. Olshansky. I have organized the solutions below: ########################################## *Set up a
2016 Mar 12
2
Questions about GSoC project: Speed up the Test Suite
Hi, My name is Luo Zengbo, a student from Zhejiang University, China. As I mentioned in IRC before(my IRC nick name is poe_), I am interested in GSoC project: Speed up the Test Suite. After discussed with Olly, I think this project can be divided into three steps: Step 1: Rewrite every call of the function get_writable_database(). I will pass writable database's name with
2010 Jul 22
4
Installation
Hi all, I''m struggling to install Xen Hypervisor on my PC, but after one week''s attempt again and again, it still doesn''t work. Anyone can give some suggestion or helpful link? 1. download the xen 4.0.0 stable tarball from here, http://www.xen.org/products/xen_source.html 2. unzip the tar and run install.sh and ''make world'' 3. make install 4. then I
2012 Feb 01
3
Probit regression with limited parameter space
Dear R helpers, I need to estimate a probit model with box constraints placed on several of the model parameters. I have the following two questions: 1) How are the standard errors calclulated in glm (family=binomial(link="probit")? I ran a typical probit model using the glm probit link and the nlminb function with my own coding of the loglikehood, separately. As nlminb does not
2013 Nov 20
2
[LLVMdev] Can't compile compiler-rt, asan error
"If the answer is no", of course. On Nov 20, 2013 8:02 AM, "Alexander Potapenko" <glider at google.com> wrote: > Do you have the iossim sdk installed on your machine (check by 'xcrun > --show-sdk-path --sdk iphonesimulator')? > If the answer is yes and you're testing on ToT, that's a bug. I'll take a > look. > On Nov 20, 2013 5:05 AM,