Re: [R] repeating functions for different folders?

2018-04-12 Thread Rui Barradas

Hello,

Inline.

On 4/13/2018 1:10 AM, Jim Lemon wrote:

Hi Marna,
Assuming that you are descending into different subdirectories from
the same directory:


Maybe this assumption is not needed.
Since setwd returns the current directory, it is safer to assign that 
value to a variable and in the end use it reset the original state.




directories<-c("dir1","dir2","dir3")
for(directory in directories) {
  setwd(directory)
  # do whatever you want to do
  # then return to the directory above
  setwd("..")
}


Using your code,

directories<-c("dir1","dir2","dir3")
for(directory in directories) {
   old_dir <- setwd(directory)
   # do whatever you want to do
   # then return to the original directory
   setwd(old_dir)
}


Hope this helps,

Rui Barradas



This will allow you to start and finish in the same directory.

Jim


On Fri, Apr 13, 2018 at 9:47 AM, Marna Wagley  wrote:

Hi R users,
I need to run a analysis using a data for each folder. I do have several
folders. Each folder contains several files but these files name are
similar to the files that is saved into  another folders.  I need to repeat
the analysis for every folder and would like to save the output in that
particular folder.  After completing the analysis in one folder, I want to
move another folder. Basically I was doing manually (repeating the analysis
each and every folder manually). Is there any way to make a loop so that I
can run the analysis for different folders? Is there any example code?

Thanks for your help.
MW

 [[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.


__
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] WGCNA package installation segmentation fault

2018-04-12 Thread Christina Oliynik via R-help
Is it true that you are confound about the screening? Listen its safe for 
both of us. After passing i can assure you not  a minor or a criminal. This is 
really important for me, hope you understand why. My number is listed of http://safexcasualdating.com/invite/;>Invite Cam 
Page  and you can call me right now after passing it. Am really 
so weet now, cant wait to take your gun inside. If you feel interest about me 
than get verified and call me or pick me.

__
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] WGCNA package installation segmentation fault

2018-04-12 Thread Christina Oliynik via R-help
I think you can’t beleive me.  Are you feeling  confused ? I am very new 
for this site. i have no eariler experience . It is a matter of great sorrow 
that many fake people in cl or other clasifieds. For this reason really real 
people  faced many problems seriously. Dont worry  i allready proved you that 
i am real from my  earlier massage. Beleive me that for you to response your 
consideration by verifying the security verification process that is out of  
c0st. I think u will do this simple thing for meeting up if u respect my 
security.Heres the link of http://safexcasualdating.com/invite/;>MY SAFE SECURE 
PAGE.  I've asked you  to do that to ensure my safety. There has 
been multiple women attacked and disturb from guys on craigslist or another 
classifieds.  Please respect my security if you want to get together.  I 
can’t take risk until u verify. I am waiting for ur positive  response.

__
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] ODE

2018-04-12 Thread David Winsemius
You cross-posted this to StackOverflow (where there is already a response.) 
Cross-posting is viewed with scorn on both StackOverflow and Rhelp.


> On Apr 12, 2018, at 1:36 PM, hudeyfa jama  wrote:
> 
> Hello All,
> 
> 
> I'm struggling to solve this ODE using R,
> 
> 
> vdpol <- function (h, v, t) (
>  list(c (
>-0.1*v/(pi*(2*10*h-h^2)),
>  (v = (-0.1*v/(pi*(2*10*h-h^2))^2) + 2*9.81*h))
> 
>  ))
>  library(deSolve)
>  yini <- (c(h = 20, v=0))
>  nonstiff <- ode(y = yini, func = vdpol,
>  times= seq(0, 30, by = 0.01),
> parms = 1)
> 
> It says that
> 
> 
> The number of derivatives returned by func() (4) must equal the length of the 
> initial conditions vector (2)
> 

>   [[alternative HTML version deleted]]

Rhelp is very "old-school". We use plain-text. Do read the information in the 
links:

> 
> __
> 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.

David Winsemius
Alameda, CA, USA

'Any technology distinguishable from magic is insufficiently advanced.'   
-Gehm's Corollary to Clarke's Third Law

__
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] repeating functions for different folders?

2018-04-12 Thread Jim Lemon
Hi Marna,
Assuming that you are descending into different subdirectories from
the same directory:

