[R] Reading a large csv file row by row

2007-04-06 Thread Yuchen Luo
appreciated! Best Wishes Yuchen Luo [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide

Re: [R] Reading a csv file row by row

2007-04-06 Thread Yuchen Luo
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

[R] How to manipulate the pointer of a file?

2007-04-12 Thread Yuchen Luo
: $name [1] Tom $wife [1] Joy $no.kids [1] 9 -- My question is, how to manipulate the pointer of the file further? For example, what if I need the pointer to go back to the previous row? Best Wishes Yuchen Luo [[alternative HTML version deleted

[R] How to lower the 'miniFactor' when using nls( ) function?

2007-04-15 Thread Yuchen Luo
' the only solution to the problem? What are the other options? Best Wishes Yuchen Luo [[alternative HTML version deleted]] __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http

[R] nls.control( ) has no influence on nls( ) !

2007-04-15 Thread Yuchen Luo
see is a separate command like 2). A more relevent question might be, is lower the 'minFactor' the only solution to the problem? What are the other options? Best Wishes Yuchen Luo [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch

[R] if within a function

2007-06-20 Thread Yuchen Luo
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

[R] set up a talbe with column name and write to the table row by row

2007-06-21 Thread Yuchen Luo
Dear Friends. I tried to set up a table with column name and write to it row by row. I have 3 rows to write to the table: a1 - list(name=Fred, wife=Mary, no.children=3) a2 - list(name=Tom, wife=Joy, no.children=9) a3 - list(name=Paul, wife=Alic, no.children=5) When I write to it, the first

[R] Setting up a blank table with column names in the hard drive

2007-06-23 Thread Yuchen Luo
front. How ever, I do not have the first loop of the program completed yet at that time. If I add a row that is meaningless, how may I delete it after all the loops are completed and all the meaningful rows are added to the table? Best Wishes Yuchen Luo [[alternative HTML version deleted

[R] Looping through a series of (csv) files

2007-07-15 Thread Yuchen Luo
Wishes Yuchen Luo [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list 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

[R] Saving an expression to a file

2007-08-03 Thread Yuchen Luo
the expression to a file? Best Wishes Yuchen Luo [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html

[R] set up a blank csv file and write time series to it row by row

2007-08-10 Thread Yuchen Luo
' but I do not know how many of them are going to come up. Examples are : bb1=c(1:10) bb2=c(101:110) How to write bb1 and bb2 to a csv file and how to set up blank csv file to accept such time series in the first place? Your help will be highly appreciated!!! Best Wishes! Yuchen Luo

[R] How to store the parameter estimated by nls( ) to a variable?

2007-08-12 Thread Yuchen Luo
in every loop of my code and I need to store the estimated values for further use. I have checked both the online manual and several S-plus books but no example as such showed up. Your help will be highly appreciated! Best Wishes Yuchen Luo [[alternative HTML version deleted

Re: [R] How to store the parameter estimated by nls( ) to a variable?

2007-08-12 Thread Yuchen Luo
Dear Professor Murdoch. Thank you so much Best Wishes Yuchen Luo On 8/12/07, Duncan Murdoch [EMAIL PROTECTED] wrote: Yuchen Luo wrote: 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

[R] How to write to a table column by column?

2007-08-12 Thread Yuchen Luo
other and I can easily compare their elements. ( If I use 'appened=TRUE', the second time series will be stored in the same column. ) Thank you for your tine and your help will be highly appreciated!! Best Yuchen Luo [[alternative HTML version deleted

[R] How to let the program know the end of a file is reached?

2007-08-29 Thread Yuchen Luo
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

[R] How to signal the end of the table?

2007-08-30 Thread Yuchen Luo
to articulate while (the end of the table has not been reached), or equivalently, how to signal the end of the table? Best Wishes Yuchen Luo [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman

[R] 'singular gradient matrix’ when using nl s() and how to make the program skip nls( ) and run on

2007-09-06 Thread Yuchen Luo
into a problem. I would still need the program to run the remaining 217 nls( )! Is there a way to make the program skip the problematic nls() and complete the ramaining nls()'s? Your help will be highly appreciated! Yuchen Luo [[alternative HTML version deleted

[R] 'initial value not feasible' in constrOptim

2007-09-07 Thread Yuchen Luo
a fortran code to R and the function I want to replace is DBCPOL, which used 'the complex method described in Nelder and Mead (1965) and Gill et al. (1981). I believe contrOptim is better than it because it is newer, is it? Best Wishes Yuchen Luo [[alternative HTML version deleted

[R] What does it mean by initial value not available?

2007-09-09 Thread Yuchen Luo
of the objective function is not well defined at the point of the initial value. 3. The initial value violate the constrain of ui %*% theta - ci = 0 But my situation does not belong to any of the above cases. I have attached my code bellow and could you please help me take a look? Best Wishes Yuchen Luo rm

Re: [R] What does it mean by initial value not available?

2007-09-09 Thread Yuchen Luo
and 4th line) Please correct them as: sigmae=c(0.172239074,0.188209271,0.193703774,0.172659891,0.164427247,0.24602361,0.173555309,0.186701165,0.193150456, 0.1857315601) ss=c(56.49,56.39,56.55,57.49 ,57.37,55.02,56.02,54.35,54.09,54.67) Best Wishes Yuchen Luo On 9/9/07, Duncan Murdoch [EMAIL

[R] Are the error messages of ConstrOptim() consisten with each other?

2007-09-10 Thread Yuchen Luo
=fit.error.grr, ui=ui,ci=ci) Error in f(theta, ...) : argument lambda1 is missing, with no default I only changed the parameters, how come the lambda1 that is not missing in the first 2 cases suddently become missing? For your convenience, I put the complete code below: Best Wishes Yuchen Luo

Re: [R] Are the error messages of ConstrOptim() consisten with each other?

2007-09-10 Thread Yuchen Luo
(0.5,0.3,0.5)) cannot violate both ui%*%theta=ci and -ui%*%theta=-ci. 2. There is lambda1 available. The 0.3 in c(0.5,0.3,0.5) is lambda1. If you plug c(0.5,0.3,0.5) into fit.error and fit.error.grr by fit.error(0.5,0.3,0.5) fit.error.grr(0.5,0.3,0.5) It works. Best Wishes Yuchen Luo On 9/10/07