Re: [R] Problem with loop in folders

2020-04-25 Thread Fredrik Karlsson
Hi, I am sorry if I am misunderstanding what you are trying to do here, but can you simplify it this way? (unfortualtely, this is untested since I dont have a suitable set of files and a directory structure to test against) dbifiles <- list.files(pattern="*.dbi",recursive=TRUE) csvfiles <-

Re: [R] Problem with loop in folders

2020-04-24 Thread Sarah Goslee
I suspect much if not all of your trouble would be eliminated by using file.path() instead of paste0(). https://www.rdocumentation.org/packages/base/versions/3.6.2/topics/file.path (Also check your file name - you probably want a . between name and csv, so using paste(name, "csv", sep = ".")

Re: [R] Problem with loop in folders

2020-04-24 Thread Bert Gunter
What package is "read.dbf" from? What error message/behavior did you see? Should it be: path<-setwd(paste0("inpath/",folder)) ## did you forget the "/" ? Bert Gunter "The trouble with having an open mind is that people keep coming along and sticking things into it." -- Opus (aka Berkeley

[R] Problem with loop in folders

2020-04-24 Thread Shubhasmita Sahani
Hi Everyone, I am trying to loop through the folders in the major working directory. Read the dbf file into the data frame then save the data frame as CSV file in another folder. For this, I have written this code, But not able to figure out where it is going wrong. Any ideas will be of great

[R] problem in loop using windows executable

2014-10-29 Thread Pedro Segurado
Dear all, I am trying to develop a R script that basically uses a loop that includes 5 main steps: (1) it runs a windows executable file outside R that requires a set of *.txt files using the shell function (Note: I have tried system and system(shhQuote()) and the problem remains), (2) it imports

Re: [R] problem in loop using windows executable

2014-10-29 Thread Jeff Newmiller
My suggestion is that you provide a reproducible example, as the Posting Guide requests. --- Jeff NewmillerThe . . Go Live... DCN:jdnew...@dcn.davis.ca.usBasics: ##.#.

[R] Problem with loop, matrix and data frame

2013-11-26 Thread ANNA SIMEONIDOU
Hi all, I'm sorry, maybe the solution in my problem is easy, but i am still new to R, and any help here is appreciated! I want to create a data frame, or a matrix in which the output of each loop will be stored. Here is the program n-c(10,8,7,5) n_goal-c(8,9,9,4) w-c(0.1,0.1,0.1,0.1)

Re: [R] Problem with loop, matrix and data frame

2013-11-26 Thread jim holtman
You reused 'i' in the inner 'for' loop. This looks like it give the correct answer: n-c(10,8,7,5) n_goal-c(8,9,9,4) w-c(0.1,0.1,0.1,0.1) matrix-mat.or.vec(6,4) FI-function(n_t) { + (((n_goal[1]-n[1]+W[1]-f[1]+n_t[1])^2)+((n_goal[2]-n[2]+W[2]-f[2]+n_t[2]-n_t[1])^2)+ +

Re: [R] Problem in loop

2012-03-22 Thread Petr PIKAL
Hi Dear R users I want change the entries in a matrix. I did a matrix A=0 1 5 .3 0 0 0 .5 0 A1-A A2-A*0.90 A2 12 3 1 0.00 0.90 4.5 2 0.27 0.00 0.0 3 0.00 0.45 0.0 I need replace elements one by one in a loop I tried the

[R] Problem in loop

2012-03-20 Thread Fidel Maximiano Peña Ramos
Dear R users I want change the entries in a matrix. I did a matrix A=0 1 5 .3 0 0 0 .5 0 A1-A A2-A*0.90 A2 12 3 1 0.00 0.90 4.5 2 0.27 0.00 0.0 3 0.00 0.45 0.0 I need replace elements one by one in a loop I tried the following using package POPBIO, total

Re: [R] Problem with loop

2011-12-03 Thread Komine
Hi, Thank Michael for your help. Komine -- View this message in context: http://r.789695.n4.nabble.com/Problem-with-loop-tp4148083p4154147.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list

[R] Problem with loop

2011-12-02 Thread Komine
Hi, I try to build a loop difficultly. I have in a folder called Matrices several files (.csv) called Mat2002273, Mat2002274 to Mat2002361. I want to calculate for each file the mean of the column called Pixelvalues. I try this code but as result, I have this message: Mat2002273 not found

Re: [R] Problem with loop

2011-12-02 Thread R. Michael Weylandt
You never create a variable called Mat2002273 or Mat2002361 so you can't ask R to loop over all the values between them. If I were you, I'd code something like this: lf - list.files() # PUT IN SOME CODE TO REMOVE FILES YOU DON'T WANT TO USE pv - vector(numeric, length(lf)) for(i in lf) pv[i]

[R] problem in loop

2009-09-02 Thread Seunghee Baek
Hi R-users, I have a problem for updating the estimates of correlation coefficient in simulation loop. I want to get the matrix of correlation coefficients (matrix, name: est) from geese by using loop(500 times) . I used following code to update, nsim-500 est-matrix(ncol=2, nrow=nsim) for(i in

Re: [R] problem in loop

2009-09-02 Thread milton ruser
Hi there, and how about this: nsim-500 est-NULL for(i in 1:nsim){ fit - geese(x ~ trt, id=subject, data=data_gee, family=binomial, corstr=exch, scale.fix=TRUE) . corr_gee-summary(fit)$correlation[1] se_corrgee-summary(fit)$correlation[2] est-data.frame(rbind(est,cbind(corr_gee,

Re: [R] problem in loop

2009-09-02 Thread Scott Sherrill-Mix
I'm not too familiar with geese but it looks like the summary(fit)$correlation would be a dataframe. Maybe try getting the first (or whatever row you're interested in): ... corr_gee-summary(fit)$correlation[1,1] se_corrgee-summary(fit)$correlation[1,2] est[i,]-c(corr_gee, se_corrgee) ... Scott

Re: [R] Problem with Loop and overwritten results

2009-04-13 Thread unbekannt
thank you so much! this solved my problem unbekannt wrote: Dear all, I am a newbie to R and practising at the moment. Here is my problem: I have a programme with 2 loops involved. The inner loop get me matrices as output and safes all values for me. Now once I wrote a

[R] Problem with Loop and overwritten results

2009-04-12 Thread unbekannt
Dear all, I am a newbie to R and practising at the moment. Here is my problem: I have a programme with 2 loops involved. The inner loop get me matrices as output and safes all values for me. Now once I wrote a 2nd loop around the other loop in order to repeat the inner loop a couple

Re: [R] Problem with Loop and overwritten results

2009-04-12 Thread David Winsemius
Dear unbekannt; The construction that would append a number to a numeric vector would be: vec - c(vec , number) You can create an empty vector with vec - c() or vec - NULL -- David Winsemius On Apr 12, 2009, at 2:10 PM, unbekannt wrote: Dear all, I am a newbie to R and practising at