Displaying 20 results from an estimated 40000 matches similar to: "Reading a large csv file row by row"
2007 Apr 06
2
Reading a 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 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 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 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 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 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 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 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 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
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 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 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 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 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),
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
2020 Aug 20
1
Intel AMX programming model discussion.
On 8/20/20 2:47 PM, Topper, Craig wrote:
>
> I think I’m still missing something here. The configuration is per
> tile. The multiply instructions take a MxK tile and multiply it by a
> KxN tile and accumulate into an MxN tile. So the configuration needs
> to know how many of each size of tile it needs to avoid a spill.
> Wouldn’t the register allocator then need to know which
2016 Jun 29
0
The clang for centos6 are need GLIBC_2.14, but we only have GLIB 2.12 by default.
It is possible to statically link against libstdc++, yes. I don't quite
know all the pieces to the recipe in order to get that to work. It would
require changes to the release script in order to get those configuration
changes all the way through the third phase build.
I don't believe any other tarball release does this, so it would at least
be an unconventional release.
On Wed, Jun
2020 Aug 19
2
Intel AMX programming model discussion.
> When the tile shape is unknown at compile time, how do you plan to do the register allocation of the tiles? My question is: do you do the allocation for this case in the same way as you would if you knew the size was 16x16 (i.e., conservatively assume the largest size)?
I think what will happen is that the registers are allocated based on a number of runtime values that are assumed to be