Re: [R] how to write a loop to repetitive jobs

2018-04-16 Thread K. Elo
Hi! An alternative with 'assign': for ( i in 71:75) {   setwd(paste("C:/Awork/geneAssociation/removed8samples/neuhausen", i, sep=""))   temp.df<-read.csv("seg.pr3.csv", head=T)   temp.df$id<-paste0("sn",i,sep="")   assign(paste0("seg",i,sep=""),temp.df) } rm(temp.df,i)    # Clean up HTH, Kimmo

Re: [R] how to write a loop to repetitive jobs

2018-04-16 Thread Albrecht Kauffmann
Hello Ding, try this: seg <- list() for ( d in 71:75) { s <- paste0("seg",d) sn <- paste0("sn",d) Dir<-paste("C:/Awork/geneAssociation/removed8samples/neuhausen", i, sep="") setwd(Dir) seg[[s]] <- read.csv("seg.pr3.csv", head=T) seg[[s]]$id <- sn } Greetings, Albrecht -- Albrecht

Re: [R] Fwd: Help with R-Calling forth csv.

2018-04-16 Thread Jim Lemon
Hi Mohammad, The plot you attached suggests that the underlying distribution may be a mixture. Is there anything in your data that would explain this, such as laden/unladen, uphill/downhill, different road surface? Jim On Mon, Apr 16, 2018 at 11:31 PM, Mohammad Areida wrote: > Hi, I do not know

Re: [R] how to write a loop to repetitive jobs

2018-04-16 Thread Ding, Yuan Chun
Hi Rui, Thank you very much!! It worked very well, I am looking into how to use lapply and do.call. Ding -Original Message- From: Rui Barradas [mailto:ruipbarra...@sapo.pt] Sent: Monday, April 16, 2018 2:16 PM To: Ding, Yuan Chun; r-help@r-project.org Subject: Re: [R] how to write a

Re: [R] how to write a loop to repetitive jobs

2018-04-16 Thread Rui Barradas
Hello, The following might do it. Without data it's untested. wd <- function(i){ paste0("C:/Awork/geneAssociation/removed8samples/neuhausen7", i, "/seg.pr3.csv") } seg <- lapply(1:5, function(i) { DF <-read.csv(wd(i)) DF$id <- paste0("sn7", i) DF }) seg <- do.call(rbind, seg

[R] how to write a loop to repetitive jobs

2018-04-16 Thread Ding, Yuan Chun
Hi All.., I need to do the following repetitive jobs: seg71 <- read.csv("C:/Awork/geneAssociation/removed8samples/neuhausen71/seg.pr3.csv", head=T) seg71$id <-"sn71" seg72 <- read.csv("C:/Awork/geneAssociation/removed8samples/neuhausen72/seg.pr3.csv", head=T) seg72$id <-"sn72" seg73 <- rea

[R] Fwd: Help with R-Calling forth csv.

2018-04-16 Thread Mohammad Areida
Hi, I do not know how to post in general again, however my csv contains around 5-250k data Points depending on vehicle/road type and pressure exerted on geotechnical structures. I have used R to develope histograms of said csv files and will attach such Picture to you in this mail and the csv used.

Re: [R] Help with R-Calling forth csv.

2018-04-16 Thread Ulrik Stervbo
There are plenty of options for reading csv files. For built-in solutions look at ?read.csv or at read_csv from the package reader. If the measurements are ordered in columns rather than in rows, reading the data can be very slow. HTH Ulrik Mohammad Areida schrieb am Mo., 16. Apr. 2018, 13:25:

Re: [R] Help with R-Calling forth csv.

2018-04-16 Thread Roslina Zakaria
Hi, You may use the keyword to google for what you want to do to start with. Slowly you will learn...this forum is,really helpful but we should provide or show some effort..all the best! I like this forum very much and always feel thankful to very helpful and committed members. Sent from my S

Re: [R] Help with R-Calling forth csv.

2018-04-16 Thread Michael Dewey
Dear Mohammad Perhaps if you showed us what you tried people could offer more helpful advice? When you say you want to call it forth do you mean you want to read in the file using read.csv? Michael On 16/04/2018 11:23, Mohammad Areida wrote: Hi, I'm working on R trying to find a distributio

[R] Help with R-Calling forth csv.

2018-04-16 Thread Mohammad Areida
Hi, I'm working on R trying to find a distribution that fits data from a csv file. The csv contains data on pressure exerted by a certain vehicle in terms of pressure [kPa] and I have around 3000 data points. I want to call forth this csv and by using (fitdistr) or if you could recommend a fun

[R] Inverse Gaussian distribution not working in glm funciton

2018-04-16 Thread michael tsagris via R-help
Hello everybody, I have encountered a problem with the inverse Gaussian distribution. It is very likely that it will not work regardless of the data input. I have programmed this regression and it works fine no matter which distribution the response comes from. If you run this example (first tri