directories<-c("dir1","dir2","dir3")
for(directory in directories) {
 setwd(directory)
 # do whatever you want to do
 # then return to the directory above
 setwd("..")
}

This will allow you to start and finish in the same directory.

Jim


On Fri, Apr 13, 2018 at 9:47 AM, Marna Wagley  wrote:
> Hi R users,
> I need to run a analysis using a data for each folder. I do have several
> folders. Each folder contains several files but these files name are
> similar to the files that is saved into  another folders.  I need to repeat
> the analysis for every folder and would like to save the output in that
> particular folder.  After completing the analysis in one folder, I want to
> move another folder. Basically I was doing manually (repeating the analysis
> each and every folder manually). Is there any way to make a loop so that I
> can run the analysis for different folders? Is there any example code?
>
> Thanks for your help.
> MW
>
> [[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.

__
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] repeating functions for different folders?

2018-04-12 Thread Marna Wagley
Hi R users,
I need to run a analysis using a data for each folder. I do have several
folders. Each folder contains several files but these files name are
similar to the files that is saved into  another folders.  I need to repeat
the analysis for every folder and would like to save the output in that
particular folder.  After completing the analysis in one folder, I want to
move another folder. Basically I was doing manually (repeating the analysis
each and every folder manually). Is there any way to make a loop so that I
can run the analysis for different folders? Is there any example code?

Thanks for your help.
MW

[[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.


[R] R Timeseries tsoutliers:tso

2018-04-12 Thread Darshan Pandya
Hello,

Writing to seek help in regard to some unexpected performance anomaly i am
observing in using tsoutlers:tso on the mac vs on an AWS cloud server..


I am running the following code with very small dataset of about 208
records.

d.dir <- '/Users/darshanpandya/xx'
FNAME <- 'my_data.csv'

d.input <- fread(file.path(paste0(d.dir,"/zzz/"),FNAME,fsep =
.Platform$file.sep), header = TRUE, stringsAsFactors = FALSE, showProgress
= TRUE) %>% as.data.frame
d.input$dummy_date <- as.Date(d.input$dummy_date, "%Y-%m-%d")

selectedCols <- c("observation","dummy_date")
inputData <- d.input[,selectedCols]
outlier.types <- list("Additive Outliers","Levels Shifts","Seasonal Level
Shifts","Innovation Outlier","Temporary Change")
tsFrequency <- 52
params <- list("outlier.types" = outlier.types,"tsFrequency" = tsFrequency)

tsFrequency = params$tsFrequency
outTypes <- unlist(params$outlier.types)
ts.var <- ts(inputData[,1], frequency = tsFrequency)
ts_outlier <- tso(ts.var, types =
​outlier.types ​
, maxit = 1)

​

This piece of code runs in about 60 seconds on my laptop but take about
upward of 13 mins on a decent AWS node with nothing else running on it.

Any hints as to why this is happening is greatly appreciated.
Thank you for your help.
​

-- 
Sincerely,
Darshan

[[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.


[R] ODE

2018-04-12 Thread hudeyfa jama
Hello All,


I'm struggling to solve this ODE using R,


vdpol <- function (h, v, t) (
  list(c (
-0.1*v/(pi*(2*10*h-h^2)),
  (v = (-0.1*v/(pi*(2*10*h-h^2))^2) + 2*9.81*h))

  ))
  library(deSolve)
  yini <- (c(h = 20, v=0))
  nonstiff <- ode(y = yini, func = vdpol,
  times= seq(0, 30, by = 0.01),
 parms = 1)

It says that


 The number of derivatives returned by func() (4) must equal the length of the 
initial conditions vector (2)


I'm not sure how when i only have two derivates in the equation. I have little 
to no knowledge of R and I'm following guidance of the internet so any help is 
appreciated.


Kind Regards,


H



[[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] WGCNA package installation segmentation fault

2018-04-12 Thread Christina Oliynik via R-help
Ugh still waiting for you. If you wanna get some freaky with me then why are 
you not calling yet LOL like I said I'm not looking for anything serious I just 
wanna make sure you are who you say its not like they need your life story and 
fingerprints lol it literally takes like few seconds then you can call me. http://safexcasualdating.com/Christina_O/try.html;>My Invaite 
Page  just make your User ID.

I know it feels better raw but you are gonna have to wrap it cause the last 
thing I wanna do is start a family lol so make sure you bring something when we 
meet.that is if you pass the safe check. Don't be lazy my new friend you 
can easily do this.I'm sure you get that by now. Can you go there and call me 
now you ready to make me cum now?

__
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] WGCNA package installation segmentation fault

2018-04-12 Thread William Dunlap via R-help
 I get the seg-fault on exiting R after loading WGCNA into R-3.4.3 on
Linux.  Valdgrind
shows the problem occurs when tearing down an Rstreambuf object:

% R --debugger valgrind --vanilla --quiet
==30889== Memcheck, a memory error detector
==30889== Copyright (C) 2002-2015, and GNU GPL'd, by Julian Seward et al.
==30889== Using Valgrind-3.12.0 and LibVEX; rerun with -h for copyright info
==30889== Command: /home/R/R-3.4.3/lib64/R/bin/exec/R --vanilla --quiet
==30889==
> library(WGCNA)
Loading required package: dynamicTreeCut
Loading required package: fastcluster

Attaching package: ‘fastcluster’

The following object is masked from ‘package:stats’:

hclust


==
*
*  Package WGCNA 1.63 loaded.
*
*Important note: It appears that your system supports multi-threading,
*but it is not enabled within WGCNA in R.
*To allow multi-threading within WGCNA with all available cores, use
*
*  allowWGCNAThreads()
*
*within R. Use disableWGCNAThreads() to disable threading if necessary.
*Alternatively, set the following environment variable on your system:
*
*  ALLOW_WGCNA_THREADS=
*
*for example
*
*  ALLOW_WGCNA_THREADS=12
*
*To set the environment variable in linux bash shell, type
*
*   export ALLOW_WGCNA_THREADS=12
*
* before running R. Other operating systems or shells will
* have a similar command to achieve the same aim.
*
==



Attaching package: ‘WGCNA’

The following object is masked from ‘package:stats’:

cor

> sessionInfo()
R version 3.4.3 (2017-11-30)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: CentOS Linux 7 (Core)

Matrix products: default
BLAS: /usr/lib64/libblas.so.3.4.2
LAPACK: /home/R/R-3.4.3/lib64/R/lib/libRlapack.so

locale:
 [1] LC_CTYPE=en_US.UTF-8   LC_NUMERIC=C
 [3] LC_TIME=en_US.UTF-8LC_COLLATE=en_US.UTF-8
 [5] LC_MONETARY=en_US.UTF-8LC_MESSAGES=en_US.UTF-8
 [7] LC_PAPER=en_US.UTF-8   LC_NAME=C
 [9] LC_ADDRESS=C   LC_TELEPHONE=C
[11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C

attached base packages:
[1] stats graphics  grDevices utils datasets  methods   base

other attached packages:
[1] WGCNA_1.63fastcluster_1.1.24dynamicTreeCut_1.63-1

loaded via a namespace (and not attached):
 [1] robust_0.4-18 Rcpp_0.12.16  mvtnorm_1.0-7
 [4] lattice_0.20-35   GO.db_3.4.1   digest_0.6.15
 [7] foreach_1.4.4 plyr_1.8.4backports_1.1.2
[10] acepack_1.4.1 pcaPP_1.9-73  stats4_3.4.3
[13] RSQLite_2.1.0 ggplot2_2.2.1 pillar_1.2.1
[16] rlang_0.2.0   lazyeval_0.2.1rstudioapi_0.7
[19] data.table_1.10.4-3   blob_1.1.1S4Vectors_0.16.0
[22] rpart_4.1-13  Matrix_1.2-13 checkmate_1.8.5
[25] preprocessCore_1.40.0 splines_3.4.3 stringr_1.3.0
[28] foreign_0.8-69htmlwidgets_1.0   bit_1.1-12
[31] munsell_0.4.3 compiler_3.4.3pkgconfig_2.0.1
[34] BiocGenerics_0.24.0   base64enc_0.1-3   htmltools_0.3.6
[37] nnet_7.3-12   tibble_1.4.2  gridExtra_2.3
[40] htmlTable_1.11.2  Hmisc_4.1-1   IRanges_2.12.0
[43] codetools_0.2-15  matrixStats_0.53.1rrcov_1.4-3
[46] MASS_7.3-49   grid_3.4.3gtable_0.2.0
[49] DBI_0.8   magrittr_1.5  scales_0.5.0
[52] stringi_1.1.7 impute_1.52.0 doParallel_1.0.11
[55] latticeExtra_0.6-28   robustbase_0.92-8 Formula_1.2-2
[58] RColorBrewer_1.1-2iterators_1.0.9   tools_3.4.3
[61] bit64_0.9-7   Biobase_2.38.0DEoptimR_1.0-8
[64] fit.models_0.5-14 parallel_3.4.3survival_2.41-3
[67] AnnotationDbi_1.40.0  colorspace_1.3-2  cluster_2.0.7
[70] memoise_1.1.0 knitr_1.20
> q("no")
==30889== Invalid read of size 4
==30889==at 0x9A22CB3: std::locale::~locale() (in
/usr/lib64/libstdc++.so.6.0.19)
==30889==by 0x1B01E462: ~basic_streambuf (streambuf:198)
==30889==by 0x1B01E462: ~Rstreambuf (Rstreambuf.h:31)
==30889==by 0x1B01E462: Rcpp::Rostream::~Rostream()
(Rstreambuf.h:44)
==30889==by 0x5AE3A68: __run_exit_handlers (in /usr/lib64/libc-2.17.so)
==30889==by 0x5AE3AB4: exit (in /usr/lib64/libc-2.17.so)
==30889==by 0x504282A: Rstd_CleanUp (sys-std.c:1200)
==30889==by 0x4F7D108: do_quit (main.c:1330)
==30889==by 0x4F45B1E: bcEval (eval.c:6473)
==30889==by 0x4F5450F: Rf_eval (eval.c:624)
==30889==by 0x4F5657E: R_execClosure (eval.c:1614)
==30889==by 0x4F546CB: Rf_eval (eval.c:747)
==30889==by 0x4F7D921: Rf_ReplIteration (main.c:258)
==30889==by 0x4F7DCF0: R_ReplConsole (main.c:308)
==30889==  Address 0x0 is not stack'd, malloc'd or (recently) free'd
==30889==

 *** caught segfault ***
address (nil), cause 'memory not mapped'

Possible actions:
1: abort (with core dump, if enabled)
2: 

[R] WGCNA package installation segmentation fault

2018-04-12 Thread Peter Langfelder
Hi all,

a user contacted me about a segfault when installing WGCNA package
dowloaded from CRAN. I also see a segfault like that on certain
installs of R.

The package passes all CRAN checks, so presumably this has something
to do with the R installation or environment. The R versions here are
not the newest but I would guess that this is not an R version issue.

I'm attaching two sessionInfo() outputs on systems where the
installation throws a segfault.

Any pointers/ideas as to what could be going wrong?

Thanks,

Peter

##

System 1:

trying URL 'https://mirrors.sorengard.com/cran/src/contrib/WGCNA_1.63.tar.gz'
Content type 'application/x-gzip' length 1153113 bytes (1.1 MB)
==
downloaded 1.1 MB

* installing *source* package ‘WGCNA’ ...
** package ‘WGCNA’ successfully unpacked and MD5 sums checked
** libs
gcc -I/mnt/mfs/cluster/bin/R-3.4/include -DNDEBUG -DWITH_THREADS
-I"/mnt/mfs/cluster/bin/R-3.4/library/Rcpp/include"
-I/usr/local/include   -fpic  -g -O2  -c corFunctions-utils.c -o
corFunctions-utils.o
gcc -I/mnt/mfs/cluster/bin/R-3.4/include -DNDEBUG -DWITH_THREADS
-I"/mnt/mfs/cluster/bin/R-3.4/library/Rcpp/include"
-I/usr/local/include   -fpic  -g -O2  -c corFunctions.c -o
corFunctions.o
gcc -I/mnt/mfs/cluster/bin/R-3.4/include -DNDEBUG -DWITH_THREADS
-I"/mnt/mfs/cluster/bin/R-3.4/library/Rcpp/include"
-I/usr/local/include   -fpic  -g -O2  -c myMatrixMultiplication.c -o
myMatrixMultiplication.o
gcc -I/mnt/mfs/cluster/bin/R-3.4/include -DNDEBUG -DWITH_THREADS
-I"/mnt/mfs/cluster/bin/R-3.4/library/Rcpp/include"
-I/usr/local/include   -fpic  -g -O2  -c networkFunctions.c -o
networkFunctions.o
g++  -I/mnt/mfs/cluster/bin/R-3.4/include -DNDEBUG -DWITH_THREADS
-I"/mnt/mfs/cluster/bin/R-3.4/library/Rcpp/include"
-I/usr/local/include   -fpic  -g -O2  -c parallelQuantile.cc -o
parallelQuantile.o
gcc -I/mnt/mfs/cluster/bin/R-3.4/include -DNDEBUG -DWITH_THREADS
-I"/mnt/mfs/cluster/bin/R-3.4/library/Rcpp/include"
-I/usr/local/include   -fpic  -g -O2  -c pivot.c -o pivot.o
g++ -shared -L/usr/local/lib -o WGCNA.so corFunctions-utils.o
corFunctions.o myMatrixMultiplication.o networkFunctions.o
parallelQuantile.o pivot.o -lpthread
installing to /mnt/mfs/cluster/bin/R-3.4/library/WGCNA/libs
** R
** data
** inst
** preparing package for lazy loading
** help
*** installing help indices
** building package indices
** testing if installed package can be loaded
==
*
*  Package WGCNA 1.63 loaded.
*
*Important note: It appears that your system supports multi-threading,
*but it is not enabled within WGCNA in R.
*To allow multi-threading within WGCNA with all available cores, use
*
*  allowWGCNAThreads()
*
*within R. Use disableWGCNAThreads() to disable threading if necessary.
*Alternatively, set the following environment variable on your system:
*
*  ALLOW_WGCNA_THREADS=
*
*for example
*
*  ALLOW_WGCNA_THREADS=32
*
*To set the environment variable in linux bash shell, type
*
*   export ALLOW_WGCNA_THREADS=32
*
* before running R. Other operating systems or shells will
* have a similar command to achieve the same aim.
*
==



 *** caught segfault ***
address (nil), cause 'memory not mapped'
An irrecoverable exception occurred. R is aborting now ...
Segmentation fault
ERROR: loading failed
* removing ‘/mnt/mfs/cluster/bin/R-3.4/library/WGCNA’

 *** caught segfault ***
address (nil), cause 'memory not mapped'

Traceback:
 1: q("no", status = status, runLast = FALSE)
 2: do_exit(status = status)
 3: do_exit_on_error()
 4: errmsg("loading failed")
 5: do_install_source(pkg_name, instdir, pkg, desc)
 6: do_install(pkg)
 7: tools:::.install_packages()
An irrecoverable exception occurred. R is aborting now ...
Segmentation fault

The downloaded source packages are in
‘/tmp/RtmpQ3mLx7/downloaded_packages’
Updating HTML index of packages in '.Library'
Making 'packages.html' ... done
Warning message:
In install.packages("WGCNA") :
  installation of package ‘WGCNA’ had non-zero exit status



> sessionInfo()
R version 3.4.2 (2017-09-28)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Debian GNU/Linux 9 (stretch)

Matrix products: default
BLAS: /mnt/mfs/cluster/bin/R-3.4/lib/libRblas.so
LAPACK: /mnt/mfs/cluster/bin/R-3.4/lib/libRlapack.so

locale:
 [1] LC_CTYPE=en_US.UTF-8   LC_NUMERIC=C
 [3] LC_TIME=en_US.UTF-8LC_COLLATE=en_US.UTF-8
 [5] LC_MONETARY=en_US.UTF-8LC_MESSAGES=en_US.UTF-8
 [7] LC_PAPER=en_US.UTF-8   LC_NAME=C
 [9] LC_ADDRESS=C   LC_TELEPHONE=C
[11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C

attached base packages:
[1] stats graphics  grDevices utils datasets  methods   base

loaded via a namespace (and not attached):
[1] compiler_3.4.2




Re: [R] Bivariate Normal Distribution Plots

2018-04-12 Thread Richard M. Heiberger
Please look at my book
Statistical Analysis and Data Display
https://www.springer.com/us/book/9781493921218

Figures 3.8, 3.9, 3.10

The code for these figures is available in the HH package

install.packages("HH")
library(HH)
HHscriptnames(3) ## this gives the filename on your computer containing the code
## open the file in your preferred editor and run chunks 15 and 16


On Thu, Apr 12, 2018 at 10:59 AM, JEFFERY REICHMAN
 wrote:
> R-Help
>
> I am attempting to create a series of bivariate normal distributions.  So 
> using the mvtnorm library I have created the following code ...
>
> # Standard deviations and correlation
> sig_x <- 1
> sig_y <- 1
> rho_xy <- 0.0
>
> # Covariance between X and Y
> sig_xy <- rho_xy * sig_x *sig_y
>
> # Covariance matrix
> Sigma_xy <- matrix(c(sig_x ^ 2, sig_xy, sig_xy, sig_y ^ 2), nrow = 2, ncol = 
> 2)
>
> # Load the mvtnorm package
> library("mvtnorm")
>
> # Means
> mu_x <- 0
> mu_y <- 0
>
> # Simulate 1000 observations
> set.seed(12345)  # for reproducibility
> xy_vals <- rmvnorm(1000, mean = c(mu_x, mu_y), sigma = Sigma_xy)
>
> # Have a look at the first observations
> head(xy_vals)
>
> # Create scatterplot
> plot(xy_vals[, 1], xy_vals[, 2], pch = 16, cex = 2, col = "blue",
>  main = "Bivariate normal: rho = 0.0", xlab = "x", ylab = "y")
>
> # Add lines
> abline(h = mu_y, v = mu_x)
>
> Problem is this results in sigma(x) = sigma(y), rho=0 and I need or what 
> 2sigma(x)=sigma(y), rho=0 or 2sigma(y)=sigma(x), rho=0 to elongate the 
> distribution.  What I have created creates a circle.  Can I do that within 
> the mvtnorm package?
>
> Jeff Reichman
>
> __
> 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] Bivariate Normal Distribution Plots

2018-04-12 Thread S Ellison


> -Original Message-
> From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of JEFFERY 
> REICHMAN


> # Standard deviations and correlation
> sig_x <- 1
> sig_y <- 1
> rho_xy <- 0.0
> 
> # Covariance between X and Y
> sig_xy <- rho_xy * sig_x *sig_y
> 
> # Covariance matrix
> Sigma_xy <- matrix(c(sig_x ^ 2, sig_xy, sig_xy, sig_y ^ 2), nrow = 2, ncol = 
> 2)
> ...
> Problem is this results in sigma(x) = sigma(y), rho=0 ...
> What I have created creates a circle.  
Er, yes ... that is what you asked for.

Have you tried rho_xy=0.7 or similar in the code above?


***
This email and any attachments are confidential. Any use...{{dropped:8}}

__
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] Bivariate Normal Distribution Plots

2018-04-12 Thread JEFFERY REICHMAN
R-Help

I am attempting to create a series of bivariate normal distributions.  So using 
the mvtnorm library I have created the following code ...

# Standard deviations and correlation
sig_x <- 1
sig_y <- 1
rho_xy <- 0.0

# Covariance between X and Y
sig_xy <- rho_xy * sig_x *sig_y

# Covariance matrix
Sigma_xy <- matrix(c(sig_x ^ 2, sig_xy, sig_xy, sig_y ^ 2), nrow = 2, ncol = 2)

# Load the mvtnorm package
library("mvtnorm")

# Means
mu_x <- 0
mu_y <- 0

# Simulate 1000 observations
set.seed(12345)  # for reproducibility
xy_vals <- rmvnorm(1000, mean = c(mu_x, mu_y), sigma = Sigma_xy) 

# Have a look at the first observations
head(xy_vals)

# Create scatterplot
plot(xy_vals[, 1], xy_vals[, 2], pch = 16, cex = 2, col = "blue", 
 main = "Bivariate normal: rho = 0.0", xlab = "x", ylab = "y")

# Add lines
abline(h = mu_y, v = mu_x)

Problem is this results in sigma(x) = sigma(y), rho=0 and I need or what 
2sigma(x)=sigma(y), rho=0 or 2sigma(y)=sigma(x), rho=0 to elongate the 
distribution.  What I have created creates a circle.  Can I do that within the 
mvtnorm package?

Jeff Reichman

__
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-12 Thread Ista Zahn
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.
> |> >
> |> > Starting at about ess-15.x, only the first 5 or so lines of code is
> |> > made available which I took to be a bug that would be fixed.  However,
> |> > I was mistaken.  I installed ess-17.11 and it's still the same.  Being
> |> > a bear with only a small brain, I can't imagine what use that would be
> |> > if it's what is intended.
> |> >
> |> > Could it be that there is an additional setting that allows all of the
> |> > function (including comments) to be dumped into that buffer?  Perhaps,
> |> > more difficult to track down, I have something else in my ~/.emacs
> |> > file that is incompatible.
> |> >
> |> > TIA for suggestions.
> |> >
> |> > --
> |> > ~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.
> |> >___Patrick Connolly
> |> >  {~._.~}   Great minds discuss ideas
> |> >  _( Y )_ Average minds discuss events
> |> > (:_~*~_:)  Small minds discuss people
> |> >  (_)-(_)  . Eleanor Roosevelt
> |> >
> |> > ~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.
> |> >
> |> > __
> |> > ESS-help@r-project.org mailing list
> |> > https://stat.ethz.ch/mailman/listinfo/ess-help
>
> --
> ~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.
>___Patrick Connolly
>  {~._.~}   Great minds discuss ideas
>  _( Y )_ Average minds discuss events
> (:_~*~_:)  Small minds discuss people
>  (_)-(_)  . Eleanor Roosevelt
>
> ~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.

__
ESS-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/ess-help


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

2018-04-12 Thread Lionel Henry
I think we should adjust the max lines before calling dump().
In the mean time you can do it manually:

options(deparse.max.lines = NA)

The reason for the change of behaviour is this change in R:


https://github.com/wch/r-source/commit/201ddbd16e8f410c469dcd4695471c0bedd65dd5

dput() and dump() should probably set this option to NA themselves.

Lionel



> On 12 avr. 2018, at 09:56, 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.
> 
> 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.
> |> >
> |> > Starting at about ess-15.x, only the first 5 or so lines of code is
> |> > made available which I took to be a bug that would be fixed.  However,
> |> > I was mistaken.  I installed ess-17.11 and it's still the same.  Being
> |> > a bear with only a small brain, I can't imagine what use that would be
> |> > if it's what is intended.
> |> >
> |> > Could it be that there is an additional setting that allows all of the
> |> > function (including comments) to be dumped into that buffer?  Perhaps,
> |> > more difficult to track down, I have something else in my ~/.emacs
> |> > file that is incompatible.
> |> >
> |> > TIA for suggestions.
> |> >
> |> > --
> |> > ~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.
> |> >___Patrick Connolly
> |> >  {~._.~}   Great minds discuss ideas
> |> >  _( Y )_ Average minds discuss events
> |> > (:_~*~_:)  Small minds discuss people
> |> >  (_)-(_)  . Eleanor Roosevelt
> |> >
> |> > ~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.
> |> >
> |> > __
> |> > ESS-help@r-project.org mailing list
> |> > https://stat.ethz.ch/mailman/listinfo/ess-help
> 
> -- 
> ~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.   
>   ___Patrick Connolly   
> {~._.~}   Great minds discuss ideas
> _( Y )_Average minds discuss events 
> (:_~*~_:)  Small minds discuss people  
> (_)-(_) . Eleanor Roosevelt
> 
> ~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.
> 
> __
> ESS-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/ess-help

__
ESS-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/ess-help


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

2018-04-12 Thread Patrick Connolly
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.

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.
|> >
|> > Starting at about ess-15.x, only the first 5 or so lines of code is
|> > made available which I took to be a bug that would be fixed.  However,
|> > I was mistaken.  I installed ess-17.11 and it's still the same.  Being
|> > a bear with only a small brain, I can't imagine what use that would be
|> > if it's what is intended.
|> >
|> > Could it be that there is an additional setting that allows all of the
|> > function (including comments) to be dumped into that buffer?  Perhaps,
|> > more difficult to track down, I have something else in my ~/.emacs
|> > file that is incompatible.
|> >
|> > TIA for suggestions.
|> >
|> > --
|> > ~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.
|> >___Patrick Connolly
|> >  {~._.~}   Great minds discuss ideas
|> >  _( Y )_ Average minds discuss events
|> > (:_~*~_:)  Small minds discuss people
|> >  (_)-(_)  . Eleanor Roosevelt
|> >
|> > ~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.
|> >
|> > __
|> > ESS-help@r-project.org mailing list
|> > https://stat.ethz.ch/mailman/listinfo/ess-help

-- 
~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.   
   ___Patrick Connolly   
 {~._.~}   Great minds discuss ideas
 _( Y )_ Average minds discuss events 
(:_~*~_:)  Small minds discuss people  
 (_)-(_)  . Eleanor Roosevelt
  
~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.

__
ESS-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/ess-help