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 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. Below I will type the R code I have used for this histogram.
>
> 
> 
>
> tryck <- read.csv("radmanso_2017.csv", sep=";", dec=",")
>
> # H??R KOLLAR VI ALLA DATA PUNKTER ##
>
> ggplot(data=tryck, aes(tryck[,1])) +
>
>   geom_histogram(aes(y =..density..),
>
>  breaks=seq(min(tryck[,1]-1), max(tryck[,1]+1), by = 0.5),
>
>  col="black",
>
>  fill="green",
>
>  alpha = .2) +
>
>   geom_density(col=2) +
>
>   labs(title="Pressure for rådmansö") +
>
>   labs(x="Pressure [kPa]", y="Amount of vehicles (Percentage)")+
>
>   stat_function(fun=dnorm, colour="blue", args = list(mean =
> mean(tryck[,1]), sd = sd(tryck[,1])))
>
>
>
> My problem now is to find a statistical distribution that corresponds well
> with my histograms with the use of Visual aids, cumulative distributions or
> goodness of fit tests which I can’t develope a code for as my csv wont get
> called forth and I do not know how to proceed from that Point on to develop
> such an aid. If you have any input on how to read the csv file and call
> forth a distribution to try on my data points such as Weibull, beta, chi or
> gen. Extreme value distributions I would much appreciate the help!
>
>
>
> Kind regards,
>
> Mohammad
>
> __
> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
> 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, minimal, self-contained, reproducible code.
>

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
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, minimal, self-contained, reproducible code.


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 loop to repetitive jobs

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)
row.names(seg) <- NULL


Hope this helps,

Rui Barradas

On 4/16/2018 9:54 PM, Ding, Yuan Chun wrote:
> 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 <- 
> read.csv("C:/Awork/geneAssociation/removed8samples/neuhausen73/seg.pr3.csv", 
> head=T) seg73$id <-"sn73"
> 
> seg74 <- 
> read.csv("C:/Awork/geneAssociation/removed8samples/neuhausen74/seg.pr3.csv", 
> head=T) seg74$id <-"sn74"
> 
> seg75 <- 
> read.csv("C:/Awork/geneAssociation/removed8samples/neuhausen75/seg.pr3.csv", 
> head=T) seg75$id <-"sn75"
> 
> seg <- rbind (seg71, seg72, seg73, seg74, seg75)
> 
> I want to write a loop to do it;
> 
> For ( d in 71:75) {
>Dir<-paste("C:/Awork/geneAssociation/removed8samples/neuhausen", i, sep="")
>setwd(Dir)
> ..
> then I do not know how to create objects seg71 to seg75;  in SAS, it would be 
>  seg;
> 
> I like R, but not good at R.
> 
> Can you help me?
> 
> Thank you,
> 
> Ding
> 
> 
> -
> -SECURITY/CONFIDENTIALITY WARNING-
> This message (and any attachments) are intended solely 
> f...{{dropped:22}}
> 
> __
> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see 
> 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, minimal, self-contained, reproducible code.
> 
__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
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, minimal, self-contained, reproducible code.


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)
row.names(seg) <- NULL


Hope this helps,

Rui Barradas

On 4/16/2018 9:54 PM, Ding, Yuan Chun wrote:

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 <- 
read.csv("C:/Awork/geneAssociation/removed8samples/neuhausen73/seg.pr3.csv", 
head=T)
seg73$id <-"sn73"

seg74 <- 
read.csv("C:/Awork/geneAssociation/removed8samples/neuhausen74/seg.pr3.csv", 
head=T)
seg74$id <-"sn74"

seg75 <- 
read.csv("C:/Awork/geneAssociation/removed8samples/neuhausen75/seg.pr3.csv", 
head=T)
seg75$id <-"sn75"

seg <- rbind (seg71, seg72, seg73, seg74, seg75)

I want to write a loop to do it;

For ( d in 71:75) {
   Dir<-paste("C:/Awork/geneAssociation/removed8samples/neuhausen", i, sep="")
   setwd(Dir)
..
then I do not know how to create objects seg71 to seg75;  in SAS, it would be  
seg;

I like R, but not good at R.

Can you help me?

Thank you,

Ding


-
-SECURITY/CONFIDENTIALITY WARNING-
This message (and any attachments) are intended solely f...{{dropped:22}}

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
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, minimal, self-contained, reproducible code.



__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
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, minimal, self-contained, reproducible code.


[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 <- 
read.csv("C:/Awork/geneAssociation/removed8samples/neuhausen73/seg.pr3.csv", 
head=T)
seg73$id <-"sn73"

seg74 <- 
read.csv("C:/Awork/geneAssociation/removed8samples/neuhausen74/seg.pr3.csv", 
head=T)
seg74$id <-"sn74"

seg75 <- 
read.csv("C:/Awork/geneAssociation/removed8samples/neuhausen75/seg.pr3.csv", 
head=T)
seg75$id <-"sn75"

seg <- rbind (seg71, seg72, seg73, seg74, seg75)

I want to write a loop to do it;

For ( d in 71:75) {
  Dir<-paste("C:/Awork/geneAssociation/removed8samples/neuhausen", i, sep="")
  setwd(Dir)
..
then I do not know how to create objects seg71 to seg75;  in SAS, it would be  
seg;

I like R, but not good at R.

Can you help me?

Thank you,

Ding


-
-SECURITY/CONFIDENTIALITY WARNING-
This message (and any attachments) are intended solely f...{{dropped:22}}

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
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, minimal, self-contained, reproducible code.


[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. Below I will type the R code I have used for this histogram.




tryck <- read.csv("radmanso_2017.csv", sep=";", dec=",")

# H??R KOLLAR VI ALLA DATA PUNKTER ##

ggplot(data=tryck, aes(tryck[,1])) +

  geom_histogram(aes(y =..density..),

 breaks=seq(min(tryck[,1]-1), max(tryck[,1]+1), by = 0.5),

 col="black",

 fill="green",

 alpha = .2) +

  geom_density(col=2) +

  labs(title="Pressure for rådmansö") +

  labs(x="Pressure [kPa]", y="Amount of vehicles (Percentage)")+

  stat_function(fun=dnorm, colour="blue", args = list(mean =
mean(tryck[,1]), sd = sd(tryck[,1])))



My problem now is to find a statistical distribution that corresponds well
with my histograms with the use of Visual aids, cumulative distributions or
goodness of fit tests which I can’t develope a code for as my csv wont get
called forth and I do not know how to proceed from that Point on to develop
such an aid. If you have any input on how to read the csv file and call
forth a distribution to try on my data points such as Weibull, beta, chi or
gen. Extreme value distributions I would much appreciate the help!



Kind regards,

Mohammad
__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
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, minimal, self-contained, reproducible code.


Re: [ESS] ess-dump-object-into-edit-buffer

2018-04-16 Thread Ista Zahn
Hi Patrick,

On Mon, Apr 16, 2018 at 5:10 AM, Patrick Connolly
 wrote:
> This is about the shortest I can get that shows what happens: Just
> what the example function does is not material to my question.

Can you reproduce this following only these instructions starting from
'emacs -q'? I cannot, i.e., it works as expected for me.



> (custom-set-variables
>   ;; custom-set-variables was added by Custom -- don't edit or cut/paste it!
>   ;; Your init file should contain only one such instance.
>  '(inferior-ess-dump-command "dump(\"%s\",file=\"%s\", control=\"useSource\")
> ")
> '(ess-source-directory "./.tmp")
>  '(load-home-init-file t t))

This suggests to me that you did _not_ start with emacs -q, so indeed
you should start looking at your configuration to see where the
problem is. Did you try commenting out the 'ess-source-directory'
setting to see if that is the problem?

Best,
Ista

>
> Ideas as to where I should look are welcome.
>
> best
> Patrick
>
> On Thu, 12-Apr-2018 at 11:08PM -0400, Ista Zahn wrote:
>
> |> Hi Patrick,
> |>
> |> I don't use ess-dump-object-into-edit-buffer, so I'm not sure what
> |> exactly you expect it to do. A specific example would help, i.e., a
> |> description of exactly what you did, exactly what happened, and how
> |> what happened differed from you expectation.
> |>
> |> For example, if I start R with 'M-x R ' and do 'M-x
> |> ess-dump-object-into-edit-buffer  getwd ' I see a new buffer
> |> is created containing
> |>
> |> getwd <-
> |> function ()
> |> .Internal(getwd())
> |>
> |> Is that what you see? If so, how does it differ from what you expect?
> |> If you see something different, how does your setup differ from mine?
> |> I'm running Emacs 25.3 and ESS 17.11 [elpa: 20180412.315]
> |>
> |> Best,
> |> Ista
> |>
> |> On Thu, Apr 12, 2018 at 7:19 PM, Patrick Connolly
> |>  wrote:
> |> > Thanks Ista.
> |> >
> |> > The result is not the same, but it's equally useless.  It produces almost
> |> > the same as typing the name of the function and pressing . That 
> is to
> |> > say, unless the function has been edited in the working directory, it 
> lists
> |> > all the code without any of the comments almost in the form of a list
> |> > element labelled "structure" and a second element labelled "source" which
> |> > contains all the source in the form of a character vector.   Quite a lot 
> of
> |> > text wrangling is required to get that text into the form of an editable
> |> > function.
> |> >
> |> > There is a slight difference from what results from typing the function 
> name
> |> > and pressing   in that the word "structure" is not in the latter 
> and
> |> > the source is an attr.
> |> >
> |> > (I say "almost" because neither form is exactly the same as how a list is
> |> > displayed.)
> |> >
> |> > Is that intended behaviour?
> |> >
> |> > TIA
> |> > Patrick
> |> >
> |> > On 04/13/2018 01:48 AM, Ista Zahn wrote:
> |> >
> |> > On Thu, Apr 12, 2018 at 3:56 AM, Patrick Connolly
> |> >  wrote:
> |> >
> |> > Thanks for the response, however, if I start Emacs with a '-q' none of
> |> > my ~/.emacs file is read, so Emacs doesn't know how to start R.  More
> |> > to the point, I'm unable to run R within Emacs any other way.
> |> >
> |> > The usual recipe is to start with emacs -q and then evaluate
> |> >
> |> > (package-initialize)
> |> > (require 'ess-site)
> |> >
> |> > in the scratch buffer, then check to see if you can reproduce the bug.
> |> > If you have ESS installed in a way that it is not in your load-path by
> |> > default you may have to do something along the lines of
> |> >
> |> > (add-to-list 'load-path "/path/to/ESS/lisp/")
> |> > (load "ess-site")
> |> >
> |> > Best,
> |> > Ista
> |> >
> |> >
> |> >
> |> > I gather there is a way of applying individual lines of the .emacs
> |> > files but a bear with a small brain doesn't know how to do that (or
> |> > where to look in the manual how to do it),
> |> >
> |> > It would appear, if it doesn't reproduce, that the problem is
> |> > somewhere in my .emacs file.  That's a hodge-podge of various things
> |> > I've picked up over the decades so it wouldn't be surprising to find
> |> > some incompatibilities.
> |> >
> |> > Ideas appreciated.
> |> >
> |> >
> |> > On Wed, 11-Apr-2018 at 07:44AM -0400, Ista Zahn wrote:
> |> >
> |> > |> I can't reproduce it with the latest ESS from melpa. Can you give
> |> > |> reproduction steps starting with
> |> > |>
> |> > |> emacs -q
> |> > |>
> |> > |> ?
> |> > |>
> |> > |> --Ista
> |> > |>
> |> > |> On Wed, Apr 11, 2018 at 4:58 AM, Patrick Connolly
> |> > |>  wrote:
> |> > |> > For a long time I used to be able to use
> |> > |> >
> |> > |> > ess-dump-object-into-edit-buffer
> |> > |> >
> |> > |> > to create a buffer that could be used to edit the designated 
> function
> |> > |> > from anywhere on the search path to make a local version.
> |> > |> >
> |> 

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:

> 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 function to use, get a plot of my csv and the distributions I
> can compare it to (Weibull, chi, beta, etc). Now im a complete amateur with
> the program R, and I can't write a code to call forth the csv with every
> data point. I’ve been stuck trying to write a code that works for over a
> week and have not gotten it to work. I've come to the conclusion that this
> is the only program capable enough to help me plot the distributions to my
> data, any help is greatly appreciated!
>
> Kind regards
>
> [[alternative HTML version deleted]]
>
> __
> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
> 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, minimal, self-contained, reproducible code.
>

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
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, minimal, self-contained, reproducible code.


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 Sony Xperia™ smartphone

 Mohammad Areida wrote 

>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 function to use, get a plot of my csv and the distributions I can 
>compare it to (Weibull, chi, beta, etc). Now im a complete amateur with the 
>program R, and I can't write a code to call forth the csv with every data 
>point. I’ve been stuck trying to write a code that works for over a week and 
>have not gotten it to work. I've come to the conclusion that this is the only 
>program capable enough to help me plot the distributions to my data, any help 
>is greatly appreciated!
>
>Kind regards 
>
>   [[alternative HTML version deleted]]
>
>__
>R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
>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, minimal, self-contained, reproducible code.

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
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, minimal, self-contained, reproducible code.


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 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 function to use, get a plot of my csv and the distributions I can compare it 
to (Weibull, chi, beta, etc). Now im a complete amateur with the program R, and 
I can't write a code to call forth the csv with every data point. I’ve been 
stuck trying to write a code that works for over a week and have not gotten it 
to work. I've come to the conclusion that this is the only program capable 
enough to help me plot the distributions to my data, any help is greatly 
appreciated!

Kind regards

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
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, minimal, self-contained, reproducible code.



--
Michael
http://www.dewey.myzen.co.uk/home.html

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
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, minimal, self-contained, reproducible code.


[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 function to use, get a plot of my csv and the distributions I can compare it 
to (Weibull, chi, beta, etc). Now im a complete amateur with the program R, and 
I can't write a code to call forth the csv with every data point. I’ve been 
stuck trying to write a code that works for over a week and have not gotten it 
to work. I've come to the conclusion that this is the only program capable 
enough to help me plot the distributions to my data, any help is greatly 
appreciated!

Kind regards 

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
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, minimal, self-contained, reproducible code.


Re: [ESS] ess-dump-object-into-edit-buffer

2018-04-16 Thread Patrick Connolly
This is about the shortest I can get that shows what happens: Just
what the example function does is not material to my question.



## from the bash prompt

mkdir ~/Temp/First
cd ~/Temp/First
emacs &
# start R using M-x R

## within the *R* buffer make a short function

bringLibrary <-
function(lastR = "3.0.2", latestR = "3.1.0", Rloc = "~/local/"){
### Purpose:- Bring library from older R version to newer one.
###   (Idea is to then update the packages that need to be)
### --
### Modified from:- 
### --
### Arguments:- lastR: version of R that has the packages desired
### latestR: latest version of R of interest
### Rloc: where R versions are located (probably not the default)
###Make sure there's a trailing "/"
### --
### Author:-   Patrick Connolly, Date:- 29 May 2014, 11:08
### --
### Revisions:- 22/08/14 fixed mistaken swap of lastR & latestR
### 15/10/15 location of R installions made adjustable
### 7//2017 Rloc changed back to ~/local
  now <- system(paste0("ls ", Rloc, "R-", latestR, "/library"), TRUE)
  was <- system(paste0("ls ", Rloc, "R-", lastR, "/library"), TRUE)
  need <- was[!is.element(was, now)]
### Check if it's already been done
  if(length(need) < 1)
stop("Nothing in R-", lastR, " that isn't already in R-", latestR, ".\n")
  for(i in need) # reason for running this function
system(paste0("cp -prv ", Rloc, "R-", lastR, "/library/", i, " ", Rloc,
  "R-", latestR, "/library/"))
### Notify it's finished and give pastable text to update copied packages 
  cat(length(need), " packages copied into R-", latestR,
  " directory.\nProbably a good idea to start R-", latestR,
  " and run\n  update.packages(checkBuilt = TRUE, ask = FALSE)\n", sep = "")
}



## now save and exit then start in another directory:

>   q()
Save workspace image? [y/n/c]: y

## from the bash prompt
mkdir ~/Temp/Second
cd ~/Temp/Second
emacs &
# start R using M-x R

## Within the *R* buffer
> attach("../First/.RData")
> ls(pos = 2)
[1] "bringLibrary" "repos"

## Then
'M-x
ess-dump-object-into-edit-buffer  bringLibrary ' 

bringLibrary <-
function(lastR = "3.0.2", latestR = "3.1.0", Rloc = "~/local/")
{
### Purpose:- Bring library from older R version to newer one.
###   (Idea is to then update the packages that need to be)
  ...


## but in the *R* buffer all code and comment are there.

> bringLibrary
function(lastR = "3.0.2", latestR = "3.1.0", Rloc = "~/local/")
{
### Purpose:- Bring library from older R version to newer one.
###   (Idea is to then update the packages that need to be)
### --
### Modified from:- 
### --
### Arguments:- lastR: version of R that has the packages desired
### latestR: latest version of R of interest
### Rloc: where R versions are located (probably not the default)
###Make sure there's a trailing "/"
### --
### Author:-   Patrick Connolly, Date:- 29 May 2014, 11:08
### --
### Revisions:- 22/08/14 fixed mistaken swap of lastR & latestR
### 15/10/15 location of R installions made adjustable
### 7//2017 Rloc cchanged back to ~/local
  now <- system(paste0("ls ", Rloc, "R-", latestR, "/library"), TRUE)
  was <- system(paste0("ls ", Rloc, "R-", lastR, "/library"), TRUE)
  need <- was[!is.element(was, now)]
### Check if it's already been done
  if(length(need) < 1)
stop("Nothing in R-", lastR, " that isn't already in R-", latestR, ".\n")
  for(i in need) # reason for running this function
system(paste0("cp -prv ", Rloc, "R-", lastR, "/library/", i, " ", Rloc,
  "R-", latestR, "/library/"))
### Notify it's finished and give pastable text to update copied packages 
  cat(length(need), " packages copied into R-", latestR,
  " directory.\nProbably a good idea to start R-", latestR,
  " and run\n  update.packages(checkBuilt = TRUE, ask = FALSE)\n", sep = "")
}




## Initially this example function was made by 'M-x 
ess-dump-object-into-edit-buffer  bringLibrary ' 
That produced a blank file into which the skeleton function was 
dumped using 'C-c f' which I find very handy.  


In this case it's not very tedious to paste the requisite code into
the edit function buffer, but for longer functions (often found in
packages) if I want to make a local copy to edit, it is very tedious
-- particularly when the comments are all stripped and placed in a

[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 tried and already got the error)
set.seed(1234)
y = abs( rnorm(150) )
glm( y ~ ., iris, family = inverse.gaussian(log) )
You will get this message: 

Error: inner loop 1; cannot correct step size
In addition: Warning message:
step size truncated due to divergence 
 Whom should I talk to about fixing this bug, in some next update of R?
Michail

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
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, minimal, self-contained, reproducible code.


Re: [R] Math kernel library from intel

2018-04-16 Thread Jeff Newmiller
Depends how desperate you are for processing speed and careful you have been 
with optimizing your own algorithms. The default build of R is IMO quite usable 
for many people, and without a doubt many complaints about its speed are 
misdirected and are instead due to poor handling of working memory by the user. 
Such problems usually dwarf the benefit of having an optimized math library.

On April 15, 2018 10:30:43 PM PDT, Partha Sinha  wrote:
>I use win 10 ( 64 bit) with latest R available. Intel has released math
>kernel library. Is it necessary to install for data driven work ?
>Regards
>Partha
>
>   [[alternative HTML version deleted]]
>
>__
>R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
>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, minimal, self-contained, reproducible code.

-- 
Sent from my phone. Please excuse my brevity.

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
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, minimal, self-contained, reproducible code.