Re: [R] Can't resolve dependency problems with package "sem"

2016-05-04 Thread Jeff Newmiller
An old version of R would be fine if that was all you wanted, but no, you want 
all the latest contributed packages as well. I can't blame you for that, but 
don't blame R for difficulties with contributed packages that have external 
dependencies and depend on recent versions of R.

You might find

http://trestletech.com/2012/10/install-rgl-in-ubuntu/

helpful with your RGL package issue. 

I very rarely configure/compile since apt is so powerful. IMHO you should 
always start with apt on Debian derivatives before falling back to compiling. 
-- 
Sent from my phone. Please excuse my brevity.

On May 4, 2016 7:06:24 PM PDT, "C&A Säger"  wrote:
>Am 05.05.2016 um 01:41 schrieb Jeff Newmiller:
>> Did you follow the instructions for setting up apt to pull recent
>> versions of R, as described in CRAN? I suspect not, since your
>version
>> is old.
>> -- 
>
>Hello Jeff,
>
>Thank you very much for taking notice.
>
>I was hoping that any old version which used to be the best of breed 3
>years ago would be just fine for absolute beginners.
>I did not even know that CRAN exists until I actually installed the
>software. I use Ubuntu because compiling software is a major annoyance
>to me. Since 2002 I use to compile something every now and then when it
>is the only way to get something installed.
>
>Right now I try to follow the R installation guide carefully but dumb
>because I don't really understand what I'm doing. configure, make, make
>check, everything runs OK so far but sudo make install fails anyway.
>What a horrible waste of time and electricity!
>
>Actually, I'm trying to help my daughter who needs to learn some R
>basics. The installation on a Windows PC is a matter of minutes by
>following a tiny instructional PDF from her tutor. But she does not
>have
>the time nor knowledge to install R successfully on her Ubuntu PC which
>is the same as mine. While she has some real work to do, I'm trying to
>get this darn thing onto our computers. Even if I manage to compile a
>working R program on my computer, this will not be of any help for my
>daughter who does not have the compilers installed and I don't know
>which packages make it happen on my PC. I'd have to build my first
>Debian package which might take another day of reading and testing.
>
>[...]
>
>Meanwhile the installation of R out of debian packages from a CRAN
>server did the job and I managed to ...
>
>>  install.packages("Rcmdr",dependencies=TRUE)
>
>... which finished with ...
>
>> ** testing if installed package can be loaded
>> * DONE (Rcmdr)
>
>... but also with warnings ...
>
>> 1: In install.packages("Rcmdr", dependencies = TRUE) :
>>   Installation des Pakets ‘rgl’ hatte Exit-Status ungleich 0
>> 2: In install.packages("Rcmdr", dependencies = TRUE) :
>>   Installation des Pakets ‘rglwidget’ hatte Exit-Status ungleich 0
>
>.. due to these errors:
>
>> configure: error: missing required header GL/gl.h
>> ERROR: configuration failed for package ‘rgl’
>
>> ERROR: dependency ‘rgl’ is not available for package ‘rglwidget’
>
>
>Thank you very much for the pointer to this instructive page:
>
>> http://ftp5.gwdg.de/pub/misc/cran/
>
>May be we can live without GL support for now.
>
>Greetings,
>Andreas

[[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] Can't resolve dependency problems with package "sem"

2016-05-04 Thread C&A Säger
Am 05.05.2016 um 01:41 schrieb Jeff Newmiller:
> Did you follow the instructions for setting up apt to pull recent
> versions of R, as described in CRAN? I suspect not, since your version
> is old.
> -- 

Hello Jeff,

Thank you very much for taking notice.

I was hoping that any old version which used to be the best of breed 3
years ago would be just fine for absolute beginners.
I did not even know that CRAN exists until I actually installed the
software. I use Ubuntu because compiling software is a major annoyance
to me. Since 2002 I use to compile something every now and then when it
is the only way to get something installed.

Right now I try to follow the R installation guide carefully but dumb
because I don't really understand what I'm doing. configure, make, make
check, everything runs OK so far but sudo make install fails anyway.
What a horrible waste of time and electricity!

Actually, I'm trying to help my daughter who needs to learn some R
basics. The installation on a Windows PC is a matter of minutes by
following a tiny instructional PDF from her tutor. But she does not have
the time nor knowledge to install R successfully on her Ubuntu PC which
is the same as mine. While she has some real work to do, I'm trying to
get this darn thing onto our computers. Even if I manage to compile a
working R program on my computer, this will not be of any help for my
daughter who does not have the compilers installed and I don't know
which packages make it happen on my PC. I'd have to build my first
Debian package which might take another day of reading and testing.

[...]

Meanwhile the installation of R out of debian packages from a CRAN
server did the job and I managed to ...

>  install.packages("Rcmdr",dependencies=TRUE)

... which finished with ...

> ** testing if installed package can be loaded
> * DONE (Rcmdr)

... but also with warnings ...

> 1: In install.packages("Rcmdr", dependencies = TRUE) :
>   Installation des Pakets ‘rgl’ hatte Exit-Status ungleich 0
> 2: In install.packages("Rcmdr", dependencies = TRUE) :
>   Installation des Pakets ‘rglwidget’ hatte Exit-Status ungleich 0

.. due to these errors:

> configure: error: missing required header GL/gl.h
> ERROR: configuration failed for package ‘rgl’

> ERROR: dependency ‘rgl’ is not available for package ‘rglwidget’


Thank you very much for the pointer to this instructive page:

> http://ftp5.gwdg.de/pub/misc/cran/

May be we can live without GL support for now.

Greetings,
Andreas

__
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] Can't resolve dependency problems with package "sem"

2016-05-04 Thread Fox, John
Dear Andreas,

As has been suggested, you're probably better off using an up-to-date version 
of R and corresponding up-to-date packages, but if the only issue is that sem 
can't be installed, the Rcmdr package should still work. The menu item for 
confirmatory factor analysis will be missing, and unless you tell it to 
suppress checking for missing packages on start-up, the Rcmdr will continue to 
ask you whether you want to install the sem package, but everything else should 
work.

To suppress the start-up package check, issue the R command 
options(Rcmdr=list(check.packages=FALSE)) before library(Rcmdr).

I hope this helps,
 John

---
John Fox, Professor
McMaster University
Hamilton, Ontario, Canada
http://socserv.socsci.mcmaster.ca/jfox/



> -Original Message-
> From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of C&A
> Säger
> Sent: Wednesday, May 4, 2016 8:28 PM
> To: Jim Lemon; r-help@r-project.org
> Subject: Re: [R] Can't resolve dependency problems with package "sem"
> 
> Am 05.05.2016 um 00:17 schrieb Jim Lemon:
> > Hi Andreas,
> > Try installing plyr, arm, scales and mi separately. If you get an
> > error message about a version mismatch, that's where your problem is.
> > _Sometimes_ upgrading R will fix it, if the problem is that the
> > version you are downloading is too new for your R version.
> >
> > Jim
> >
> 
> Hello Jim,
> 
> Indeed, this might be the problem. When I try to install plyr, I get
> something like this:
> "Package xxx is not availlable (not for this version 3.0.x)"
> 
> I was hoping that any old version from the Ubuntu repositories would be
> good enough for an absolute beginner.
> 
> Thank you very much,
> Andreas
> __
> 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] Can't resolve dependency problems with package "sem"

2016-05-04 Thread C&A Säger
Am 05.05.2016 um 00:17 schrieb Jim Lemon:
> Hi Andreas,
> Try installing plyr, arm, scales and mi separately. If you get an
> error message about a version mismatch, that's where your problem is.
> _Sometimes_ upgrading R will fix it, if the problem is that the
> version you are downloading is too new for your R version.
> 
> Jim
> 

Hello Jim,

Indeed, this might be the problem. When I try to install plyr, I get
something like this:
"Package xxx is not availlable (not for this version 3.0.x)"

I was hoping that any old version from the Ubuntu repositories would be
good enough for an absolute beginner.

Thank you very much,
Andreas
__
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] Can't resolve dependency problems with package "sem"

2016-05-04 Thread Jeff Newmiller
Did you follow the instructions for setting up apt to pull recent versions of 
R, as described in CRAN? I suspect not, since your version is old. 
-- 
Sent from my phone. Please excuse my brevity.

On May 4, 2016 11:51:27 AM PDT, "C&A Säger"  wrote:
>Hello,
>
>First time user on Ubuntu 14.4 with Ubuntus R Commander and
>
>> $ R --version
>> R version 3.0.2 (2013-09-25) -- "Frisbee Sailing"
>> Copyright (C) 2013 The R Foundation for Statistical Computing
>> Platform: x86_64-pc-linux-gnu (64-bit)
>
>The program icon of the commander executes
>
>> sh -c 'R_DEFAULT_PACKAGES="$R_DEFAULT_PACKAGES Rcmdr" R "$@"'
>
>On first run it started downloading, compiling and installing various
>packages. One of them fails:
>
>> 
>>> install.packages("sem",dependencies=TRUE)
>> Installing package into
>‘/home/andreas/R/x86_64-pc-linux-gnu-library/3.0’
>> (as ‘lib’ is unspecified)
>> Warnung: dependencies ‘MBESS’, ‘arm’, ‘plyr’ are not available
>> also installing the dependencies ‘scales’, ‘mi’, ‘DiagrammeR’
>> 
>> versuche URL
>'http://ftp5.gwdg.de/pub/misc/cran/src/contrib/scales_0.4.0.tar.gz'
>> Content type 'application/x-gzip' length 57358 bytes (56 Kb)
>> URL geöffnet
>> ==
>> downloaded 56 Kb
>> 
>> versuche URL
>'http://ftp5.gwdg.de/pub/misc/cran/src/contrib/mi_1.0.tar.gz'
>> Content type 'application/x-gzip' length 793313 bytes (774 Kb)
>> URL geöffnet
>> ==
>> downloaded 774 Kb
>> 
>> versuche URL
>'http://ftp5.gwdg.de/pub/misc/cran/src/contrib/DiagrammeR_0.8.2.tar.gz'
>> Content type 'application/x-gzip' length 3532835 bytes (3.4 Mb)
>> URL geöffnet
>> ==
>> downloaded 3.4 Mb
>> 
>> versuche URL
>'http://ftp5.gwdg.de/pub/misc/cran/src/contrib/sem_3.1-7.tar.gz'
>> Content type 'application/x-gzip' length 154654 bytes (151 Kb)
>> URL geöffnet
>> ==
>> downloaded 151 Kb
>> 
>> ERROR: dependency ‘plyr’ is not available for package ‘scales’
>> * removing ‘/home/andreas/R/x86_64-pc-linux-gnu-library/3.0/scales’
>> ERROR: dependency ‘arm’ is not available for package ‘mi’
>> * removing ‘/home/andreas/R/x86_64-pc-linux-gnu-library/3.0/mi’
>> ERROR: dependency ‘scales’ is not available for package ‘DiagrammeR’
>> * removing
>‘/home/andreas/R/x86_64-pc-linux-gnu-library/3.0/DiagrammeR’
>> ERROR: dependency ‘mi’ is not available for package ‘sem’
>> * removing ‘/home/andreas/R/x86_64-pc-linux-gnu-library/3.0/sem’
>> 
>> Die heruntergeladenen Quellpakete sind in
>> ‘/tmp/RtmplEqHDo/downloaded_packages’
>> Warnmeldungen:
>> 1: In install.packages("sem", dependencies = TRUE) :
>> Installation des Pakets ‘scales’ hatte Exit-Status ungleich 0
>> 2: In install.packages("sem", dependencies = TRUE) :
>> Installation des Pakets ‘mi’ hatte Exit-Status ungleich 0
>> 3: In install.packages("sem", dependencies = TRUE) :
>> Installation des Pakets ‘DiagrammeR’ hatte Exit-Status ungleich 0
>> 4: In install.packages("sem", dependencies = TRUE) :
>> Installation des Pakets ‘sem’ hatte Exit-Status ungleich 0
>
>How can I resolve the dependencies?
>Should I replace the Ubuntu version with something fresh?
>
>Thanks in advance,
>Andreas
>__
>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] Can't resolve dependency problems with package "sem"

2016-05-04 Thread Jim Lemon
Hi Andreas,
Try installing plyr, arm, scales and mi separately. If you get an
error message about a version mismatch, that's where your problem is.
_Sometimes_ upgrading R will fix it, if the problem is that the
version you are downloading is too new for your R version.

Jim

On Thu, May 5, 2016 at 4:51 AM, C&A Säger  wrote:
> Hello,
>
> First time user on Ubuntu 14.4 with Ubuntus R Commander and
>
>> $ R --version
>> R version 3.0.2 (2013-09-25) -- "Frisbee Sailing"
>> Copyright (C) 2013 The R Foundation for Statistical Computing
>> Platform: x86_64-pc-linux-gnu (64-bit)
>
> The program icon of the commander executes
>
>> sh -c 'R_DEFAULT_PACKAGES="$R_DEFAULT_PACKAGES Rcmdr" R "$@"'
>
> On first run it started downloading, compiling and installing various
> packages. One of them fails:
>
>>
>>> install.packages("sem",dependencies=TRUE)
>> Installing package into ‘/home/andreas/R/x86_64-pc-linux-gnu-library/3.0’
>> (as ‘lib’ is unspecified)
>> Warnung: dependencies ‘MBESS’, ‘arm’, ‘plyr’ are not available
>> also installing the dependencies ‘scales’, ‘mi’, ‘DiagrammeR’
>>
>> versuche URL 
>> 'http://ftp5.gwdg.de/pub/misc/cran/src/contrib/scales_0.4.0.tar.gz'
>> Content type 'application/x-gzip' length 57358 bytes (56 Kb)
>> URL geöffnet
>> ==
>> downloaded 56 Kb
>>
>> versuche URL 'http://ftp5.gwdg.de/pub/misc/cran/src/contrib/mi_1.0.tar.gz'
>> Content type 'application/x-gzip' length 793313 bytes (774 Kb)
>> URL geöffnet
>> ==
>> downloaded 774 Kb
>>
>> versuche URL 
>> 'http://ftp5.gwdg.de/pub/misc/cran/src/contrib/DiagrammeR_0.8.2.tar.gz'
>> Content type 'application/x-gzip' length 3532835 bytes (3.4 Mb)
>> URL geöffnet
>> ==
>> downloaded 3.4 Mb
>>
>> versuche URL 'http://ftp5.gwdg.de/pub/misc/cran/src/contrib/sem_3.1-7.tar.gz'
>> Content type 'application/x-gzip' length 154654 bytes (151 Kb)
>> URL geöffnet
>> ==
>> downloaded 151 Kb
>>
>> ERROR: dependency ‘plyr’ is not available for package ‘scales’
>> * removing ‘/home/andreas/R/x86_64-pc-linux-gnu-library/3.0/scales’
>> ERROR: dependency ‘arm’ is not available for package ‘mi’
>> * removing ‘/home/andreas/R/x86_64-pc-linux-gnu-library/3.0/mi’
>> ERROR: dependency ‘scales’ is not available for package ‘DiagrammeR’
>> * removing ‘/home/andreas/R/x86_64-pc-linux-gnu-library/3.0/DiagrammeR’
>> ERROR: dependency ‘mi’ is not available for package ‘sem’
>> * removing ‘/home/andreas/R/x86_64-pc-linux-gnu-library/3.0/sem’
>>
>> Die heruntergeladenen Quellpakete sind in
>> ‘/tmp/RtmplEqHDo/downloaded_packages’
>> Warnmeldungen:
>> 1: In install.packages("sem", dependencies = TRUE) :
>> Installation des Pakets ‘scales’ hatte Exit-Status ungleich 0
>> 2: In install.packages("sem", dependencies = TRUE) :
>> Installation des Pakets ‘mi’ hatte Exit-Status ungleich 0
>> 3: In install.packages("sem", dependencies = TRUE) :
>> Installation des Pakets ‘DiagrammeR’ hatte Exit-Status ungleich 0
>> 4: In install.packages("sem", dependencies = TRUE) :
>> Installation des Pakets ‘sem’ hatte Exit-Status ungleich 0
>
> How can I resolve the dependencies?
> Should I replace the Ubuntu version with something fresh?
>
> Thanks in advance,
> Andreas
> __
> 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] Changing transformations in mi package

2016-05-04 Thread David L Carlson
Thank you for providing a working example. I think you need to contact the 
package maintainer:

> maintainer("mi")
[1] "Ben Goodrich "

When I run your code it appears that the c column is correctly transformed to 
square roots, but the show() function is incorrectly indicating a log transform:

> data.missingdf@variables$c@raw_data # The raw data
[1]  4.2  7.9   NA 16.1 19.9 23.0
> sqrt(data.missingdf@variables$c@raw_data) # The square root of the raw data
[1] 2.049390 2.810694   NA 4.012481 4.460942 4.795832
> data.missingdf@variables$c@data # The transformed data - square roots, not 
> logs
[1] 2.049390 2.810694   NA 4.012481 4.460942 4.795832

-
David L Carlson
Department of Anthropology
Texas A&M University
College Station, TX 77840-4352



-Original Message-
From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of Elizabeth Hensor
Sent: Wednesday, May 4, 2016 5:44 AM
To: 'r-help@r-project.org'
Subject: [R] Changing transformations in mi package

Dear all,
I am an R beginner and new to the list. In preparation for using mi to impute 
missing values I am setting up the missing data frame and would like to specify 
the transformation types for some of my variables, as I will be using these 
transformations in my analysis models. According to the documentation the 
available options are "standardize" (the default), "identity", "log", 
"logshift" and "sqrt". I can successfully change the transformation types to 
"log" and "logshift", but when I attempt to change to "sqrt", this changes the 
type to "log" instead. I'd appreciate your help, please.
Below are details of my system and some code which replicates the issue.

> sessionInfo()
R version 3.2.5 (2016-04-14)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 7 x64 (build 7601) Service Pack 1

locale:
[1] LC_COLLATE=English_United Kingdom.1252  LC_CTYPE=English_United 
Kingdom.1252   
[3] LC_MONETARY=English_United Kingdom.1252 LC_NUMERIC=C
   
[5] LC_TIME=English_United Kingdom.1252

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

other attached packages:
[1] lmerTest_2.0-30 truncnorm_1.0-7 mi_1.0  lme4_1.1-12 
Matrix_1.2-4   
[6] pls_2.5-0  

loaded via a namespace (and not attached):
 [1] Rcpp_0.12.4 Formula_1.2-1   cluster_2.0.3   splines_3.2.5  

 [5] MASS_7.3-45 munsell_0.4.3   colorspace_1.2-6arm_1.8-6  

 [9] lattice_0.20-33 minqa_1.2.4 plyr_1.8.3  nnet_7.3-12

[13] grid_3.2.5  nlme_3.1-126gtable_0.2.0
latticeExtra_0.6-28
[17] coda_0.18-1 abind_1.4-3 survival_2.38-3 
gridExtra_2.2.1
[21] RColorBrewer_1.1-2  nloptr_1.0.4ggplot2_2.1.0   
acepack_1.3-3.3
[25] rpart_4.1-10scales_0.4.0Hmisc_3.17-3foreign_0.8-66

data <- 
data.frame(a=c(NA,2.1,3.3,4.5,5.9,6.2),b=c(2.2,NA,6.1,8.3,10.2,12.13),c=c(4.2,7.9,NA,16.1,19.9,23))
data

a bc
1  NA  2.20  4.2
2 2.1NA  7.9
3 3.3  6.10   NA
4 4.5  8.30 16.1
5 5.9 10.20 19.9
6 6.2 12.13 23.0

data.missingdf <- missing_data.frame(data)
show(data.missingdf)

Object of class missing_data.frame with 6 observations on 3 variables

There are 4 missing data patterns

Append '@patterns' to this missing_data.frame to access the corresponding 
pattern for every observation or perhaps use table()

type missing method  model
a continuous   1ppd linear
b continuous   1ppd linear
c continuous   1ppd linear

family link transformation
a gaussian identitystandardize
b gaussian identitystandardize
c gaussian identitystandardize

#Let's say I'd like to change transformation for a, b and c to "log", 
"logshift" and "sqrt" respectively

data.missingdf <- change(data.missingdf, y="a", what="transformation", 
to="logshift")
data.missingdf <- change(data.missingdf, y="b", what="transformation", to="log")
data.missingdf <- change(data.missingdf, y="c", what="transformation", 
to="sqrt")
show(data.missingdf)

Object of class missing_data.frame with 6 observations on 3 variables

There are 4 missing data patterns

Append '@patterns' to this missing_data.frame to access the corresponding 
pattern for every observation or perhaps use table()

type missing method  model
a continuous   1ppd linear
b continuous   1ppd linear
c continuous   1ppd linear

family link transformation
a gaussian identity   logshift
b gaussian identitylog
c gaussian identitylog

#Transformation has been successfully changed for a and b, but for c has been 
changed to "log" instead of "sqrt"

Thanks in advance for your assistance,
Liz Hensor

Biostatistician
Leeds Institute of Rheumatic and Musculoskeletal Medicine &
NIHR Leeds Musculoskeletal Biomedical Research Unit

_

Re: [R] how to compute Bonferroni, Tukey's, Sheffe 95%-condence intervals for coefficients B1, B2, B3 in linear regression?

2016-05-04 Thread David Winsemius

> On May 4, 2016, at 7:45 AM, super  wrote:
> 
> 
> Dear experts, 
>I have a problem in compute Bonferroni,Tukey's,Sheffe 95%-condence 
> intervals for coefficients B1,B2,B3 in linear regression using R? how can i 
> do it? I only know how to compute these three cofindence intervals in 
> multicomparsion by using multcomp package, and i am search a lot for how to 
> comupte the three CIs for linear regression coefficients but without any 
> useful information, so, plz help me ~

Your question does not detail where the 'confint' function in pkg:multcop is 
letting you down. After the first few lines of the first example I type:

confint(wht)

#---
And get:

 Simultaneous Confidence Intervals

Multiple Comparisons of Means: Tukey Contrasts


Fit: aov(formula = breaks ~ wool + tension, data = warpbreaks)

Quantile = 2.4155
95% family-wise confidence level
 

Linear Hypotheses:
   Estimate lwr  upr 
M - L == 0 -10. -19.3536  -0.6464
H - L == 0 -14.7222 -24.0758  -5.3687
H - M == 0  -4.7222 -14.0758   4.6313


Subsequent examples on that page use linear regression models as there starting 
point.

-- 

David Winsemius
Alameda, CA, USA

__
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 regarding Community Detection Algorithm in R (like Propagation, Walktrap)

2016-05-04 Thread Bert Gunter
Please do not re-post. Search on your own. Entering "community
detection" at the rseek.org R search site brought up many hits,
especially from the igraph package.

Cheers,

Bert


Bert Gunter

"The trouble with having an open mind is that people keep coming along
and sticking things into it."
-- Opus (aka Berkeley Breathed in his "Bloom County" comic strip )


On Wed, May 4, 2016 at 12:01 PM, Swagatam Basu  wrote:
> kindly help me ..from where do i get sample code and details about
> community detection...
>
> Thanks
> Swagatam Basu
>
>
> On Mon, May 2, 2016 at 2:25 PM, Swagatam Basu 
> wrote:
>
>> Hi
>>
>> I am very new to R studio and R language. I have installed the R studio in
>> my machine.
>>
>> I need to do a community detection of a set of message. I have a Matrix
>> for that.
>>
>> Is there any sample code /Package/ website is present which will help me
>> to understand/do this community Detection (like Propagation, Walk trap
>> Algorithm) in R-language by using R-studio.
>>
>> Please help.
>>
>> Please revert back in case of any discrepencies.
>>
>> Thanks
>> S Basu
>>
>>
>
> [[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] Can't resolve dependency problems with package "sem"

2016-05-04 Thread C&A Säger
Hello,

First time user on Ubuntu 14.4 with Ubuntus R Commander and

> $ R --version
> R version 3.0.2 (2013-09-25) -- "Frisbee Sailing"
> Copyright (C) 2013 The R Foundation for Statistical Computing
> Platform: x86_64-pc-linux-gnu (64-bit)

The program icon of the commander executes

> sh -c 'R_DEFAULT_PACKAGES="$R_DEFAULT_PACKAGES Rcmdr" R "$@"'

On first run it started downloading, compiling and installing various
packages. One of them fails:

> 
>> install.packages("sem",dependencies=TRUE)
> Installing package into ‘/home/andreas/R/x86_64-pc-linux-gnu-library/3.0’
> (as ‘lib’ is unspecified)
> Warnung: dependencies ‘MBESS’, ‘arm’, ‘plyr’ are not available
> also installing the dependencies ‘scales’, ‘mi’, ‘DiagrammeR’
> 
> versuche URL 
> 'http://ftp5.gwdg.de/pub/misc/cran/src/contrib/scales_0.4.0.tar.gz'
> Content type 'application/x-gzip' length 57358 bytes (56 Kb)
> URL geöffnet
> ==
> downloaded 56 Kb
> 
> versuche URL 'http://ftp5.gwdg.de/pub/misc/cran/src/contrib/mi_1.0.tar.gz'
> Content type 'application/x-gzip' length 793313 bytes (774 Kb)
> URL geöffnet
> ==
> downloaded 774 Kb
> 
> versuche URL 
> 'http://ftp5.gwdg.de/pub/misc/cran/src/contrib/DiagrammeR_0.8.2.tar.gz'
> Content type 'application/x-gzip' length 3532835 bytes (3.4 Mb)
> URL geöffnet
> ==
> downloaded 3.4 Mb
> 
> versuche URL 'http://ftp5.gwdg.de/pub/misc/cran/src/contrib/sem_3.1-7.tar.gz'
> Content type 'application/x-gzip' length 154654 bytes (151 Kb)
> URL geöffnet
> ==
> downloaded 151 Kb
> 
> ERROR: dependency ‘plyr’ is not available for package ‘scales’
> * removing ‘/home/andreas/R/x86_64-pc-linux-gnu-library/3.0/scales’
> ERROR: dependency ‘arm’ is not available for package ‘mi’
> * removing ‘/home/andreas/R/x86_64-pc-linux-gnu-library/3.0/mi’
> ERROR: dependency ‘scales’ is not available for package ‘DiagrammeR’
> * removing ‘/home/andreas/R/x86_64-pc-linux-gnu-library/3.0/DiagrammeR’
> ERROR: dependency ‘mi’ is not available for package ‘sem’
> * removing ‘/home/andreas/R/x86_64-pc-linux-gnu-library/3.0/sem’
> 
> Die heruntergeladenen Quellpakete sind in
> ‘/tmp/RtmplEqHDo/downloaded_packages’
> Warnmeldungen:
> 1: In install.packages("sem", dependencies = TRUE) :
> Installation des Pakets ‘scales’ hatte Exit-Status ungleich 0
> 2: In install.packages("sem", dependencies = TRUE) :
> Installation des Pakets ‘mi’ hatte Exit-Status ungleich 0
> 3: In install.packages("sem", dependencies = TRUE) :
> Installation des Pakets ‘DiagrammeR’ hatte Exit-Status ungleich 0
> 4: In install.packages("sem", dependencies = TRUE) :
> Installation des Pakets ‘sem’ hatte Exit-Status ungleich 0

How can I resolve the dependencies?
Should I replace the Ubuntu version with something fresh?

Thanks in advance,
Andreas
__
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] copula package error when gumbel parameter is close to bound.

2016-05-04 Thread Jeremie Juste
Hello 

> Berwin A Turlach  writes:

> That you don't have the package Rmpfr installed?  And it seems to be
> needed for the higher dimension.  On my machine it works:
>


Thanks for the lead,

Best regards,
Jeremie

__
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 regarding Community Detection Algorithm in R (like Propagation, Walktrap)

2016-05-04 Thread Swagatam Basu
kindly help me ..from where do i get sample code and details about
community detection...

Thanks
Swagatam Basu


On Mon, May 2, 2016 at 2:25 PM, Swagatam Basu 
wrote:

> Hi
>
> I am very new to R studio and R language. I have installed the R studio in
> my machine.
>
> I need to do a community detection of a set of message. I have a Matrix
> for that.
>
> Is there any sample code /Package/ website is present which will help me
> to understand/do this community Detection (like Propagation, Walk trap
> Algorithm) in R-language by using R-studio.
>
> Please help.
>
> Please revert back in case of any discrepencies.
>
> Thanks
> S Basu
>
>

[[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] greek characters in Figures

2016-05-04 Thread David Winsemius

> On May 4, 2016, at 10:53 AM, Alaios  wrote:
> 
> > install.packages("latex2exp")
> Installiere Paket nach ‘/home/apa/R/x86_64-pc-linux-gnu-library/3.2’
> (da ‘lib’ nicht spezifiziert)
> Warnung: kann nicht auf den Index für das Repository 
> https://cran.cnr.Berkeley.edu/src/contrib zugreifen:
>   nicht unterstütztes URL Schema

You seem to have difficulties with your Internet connection/setup:

> Warnmeldung:
> Paket ‘latex2exp’ ist nicht verfügbar (for R version 3.2.4 Revised) 
> > install.packages("latex2expr")
> Installiere Paket nach ‘/home/apa/R/x86_64-pc-linux-gnu-library/3.2’
> (da ‘lib’ nicht spezifiziert)
> Warnung: kann nicht auf den Index für das Repository 
> https://cran.cnr.Berkeley.edu/src/contrib zugreifen:
>   nicht unterstütztes URL Schema
> Warnmeldung:
> Paket ‘latex2expr’ ist nicht verfügbar (for R version 3.2.4 Revised) 

I just installed from source from that repository into an R 3.2.5 library. (I 
first needed to reinstall that version since I had moved to 3.3.0. Admittedly I 
was doing this on a Mac but since the package does not require any C/Fortran 
level compiling, my experience should mimic that of a Linux user using a source 
package.


-- 
David


> 
> 
> 
> On Monday, May 2, 2016 9:39 PM, David Winsemius  
> wrote:
> 
> 
> 
> > On May 2, 2016, at 10:32 AM, Alaios via R-help  wrote:
> > 
> > Dear all,I am trying to write in my Figure labels short equations that 
> > contain greek characters
> > 
> > For example:  C(h) = sigma^2 * rho(h).  
> > 
> > I am googling it and there are many packages available but unfortunately 
> > they do not look available for my 3.2.4 latex version
> > 
> > install.packages("latex2expr")
> 
> My efforts found a 'latex2exp' but no 'latex2expr'. Are you sure you are not 
> missplelling the package name?
> 
> 
> 
> > Installiere Paket nach ‘/home/apa/R/x86_64-pc-linux-gnu-library/3.2’(da 
> > ‘lib’ nicht spezifiziert)Warnung: kann nicht auf den Index für das 
> > Repository https://cran.cnr.Berkeley.edu/src/contrib zugreifen:  nicht 
> > unterstütztes URL SchemaWarnmeldung:Paket ‘latex2expr’ ist nicht verfügbar 
> > (for R version 3.2.4 Revised) 
> > 
> > Any ideas what else I can try?I would like to thank you in advance for your 
> > replyRegardsAlex
> > [[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.
> 
> 
> David Winsemius
> Alameda, CA, USA
> 
> 
> 

David Winsemius
Alameda, CA, USA

__
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] greek characters in Figures

2016-05-04 Thread Alaios via R-help
> install.packages("latex2exp")Installiere Paket nach 
> ‘/home/apa/R/x86_64-pc-linux-gnu-library/3.2’(da ‘lib’ nicht 
> spezifiziert)Warnung: kann nicht auf den Index für das Repository 
> https://cran.cnr.Berkeley.edu/src/contrib zugreifen:  nicht unterstütztes URL 
> SchemaWarnmeldung:Paket ‘latex2exp’ ist nicht verfügbar (for R version 3.2.4 
> Revised) > install.packages("latex2expr")Installiere Paket nach 
> ‘/home/apa/R/x86_64-pc-linux-gnu-library/3.2’(da ‘lib’ nicht 
> spezifiziert)Warnung: kann nicht auf den Index für das Repository 
> https://cran.cnr.Berkeley.edu/src/contrib zugreifen:  nicht unterstütztes URL 
> SchemaWarnmeldung:Paket ‘latex2expr’ ist nicht verfügbar (for R version 3.2.4 
> Revised) 
 

On Monday, May 2, 2016 9:39 PM, David Winsemius  
wrote:
 

 
> On May 2, 2016, at 10:32 AM, Alaios via R-help  wrote:
> 
> Dear all,I am trying to write in my Figure labels short equations that 
> contain greek characters
> 
> For example:  C(h) = sigma^2 * rho(h).  
> 
> I am googling it and there are many packages available but unfortunately they 
> do not look available for my 3.2.4 latex version
> 
> install.packages("latex2expr")

My efforts found a 'latex2exp' but no 'latex2expr'. Are you sure you are not 
missplelling the package name?


> Installiere Paket nach ‘/home/apa/R/x86_64-pc-linux-gnu-library/3.2’(da ‘lib’ 
> nicht spezifiziert)Warnung: kann nicht auf den Index für das Repository 
> https://cran.cnr.Berkeley.edu/src/contrib zugreifen:  nicht unterstütztes URL 
> SchemaWarnmeldung:Paket ‘latex2expr’ ist nicht verfügbar (for R version 3.2.4 
> Revised) 
> 
> Any ideas what else I can try?I would like to thank you in advance for your 
> replyRegardsAlex
>     [[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.

David Winsemius
Alameda, CA, USA


  
[[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] Grep command

2016-05-04 Thread William Dunlap via R-help
No matter how expert you are at writing regular expressions,
it is important to list which sorts of strings you want matched
and which you do not want matched.  Saying you want to match
"age" but not "age2" leads to lots of possibilities.  Saying how
you want to categorize each string in a vector of stirngs like
the following would narrow things down.
   c("age", "ages ago", "age 60", "An aged man", "page", "Age", "age1",
  "age2",  "dark age", "the aGE")
>From such a list, make a good verbal description of the rule you
are thinking of and someone will be able to translate that into a regular
expression (or say that regular expressions cannot do the job).


Bill Dunlap
TIBCO Software
wdunlap tibco.com

On Wed, May 4, 2016 at 9:59 AM, David Winsemius 
wrote:

>
> > On May 3, 2016, at 11:16 PM, Jeff Newmiller 
> wrote:
> >
> > Yes, but the answer is likely to depend on the actual patterns of
> strings in your real data, so the sooner you go find a book or tutorial on
> regular expressions the better.  This is decidedly not R specific and there
> are already lots of resources out there.
> >
> > Given the example you provide,  the pattern "age$" should work. However,
> that is probably not sufficiently selective for a practical data set so
> start learning to fish (design regex patterns) yourself.
>
> @ Steven;
>
> As is almost always the case I agree with Jeff. I found that reading Rhelp
> and attempting to answer regex-questions was the best method to learn them.
> In particular I found the postings by Gabor Grothendieck very helpful in
> getting some degree of competence in this area. I see that his grep-related
> postings still exceed my grep postings and I assure you that his will be
> more sophisticated than my efforts. I recommend the MarkMail Rhelp mirror
> interface as very useful in "mining" Rhelp for knowledge:
>
> Gabor Grothendieck answers with either 'grep' pr 'regex' in their body:
>
>
> http://markmail.org/search/?q=list%3Aorg.r-project.r-help+list%3Agrep+list%3Aregex+from%3A%22Gabor+Grothendieck
>
> --
> Happy searching;
> David.
>
>
> > --
> > Sent from my phone. Please excuse my brevity.
> >
> > On May 3, 2016 10:45:42 PM PDT, Steven Yen  wrote:
> >> Dear all
> >> In the grep command below, is there a way to identify only "age" and
> >> not "age2"? In other words, I like to greb "age" and "age2"
> >> separately, one at a time. Thanks.
> >>
> >> x<-c("abc","def","rst","xyz","age","age2")
> >> x
> >>
> >> [1] "abc"  "def"  "rst"  "xyz"  "age"  "age2"
> >>
> >> grep("age2",x)
> >>
> >> [1] 6
> >>
> >> grep("age",x) # I need to grab "age" only, not "age2"
> >>
> >> [1] 5 6
> >>
>
> David Winsemius
> Alameda, CA, USA
>
> __
> 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] Antwort: Re: selecting columns from a data frame or data table by type, ie, numeric, integer

2016-05-04 Thread Carl Sutton via R-help
Hi Martin and list:
First let me thank you for thinking of me.   It is probably apparent that my 
programming experience is limited, and the vector aspect of R has taken some 
getting used to.   A very very long time ago I did some programming in Fortran 
and for loops and if statements were ordinary, useful, and used frequently.   
Now if I see a for loop and if statement together then it is flatly apparent 
that I need to rework that code to take advantage of R's strengths using 
vectoized functions on whatever object I am working on.  
It has also become apparent that one should read manuals, experiment with some 
code to firmly cement the knowledge, and build a solid foundation.   My natural 
inclination is the opposite.  I am anxious to produce some code to solve a 
problem or satisfy curiosity or   R is not something one can learn and use 
productively in a few weeks or months.   It is powerful, subtle, and takes some 
thinking.   I started this trek into R with Jared Lander's book "R for 
Everyone",  progressed to Prof Norman Matloff's "The Art of R Programming" 
(which was way beyond my comprehension at the beginning) and Hadley Wickham's 
"ggplot2" book, and several courses with Data Camp and Couresra.  One day I 
will be at the point where I do know what I don't know about R and at that time 
I will almost be competent with the language.

I have taken the work from Bill Dunlap and Giorgio Garziano and have applied it 
to my little project and am just amazed that so little code can do so much.  I 
have also followed Bert Gunter's advice and taken that code and dissected it 
item by item to comprehend what each element is doing.   

The knowledge and help on this list is just amazing and I do appreciate the 
efforts of all involved.  I read the digest daily .
Carl Sutton CPA
 

On Wednesday, May 4, 2016 12:06 AM, Martin Maechler 
 wrote:
 
 

 >  
>    on Wed, 4 May 2016 08:30:50 +0200 writes:

> Hi All,
> Hi Carl,
> 
> I am not sure if this is useful to you, but I followed your conversation 
> and thought of you when I read this:
> 
> for (i in 1:ncol(dataset)) {
>  if(class(dataset) == "character|numeric|factor|or whatsoever") {
>    dataset[, i] <- as.factor(dataset[, i])
>  }
> }

Ouch -- so many problems in such a short piece of R code !!!

> Source: Zumel, Nina / Mount, John: Practical Data Science with R, Manning 
> Publications: Shelter Island, 2014, Chapter 2: Loading data into R, p. 25

Sorry, but after reading the above, I'd strongly recommend getting
better books about R...
      {{maybe do not take those containing "data science" ;-)}}

Compared to the nice and efficient solution of Bill Dunlap,
the above is really bad-bad-bad  in at least four ways :

0) They way you write it above, you cannot use it,
     == "variant1|variant2|..."
  is pseudocode and does not really work

1) Note the missing "[, i]"  in the 2nd line: It should be
    if(class(dataset[, i]) ...

2) A for loop changing each column at a time is really slow for
  largish data sets

3) [last but not at all least!]
  Please ... many of you readers, do learn:
  
 Using checks such as
      if ( class(x) == "numeric" )
 are (almost) always wrong by design !!!

 Instead you really should (almost) always use

     if(inherits(x, "numeric"))

Why?  Because classes in R (S3 or S4) can *extend* other classes.
Example: Many of you know that after  fm <- glm(...)
class(fm) is  c("glm", "lm")  and so

    > if(class(fm) == "lm")
    + "yes"
    Warning message:
    In if (class(fm) == "lm") "yes" :
      the condition has length > 1 and only the first element will be used

Similarly, in your case

y <- 1:10
class(y) <- c("myNumber", "numeric")

when that 'y' is a column in your data frame,
the test for  if(class(dataset[,i]) == "numeric")  will *not*
work but actually produce the above warning.

However, one  could als have had

Num <- setClass("Num", contains="numeric")
N <- Num(1:10)

    > Num <- setClass("Num", contains="numeric")
    > N <- Num(1:10)
    > N
    An object of class "Num"
      [1]  1  2  3  4  5  6  7  8  9 10
    > if(class(N) == "numeric") "yes" else "no"
    [1] "no"
    > 

I hope that many of the readers --- including *MANY* authors of
R packages !! --- have understood the above and will fix their R
code -- and even more their books where applicable !!

Martin Maechler,
ETH Zurich & R Core Team 
 
> 


> This way you can select variables of a certain class only and do 
> transformations. I found that this approach is not applicable if used with 
> statistical functions like head(). Transformations worked fine for me.
> 
> I found reading the above given source worthwile.
> 
> Kind regards
> 
> Georg
> 
> PS: I am not related to the above given authors. I am just a reader 
> reporting on - at least to me - a valuable ressource.
> 
> 
> 
> Von:    Carl Sutton via R-help 
> An:    William Dunlap , 
> Kopie:  "r-help@r-project.org" 
> Datum:  29.04.2016 22:08
> Betreff:        Re: [R] selecting

Re: [R] Grep command

2016-05-04 Thread David Winsemius

> On May 3, 2016, at 11:16 PM, Jeff Newmiller  wrote:
> 
> Yes, but the answer is likely to depend on the actual patterns of strings in 
> your real data, so the sooner you go find a book or tutorial on regular 
> expressions the better.  This is decidedly not R specific and there are 
> already lots of resources out there.
> 
> Given the example you provide,  the pattern "age$" should work. However, that 
> is probably not sufficiently selective for a practical data set so start 
> learning to fish (design regex patterns) yourself. 

@ Steven;

As is almost always the case I agree with Jeff. I found that reading Rhelp and 
attempting to answer regex-questions was the best method to learn them. In 
particular I found the postings by Gabor Grothendieck very helpful in getting 
some degree of competence in this area. I see that his grep-related postings 
still exceed my grep postings and I assure you that his will be more 
sophisticated than my efforts. I recommend the MarkMail Rhelp mirror interface 
as very useful in "mining" Rhelp for knowledge:

Gabor Grothendieck answers with either 'grep' pr 'regex' in their body:

http://markmail.org/search/?q=list%3Aorg.r-project.r-help+list%3Agrep+list%3Aregex+from%3A%22Gabor+Grothendieck

-- 
Happy searching;
David.


> -- 
> Sent from my phone. Please excuse my brevity.
> 
> On May 3, 2016 10:45:42 PM PDT, Steven Yen  wrote:
>> Dear all
>> In the grep command below, is there a way to identify only "age" and
>> not "age2"? In other words, I like to greb "age" and "age2"
>> separately, one at a time. Thanks.
>> 
>> x<-c("abc","def","rst","xyz","age","age2")
>> x
>> 
>> [1] "abc"  "def"  "rst"  "xyz"  "age"  "age2"
>> 
>> grep("age2",x)
>> 
>> [1] 6
>> 
>> grep("age",x) # I need to grab "age" only, not "age2"
>> 
>> [1] 5 6
>> 

David Winsemius
Alameda, CA, USA

__
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] Robust MARS regression with R ?

2016-05-04 Thread varin sacha via R-help
Dear R-helpers,

I would like to know if it is possible using R (earth packages or another one) 
to realize robust MARS regression RMARS or RCMARS (C mean "conic").

Some authors have done it using MOSEK combined with Salford-MARS and special 
MATLAB programs.

Best Regards,

Sacha

__
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] Grep command

2016-05-04 Thread Doran, Harold
You asked this question yesterday, and received responses on this same 
response. Is there a reason this is reposted?



-Original Message-
From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of Steven Yen
Sent: Wednesday, May 04, 2016 1:46 AM
To: r-help 
Subject: [R] Grep command

Dear all
In the grep command below, is there a way to identify only "age" and not 
"age2"? In other words, I like to greb "age" and "age2"
separately, one at a time. Thanks.

x<-c("abc","def","rst","xyz","age","age2")
x

[1] "abc"  "def"  "rst"  "xyz"  "age"  "age2"

grep("age2",x)

[1] 6

grep("age",x) # I need to grab "age" only, not "age2"

[1] 5 6

__
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 compute Bonferroni, Tukey's, Sheffe 95%-condence intervals for coefficients B1, B2, B3 in linear regression?

2016-05-04 Thread super

Dear experts, 
   I have a problem in compute Bonferroni,Tukey's,Sheffe 95%-condence intervals 
for coefficients B1,B2,B3 in linear regression using R? how can i do it? I only 
know how to compute these three cofindence intervals in multicomparsion by 
using multcomp package, and i am search a lot for how to comupte the three CIs 
for linear regression coefficients but without any useful information, so, plz 
help 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.

[R] copula package error when gumbel parameter is close to bound.

2016-05-04 Thread Jérémie Juste
Hello,

In a situation where the dimension is high and the parameter is close to
the bound computing the density of the gumbel copula throws the following
error.

library(copula)
dCopula(rep(0.5,127),gumbelCopula(1.19,127),log=TRUE)

Loading required namespace: Rmpfr
Failed with error:  ‘there is no package called ‘Rmpfr’’
Error: requireNamespace("Rmpfr") is not TRUE


It does not seem to be a ploblem with lower dimension though

dCopula(rep(0.5,17),gumbelCopula(1.19,17),log=TRUE)

[1] 2.402906

I'm I missing something about the computation?

Best regards
-- 
Jeremie Juste

[[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] Changing transformations in mi package

2016-05-04 Thread Elizabeth Hensor
Dear all,
I am an R beginner and new to the list. In preparation for using mi to impute 
missing values I am setting up the missing data frame and would like to specify 
the transformation types for some of my variables, as I will be using these 
transformations in my analysis models. According to the documentation the 
available options are "standardize" (the default), "identity", "log", 
"logshift" and "sqrt". I can successfully change the transformation types to 
"log" and "logshift", but when I attempt to change to "sqrt", this changes the 
type to "log" instead. I'd appreciate your help, please.
Below are details of my system and some code which replicates the issue.

> sessionInfo()
R version 3.2.5 (2016-04-14)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 7 x64 (build 7601) Service Pack 1

locale:
[1] LC_COLLATE=English_United Kingdom.1252  LC_CTYPE=English_United 
Kingdom.1252   
[3] LC_MONETARY=English_United Kingdom.1252 LC_NUMERIC=C
   
[5] LC_TIME=English_United Kingdom.1252

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

other attached packages:
[1] lmerTest_2.0-30 truncnorm_1.0-7 mi_1.0  lme4_1.1-12 
Matrix_1.2-4   
[6] pls_2.5-0  

loaded via a namespace (and not attached):
 [1] Rcpp_0.12.4 Formula_1.2-1   cluster_2.0.3   splines_3.2.5  

 [5] MASS_7.3-45 munsell_0.4.3   colorspace_1.2-6arm_1.8-6  

 [9] lattice_0.20-33 minqa_1.2.4 plyr_1.8.3  nnet_7.3-12

[13] grid_3.2.5  nlme_3.1-126gtable_0.2.0
latticeExtra_0.6-28
[17] coda_0.18-1 abind_1.4-3 survival_2.38-3 
gridExtra_2.2.1
[21] RColorBrewer_1.1-2  nloptr_1.0.4ggplot2_2.1.0   
acepack_1.3-3.3
[25] rpart_4.1-10scales_0.4.0Hmisc_3.17-3foreign_0.8-66

data <- 
data.frame(a=c(NA,2.1,3.3,4.5,5.9,6.2),b=c(2.2,NA,6.1,8.3,10.2,12.13),c=c(4.2,7.9,NA,16.1,19.9,23))
data

a bc
1  NA  2.20  4.2
2 2.1NA  7.9
3 3.3  6.10   NA
4 4.5  8.30 16.1
5 5.9 10.20 19.9
6 6.2 12.13 23.0

data.missingdf <- missing_data.frame(data)
show(data.missingdf)

Object of class missing_data.frame with 6 observations on 3 variables

There are 4 missing data patterns

Append '@patterns' to this missing_data.frame to access the corresponding 
pattern for every observation or perhaps use table()

type missing method  model
a continuous   1ppd linear
b continuous   1ppd linear
c continuous   1ppd linear

family link transformation
a gaussian identitystandardize
b gaussian identitystandardize
c gaussian identitystandardize

#Let's say I'd like to change transformation for a, b and c to "log", 
"logshift" and "sqrt" respectively

data.missingdf <- change(data.missingdf, y="a", what="transformation", 
to="logshift")
data.missingdf <- change(data.missingdf, y="b", what="transformation", to="log")
data.missingdf <- change(data.missingdf, y="c", what="transformation", 
to="sqrt")
show(data.missingdf)

Object of class missing_data.frame with 6 observations on 3 variables

There are 4 missing data patterns

Append '@patterns' to this missing_data.frame to access the corresponding 
pattern for every observation or perhaps use table()

type missing method  model
a continuous   1ppd linear
b continuous   1ppd linear
c continuous   1ppd linear

family link transformation
a gaussian identity   logshift
b gaussian identitylog
c gaussian identitylog

#Transformation has been successfully changed for a and b, but for c has been 
changed to "log" instead of "sqrt"

Thanks in advance for your assistance,
Liz Hensor

Biostatistician
Leeds Institute of Rheumatic and Musculoskeletal Medicine &
NIHR Leeds Musculoskeletal Biomedical Research Unit

__
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] undefined columns selected!

2016-05-04 Thread MacQueen, Don
First, type
   names(msub)
and then type
   cn
and compare the output.

Probably, you will find a name in cn that is not among the names of msub.

To maybe make it easier to see the missing column(s), you can type

  setdiff(cn, names(msub))

The expression
  msub[,cn]
is intended to select columns from msub. That error message means that you
are trying to select one or more columns that are not there.

Or perhaps Bert Gunter is correct, and it should be
  msub[,'cn']
but I believe that if that were the case the error message would likely be
different. Without more information we can't be sure.

-Don



-- 
Don MacQueen

Lawrence Livermore National Laboratory
7000 East Ave., L-627
Livermore, CA 94550
925-423-1062





On 5/4/16, 6:05 AM, "R-help on behalf of ch.elahe via R-help"
 wrote:

>
>Hi all,
>I know it seems simple but I am trying to copy a code and I don't know
>what is the problem with this command!
>
>msubsub=msub[,cn]
>
>the error I get is : error in '[.data.frame '(msub, ,cn) : undefined
>columns selected 
> 
>Thanks for any help,
>Elahe
>
>__
>R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
>https://secure-web.cisco.com/17LbfsJ6l1TxAGGDaZPJaqSjzCIWn5E9CwPSSMrKL6TmF
>nzxq4NMk2_I5ZoRND9U7-DVdKRI4gQq-ksFm42c_Y4YLWER6RjmX7KA43TlJE090H6BW03h2ch
>R-AjcGVBd7OkbsupK4ILVvkOhZEs4oearHg3fxw5eGd1HheF2ZmV23Gk8iUz73qq3xABMYDqRs
>MimloONz77mr0nVciORpjobMGuDvIH69DttdwbXnkLyVgrlscdiOjTp_LjcdJMSFKqMjepMDxH
>iQGQfThQ4q3l5ZjSUts8soTR8Bg5R722f-4WJkevdYYreIEU3i0aH64_AdN7Hhn9lHL1MUOm0K
>Mg0IV4twClhcRjs7Bf5Qf9M/https%3A%2F%2Fstat.ethz.ch%2Fmailman%2Flistinfo%2F
>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] undefined columns selected!

2016-05-04 Thread Bert Gunter
The the column name must be quoted in the index:

msubsub=msub[,"cn"]


Please go through a basic R tutorial  or two if you want to learn to use R.


Cheers,
Bert
Bert Gunter

"The trouble with having an open mind is that people keep coming along
and sticking things into it."
-- Opus (aka Berkeley Breathed in his "Bloom County" comic strip )


On Wed, May 4, 2016 at 6:05 AM, ch.elahe via R-help
 wrote:
>
> Hi all,
> I know it seems simple but I am trying to copy a code and I don't know what 
> is the problem with this command!
>
> msubsub=msub[,cn]
>
> the error I get is : error in '[.data.frame '(msub, ,cn) : undefined columns 
> selected
>
> Thanks for any help,
> Elahe
>
> __
> 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] undefined columns selected!

2016-05-04 Thread John McKown
On Wed, May 4, 2016 at 8:05 AM, ch.elahe via R-help 
wrote:

>
> Hi all,
> I know it seems simple but I am trying to copy a code and I don't know
> what is the problem with this command!
>
> msubsub=msub[,cn]
>
> the error I get is : error in '[.data.frame '(msub, ,cn) : undefined
> columns selected
>

​First - very important - please change from HTML posting to plain text.
This forum doesn't handle HTML well and its use very often results in
​unreadable and thus unusable messages.

​TLI (Too Little Information). I would probably help if you would post the
information from things like:

dput(head(msub))

dput(head(cn)​)


Most want "dput(msub)" and "dput(cn)", but I use the "head()" to subset
that to examples which are usually easier to post. It depends on the
problem and the size of the data involved. Oh, please don't just
cut'n'paste the output from simply listing "msub" or "cn", that produces
output which cannot be cut and pasted easily into an R session. Thanks.


>
> Thanks for any help,
> Elahe
>
>

-- 
The unfacts, did we have them, are too imprecisely few to warrant our
certitude.

Maranatha! <><
John McKown

[[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] undefined columns selected!

2016-05-04 Thread ch.elahe via R-help

Hi all,
I know it seems simple but I am trying to copy a code and I don't know what is 
the problem with this command!

msubsub=msub[,cn]

the error I get is : error in '[.data.frame '(msub, ,cn) : undefined columns 
selected 
 
Thanks for any help,
Elahe

__
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] Install on Xenial

2016-05-04 Thread Jeff Newmiller
Pick different mirror. 
-- 
Sent from my phone. Please excuse my brevity.

On May 4, 2016 5:22:43 AM PDT, Erich Neuwirth  
wrote:
>I am trying to install R-3.3.0 on Xenial.
>I followed the instructions on the corresponding CRAN page, and I added
>the GPG key.
>But after adding
>deb https://cran.at.r-project.org//bin/linux/ubuntu xenial/
>to /etc/apt/sources.list
>and
>sudo apt-get update
>I get the following error:
>
>Err:7 https://cran.at.r-project.org//bin/linux/ubuntu xenial/ Packages
>SSL: certificate subject name (*.r-project.org) does not match target
>host name 'cran.at.r-project.org’
>
>What do I need to do to get rid of this error
>
>
>
>
>
>
>__
>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.

[R] Install on Xenial

2016-05-04 Thread Erich Neuwirth
I am trying to install R-3.3.0 on Xenial.
I followed the instructions on the corresponding CRAN page, and I added the GPG 
key.
But after adding
deb https://cran.at.r-project.org//bin/linux/ubuntu xenial/
to /etc/apt/sources.list
and
sudo apt-get update
I get the following error:

Err:7 https://cran.at.r-project.org//bin/linux/ubuntu xenial/ Packages
  SSL: certificate subject name (*.r-project.org) does not match target host 
name 'cran.at.r-project.org’

What do I need to do to get rid of this error




signature.asc
Description: Message signed with OpenPGP using GPGMail
__
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] expression input to a function

2016-05-04 Thread Duncan Murdoch

On 04/05/2016 7:11 AM, Naresh Gurbuxani wrote:

I am trying to write a function, which can be made very general if one of the 
inputs can be an expression.  How can this be done?


For example, to find root of a function, I would like to say

my.func <- function(x) {x^3 + 2 * (x^2) - 7}

x.left <- 0
x.right <- 2
n.iterations <- 0

find.root <- function(my.func, x.left, x.right) {
  # code here
return(c(x.mid, n.iterations))
}

The above method clearly does not work.


You are taking the right approach.  You can pass functions as arguments 
to other functions; they are "first class objects".  For example:


evaluate <- function(f, x) f(x)

evaluate(my.func, 3)

would give the same result as my.func(3).

For your find.root function, just write the search in find.root using 
the name of the argument (which for didactic purposes I'd recommend be 
different from the actual function name, but it'll be fine in practice).


It is also possible to pass expressions that aren't in functions, but it 
gets tricky, and you shouldn't do that in your first attempt.


Duncan Murdoch

__
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] R column assignment fails for lists

2016-05-04 Thread Yasir Suhail
Dear Jim and David,

Thank you very much for your reply. I guess my question is whether it is
legal to store vectors in the elements of a data.frame. These are useful
for storing things like neighbors of a graph vertex, orthologs of a gene
etc. I have been using data frames of this sort and they are very useful,
so I am hoping this is a feature, rather than a bug. The weird code in my
email to form a was just one quick way of making such an object for a toy
example. These sort of data frames were doing fine for a number of analysis
pipelines until I used a function on them that had code of the sort
df[, j] <- sapply(df[, j], fun)

The interesting thing is that while
a[,3] <- a[,3] changes the object and gives the warning
a$c <- a$c works "correctly". leaving a to what it was and doesn't give a
warning.

If elements of a data frame are supposed to be able to store vectors, then
shouldn't
a[,3] <- a[,3] work?

Best regards,
yasir


On Tue, May 3, 2016 at 9:48 PM, David Winsemius 
wrote:

>
> > On May 3, 2016, at 4:13 PM, Yasir Suhail  wrote:
> >
> > Dear R developers and users,
> >
> > Consider the object :
> >
> >> a <- data.frame(a=c(1,2), b=c(2,3), c=c("a,b","c,d"), stringsAsFactors
> = F)
> >> a$c <- strsplit(a$c, ",")
>
> You are the one who should "consider the object". Look at what
> strsplit(a$c, ",") returns and then perhaps re-consider trying to assign it
> to a single column.
>
> >
> > Re-assignment works fine for columns 1 and 2, but fails for column 3. If
> a
> > is a valid object, the assignment should work.
> >
> >> a[,1] <- a[,1]
> >> a[,2] <- a[,2]
> >> a[,3] <- a[,3]
> > Warning message:
> > In `[<-.data.frame`(`*tmp*`, , 3, value = list(c("a", "b"), c("c",  :
> >  provided 2 variables to replace 1 variables
> >
> >   [[alternative HTML version deleted]]
>
> And please reconsider also the format of your postings.
>
> >
> > __
> > 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
>
>

[[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] Grep command

2016-05-04 Thread Niels Jespersen
> x <- c("abc","def","rst","xyz","age","age2")
> grep("^age$", x)
[1] 5
> grep("^age2$", x)
[1] 6
> 
>

-Oprindelig meddelelse-
Fra: R-help [mailto:r-help-boun...@r-project.org] På vegne af Steven Yen
Sendt: 4. maj 2016 07:46
Til: r-help
Emne: [R] Grep command

Dear all
In the grep command below, is there a way to identify only "age" and not 
"age2"? In other words, I like to greb "age" and "age2"
separately, one at a time. Thanks.

x<-c("abc","def","rst","xyz","age","age2")
x

[1] "abc"  "def"  "rst"  "xyz"  "age"  "age2"

grep("age2",x)

[1] 6

grep("age",x) # I need to grab "age" only, not "age2"

[1] 5 6

__
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] Antwort: Antwort: Re: selecting columns from a data frame or data table by type, ie, numeric, integer

2016-05-04 Thread PIKAL Petr
Hi

> -Original Message-
> From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of
> g.maub...@weinwolf.de
> Sent: Wednesday, May 4, 2016 10:06 AM
> To: Martin Maechler 
> Cc: r-help@r-project.org
> Subject: [R] Antwort: Antwort: Re: selecting columns from a data frame or
> data table by type, ie, numeric, integer
>
> Hi Martin,
>
> many thanks for your answer and your broad explanation.
>
> I am a newbie to "R" and got help on this list and thought I could give
> something back what looked OK to me.
>
> regarding 0)
> You're right, it's pseudo code. I assumed that anybody on the list would be
> able to adapt the code to their needs so that it worked. Next time I will post
> runnable code.
>
> regarding 1)
> Your right: "[, i]" is missing. My fault. Sorry.
>
> regarding 3)
> I got your point and will do better in the future.
>
> One question: What books do you recommend to read to get to know "R"
> better?

Freely available from CRAN

These I can recommend as I went through them

“A Guide for the Unwilling S User” by Patrick Burns
“Using R for Data Analysis and Graphics - Introduction, Examples and 
Commentary”  by John Maindonald (PDF, data sets and scripts are available at 
JM's homepage).
“Practical Regression and Anova using R” by Julian Faraway (PDF, data sets and 
scripts are available at the book homepage).

There are also some German books but I do not have experience with them.

Books from bookstores
Modern Applied Statistics with S. Fourth Edition, by W. N. Venables and B. D. 
Ripley
Introductory Statistics with R, Authors: Dalgaard, Peter

Cheers
Petr

>
> Kind regards
>
> Georg
>
>
>
>
> Von:Martin Maechler 
> An: ,
> Kopie:  Carl Sutton , "r-help@r-project.org"
> 
> Datum:  04.05.2016 09:05
> Betreff:[R] Antwort: Re: selecting columns from a data frame or
> data table  by type, ie, numeric, integer
>
>
>
> >   
> > on Wed, 4 May 2016 08:30:50 +0200 writes:
>
> > Hi All,
> > Hi Carl,
> >
> > I am not sure if this is useful to you, but I followed your
> > conversation
>
> > and thought of you when I read this:
> >
> > for (i in 1:ncol(dataset)) {
> >   if(class(dataset) == "character|numeric|factor|or whatsoever") {
> > dataset[, i] <- as.factor(dataset[, i])
> >   }
> > }
>
> Ouch -- so many problems in such a short piece of R code !!!
>
> > Source: Zumel, Nina / Mount, John: Practical Data Science with R,
> Manning
> > Publications: Shelter Island, 2014, Chapter 2: Loading data into R, p.
> 25
>
> Sorry, but after reading the above, I'd strongly recommend getting better
> books about R...
>{{maybe do not take those containing "data science" ;-)}}
>
> Compared to the nice and efficient solution of Bill Dunlap, the above is 
> really
> bad-bad-bad  in at least four ways :
>
> 0) They way you write it above, you cannot use it,
>   == "variant1|variant2|..."
>is pseudocode and does not really work
>
> 1) Note the missing "[, i]"  in the 2nd line: It should be
>  if(class(dataset[, i]) ...
>
> 2) A for loop changing each column at a time is really slow for
>largish data sets
>
> 3) [last but not at all least!]
>Please ... many of you readers, do learn:
>
>  Using checks such as
>if ( class(x) == "numeric" )
>  are (almost) always wrong by design !!!
>
>  Instead you really should (almost) always use
>
>   if(inherits(x, "numeric"))
>
> Why?  Because classes in R (S3 or S4) can *extend* other classes.
> Example: Many of you know that after   fm <- glm(...)
> class(fm) is   c("glm", "lm")   and so
>
> > if(class(fm) == "lm")
> + "yes"
> Warning message:
> In if (class(fm) == "lm") "yes" :
>   the condition has length > 1 and only the first element will be used
>
> Similarly, in your case
>
> y <- 1:10
> class(y) <- c("myNumber", "numeric")
>
> when that 'y' is a column in your data frame, the test for  
> if(class(dataset[,i])
> == "numeric")  will *not* work but actually produce the above warning.
>
> However, one  could als have had
>
> Num <- setClass("Num", contains="numeric") N <- Num(1:10)
>
>  > Num <- setClass("Num", contains="numeric")
>  > N <- Num(1:10)
>  > N
>  An object of class "Num"
>   [1]  1  2  3  4  5  6  7  8  9 10
>  > if(class(N) == "numeric") "yes" else "no"
>  [1] "no"
>  >
>
> I hope that many of the readers --- including *MANY* authors of R packages
> !! --- have understood the above and will fix their R code -- and even more
> their books where applicable !!
>
> Martin Maechler,
> ETH Zurich & R Core Team
>
> >
>
>
> > This way you can select variables of a certain class only and do
> > transformations. I found that this approach is not applicable if used
> with
> > statistical functions like head(). Transformations worked fine for me.
> >
> > I found reading the above given source worthwile.
> >
> > Kind regards
> >
> > Georg
> >
> > PS: I am not related to the above given authors. I am just a reader
> > reporting on -

[R] Antwort: Antwort: Re: selecting columns from a data frame or data table by type, ie, numeric, integer

2016-05-04 Thread G . Maubach
Hi Martin,

many thanks for your answer and your broad explanation. 

I am a newbie to "R" and got help on this list and thought I could give 
something back what looked OK to me.

regarding 0)
You're right, it's pseudo code. I assumed that anybody on the list would 
be able to adapt the code to their needs so that it worked. Next time I 
will post runnable code.

regarding 1)
Your right: "[, i]" is missing. My fault. Sorry.

regarding 3)
I got your point and will do better in the future.

One question: What books do you recommend to read to get to know "R" 
better?

Kind regards

Georg




Von:Martin Maechler 
An: , 
Kopie:  Carl Sutton , "r-help@r-project.org" 

Datum:  04.05.2016 09:05
Betreff:[R] Antwort: Re: selecting columns from a data frame or 
data table  by type, ie, numeric, integer



>   
> on Wed, 4 May 2016 08:30:50 +0200 writes:

> Hi All,
> Hi Carl,
> 
> I am not sure if this is useful to you, but I followed your conversation 

> and thought of you when I read this:
> 
> for (i in 1:ncol(dataset)) {
>   if(class(dataset) == "character|numeric|factor|or whatsoever") {
> dataset[, i] <- as.factor(dataset[, i])
>   }
> }

Ouch -- so many problems in such a short piece of R code !!!

> Source: Zumel, Nina / Mount, John: Practical Data Science with R, 
Manning 
> Publications: Shelter Island, 2014, Chapter 2: Loading data into R, p. 
25

Sorry, but after reading the above, I'd strongly recommend getting
better books about R...
   {{maybe do not take those containing "data science" ;-)}}

Compared to the nice and efficient solution of Bill Dunlap,
the above is really bad-bad-bad  in at least four ways :

0) They way you write it above, you cannot use it,
  == "variant1|variant2|..."
   is pseudocode and does not really work

1) Note the missing "[, i]"  in the 2nd line: It should be
 if(class(dataset[, i]) ...

2) A for loop changing each column at a time is really slow for
   largish data sets

3) [last but not at all least!]
   Please ... many of you readers, do learn:
 
 Using checks such as
   if ( class(x) == "numeric" )
 are (almost) always wrong by design !!!

 Instead you really should (almost) always use

  if(inherits(x, "numeric"))

Why?  Because classes in R (S3 or S4) can *extend* other classes.
Example: Many of you know that after   fm <- glm(...)
class(fm) is   c("glm", "lm")   and so

> if(class(fm) == "lm")
+ "yes"
Warning message:
In if (class(fm) == "lm") "yes" :
  the condition has length > 1 and only the first element will be used

Similarly, in your case

y <- 1:10
class(y) <- c("myNumber", "numeric")

when that 'y' is a column in your data frame,
the test for  if(class(dataset[,i]) == "numeric")  will *not*
work but actually produce the above warning.

However, one  could als have had

Num <- setClass("Num", contains="numeric")
N <- Num(1:10)

 > Num <- setClass("Num", contains="numeric")
 > N <- Num(1:10)
 > N
 An object of class "Num"
  [1]  1  2  3  4  5  6  7  8  9 10
 > if(class(N) == "numeric") "yes" else "no"
 [1] "no"
 > 

I hope that many of the readers --- including *MANY* authors of
R packages !! --- have understood the above and will fix their R
code -- and even more their books where applicable !!

Martin Maechler,
ETH Zurich & R Core Team 
 
> 


> This way you can select variables of a certain class only and do 
> transformations. I found that this approach is not applicable if used 
with 
> statistical functions like head(). Transformations worked fine for me.
> 
> I found reading the above given source worthwile.
> 
> Kind regards
> 
> Georg
> 
> PS: I am not related to the above given authors. I am just a reader 
> reporting on - at least to me - a valuable ressource.
> 
> 
> 
> Von:Carl Sutton via R-help 
> An: William Dunlap , 
> Kopie:  "r-help@r-project.org" 
> Datum:  29.04.2016 22:08
> Betreff:Re: [R] selecting columns from a data frame or data 
table 
> by type, ie, numeric, integer
> Gesendet von:   "R-help" 
> 
> 
> 
> Thank you Bill Dunlap.  So simple I never tried that approach. Tried 
> dozens of others though, read manuals till I was getting headaches, and 
of 
> course the answer was simple when one is competent.   Learning, its a 
> struggle, but slowly getting there.
> Thanks again
>  Carl Sutton CPA
> 
> 
> On Friday, April 29, 2016 10:50 AM, William Dunlap 
 
> wrote:
> 
> 
> 
>  > dt1[ vapply(dt1, FUN=is.numeric, FUN.VALUE=NA) ]a   c1   1 1.12 2 

> 1.0...10 10 0.2
> 
> 
> Bill Dunlap
> TIBCO Software
> wdunlap tibco.com
> On Fri, Apr 29, 2016 at 9:19 AM, Carl Sutton via R-help 
>  wrote:
> 
> Good morning RGuru's
> I have a data frame of 575 columns.  I want to extract only those 
columns 
> that are numeric(double) or integer to do some machine learning with.  I 

> have searched the web for a couple of days (off and on) and have not 
found 
> anything that shows how to do this.   Lots of ways

Re: [R] Grep command

2016-05-04 Thread Jeff Newmiller
Yes, but the answer is likely to depend on the actual patterns of strings in 
your real data, so the sooner you go find a book or tutorial on regular 
expressions the better.  This is decidedly not R specific and there are already 
lots of resources out there.

Given the example you provide,  the pattern "age$" should work. However, that 
is probably not sufficiently selective for a practical data set so start 
learning to fish (design regex patterns) yourself. 
-- 
Sent from my phone. Please excuse my brevity.

On May 3, 2016 10:45:42 PM PDT, Steven Yen  wrote:
>Dear all
>In the grep command below, is there a way to identify only "age" and
>not "age2"? In other words, I like to greb "age" and "age2"
>separately, one at a time. Thanks.
>
>x<-c("abc","def","rst","xyz","age","age2")
>x
>
>[1] "abc"  "def"  "rst"  "xyz"  "age"  "age2"
>
>grep("age2",x)
>
>[1] 6
>
>grep("age",x) # I need to grab "age" only, not "age2"
>
>[1] 5 6
>
>__
>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] Custom data structures inside of a hash function

2016-05-04 Thread Jeff Newmiller
It is impolite to put such a minor code fragment on a transient website. Also, 
this is a plain text mailing list... html usually gets stripped, damaging any 
advantage the HTML might have had and creating confusion for people reading 
your message, so please learn how to send plain text.

You wrote:

--
keys <- c('AB', 'AC')
values <- c(c('hello', 0), c('world', 0))
names(values) <- keys
cat(length(values))
-

You seem to think this is Perl. The c function concatenates... it does not make 
tuples, it makes vectors, which must have all elements of the same type (unless 
the vector is of list type). And while vectors can have named elements, those 
names are not hashes. And since this is R, not Perl, you should use data 
structures that can be operated on in vectorized fashion, or you will have 
horrible performance.

So,  the unhelpful but literal answer to your question is

-
values <- list( list( 'hello', 0 ), list( 'world', 0 ))
names( values ) <- c( "AB", "AC" )
values[[ "AC" ]]
values[[ "AC" ]][[ 2 ]] <- 1
-

but if you want a scalable solution then you need something like

-
values <- data.frame( string=c( "hello", "world" ), num=c( 0, 0 ) )
rownames( values ) <- c( "AB", "AC" )
values[ "AC", ]
values[ "AC", 2 ] <- 1


though often as not the names get stuffed into another column in the data frame 
and rows are simply accessed using integer or logical vector indexing.

Note that data frames are column oriented.  This is fundamental to the way R 
works... embrace it. 

If you absolutely must have a hash then you need environments, but they are 
tricky animals and are remarkably (if you come from a Perl background) rarely 
needed. 

A long time ago I came to R with similar thoughts of writing Perl in R... but 
eventually I read the actual words in the Introduction to R document instead of 
trying to reframe them in the Perl mind set and only then did I start to make 
progress with R.

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

On May 3, 2016 6:55:09 PM PDT, "Yves S. Garret"  
wrote:
>Hello,
>
>I have the following code:
>http://pastebin.ca/3590201
>
>What I'm trying to do is to create a hash map where the key is two
>characters and
>that maps to a structure of some information.  The problem with the
>above
>example
>is that the first two keys match to the first instance of c('hello',
>0),
>but the second is
>completely ignored.  Ideally, I'd like to retrieve the structure with
>my
>values based on
>the key at hand and modify it as I see fit.
>
>How can I achieve this?
>
>   [[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.


[R] Antwort: Re: selecting columns from a data frame or data table by type, ie, numeric, integer

2016-05-04 Thread Martin Maechler
>   
> on Wed, 4 May 2016 08:30:50 +0200 writes:

> Hi All,
> Hi Carl,
> 
> I am not sure if this is useful to you, but I followed your conversation 
> and thought of you when I read this:
> 
> for (i in 1:ncol(dataset)) {
>   if(class(dataset) == "character|numeric|factor|or whatsoever") {
> dataset[, i] <- as.factor(dataset[, i])
>   }
> }

Ouch -- so many problems in such a short piece of R code !!!

> Source: Zumel, Nina / Mount, John: Practical Data Science with R, Manning 
> Publications: Shelter Island, 2014, Chapter 2: Loading data into R, p. 25

Sorry, but after reading the above, I'd strongly recommend getting
better books about R...
   {{maybe do not take those containing "data science" ;-)}}

Compared to the nice and efficient solution of Bill Dunlap,
the above is really bad-bad-bad  in at least four ways :

0) They way you write it above, you cannot use it,
  == "variant1|variant2|..."
   is pseudocode and does not really work

1) Note the missing "[, i]"  in the 2nd line: It should be
 if(class(dataset[, i]) ...

2) A for loop changing each column at a time is really slow for
   largish data sets

3) [last but not at all least!]
   Please ... many of you readers, do learn:
  
 Using checks such as
   if ( class(x) == "numeric" )
 are (almost) always wrong by design !!!

 Instead you really should (almost) always use

 if(inherits(x, "numeric"))

Why?  Because classes in R (S3 or S4) can *extend* other classes.
Example: Many of you know that after   fm <- glm(...)
class(fm) is   c("glm", "lm")   and so

> if(class(fm) == "lm")
+ "yes"
Warning message:
In if (class(fm) == "lm") "yes" :
  the condition has length > 1 and only the first element will be used

Similarly, in your case

y <- 1:10
class(y) <- c("myNumber", "numeric")

when that 'y' is a column in your data frame,
the test for  if(class(dataset[,i]) == "numeric")  will *not*
work but actually produce the above warning.

However, one  could als have had

Num <- setClass("Num", contains="numeric")
N <- Num(1:10)

 > Num <- setClass("Num", contains="numeric")
 > N <- Num(1:10)
 > N
 An object of class "Num"
  [1]  1  2  3  4  5  6  7  8  9 10
 > if(class(N) == "numeric") "yes" else "no"
 [1] "no"
 > 

I hope that many of the readers --- including *MANY* authors of
R packages !! --- have understood the above and will fix their R
code -- and even more their books where applicable !!

Martin Maechler,
ETH Zurich & R Core Team 
 
> 


> This way you can select variables of a certain class only and do 
> transformations. I found that this approach is not applicable if used with 
> statistical functions like head(). Transformations worked fine for me.
> 
> I found reading the above given source worthwile.
> 
> Kind regards
> 
> Georg
> 
> PS: I am not related to the above given authors. I am just a reader 
> reporting on - at least to me - a valuable ressource.
> 
> 
> 
> Von:Carl Sutton via R-help 
> An: William Dunlap , 
> Kopie:  "r-help@r-project.org" 
> Datum:  29.04.2016 22:08
> Betreff:Re: [R] selecting columns from a data frame or data table 
> by type, ie, numeric, integer
> Gesendet von:   "R-help" 
> 
> 
> 
> Thank you Bill Dunlap.  So simple I never tried that approach. Tried 
> dozens of others though, read manuals till I was getting headaches, and of 
> course the answer was simple when one is competent.   Learning, its a 
> struggle, but slowly getting there.
> Thanks again
>  Carl Sutton CPA
>  
> 
> On Friday, April 29, 2016 10:50 AM, William Dunlap  
> wrote:
>  
>  
> 
>  > dt1[ vapply(dt1, FUN=is.numeric, FUN.VALUE=NA) ]a   c1   1 1.12   2 
> 1.0...10 10 0.2
> 
> 
> Bill Dunlap
> TIBCO Software
> wdunlap tibco.com
> On Fri, Apr 29, 2016 at 9:19 AM, Carl Sutton via R-help 
>  wrote:
> 
> Good morning RGuru's
> I have a data frame of 575 columns.  I want to extract only those columns 
> that are numeric(double) or integer to do some machine learning with.  I 
> have searched the web for a couple of days (off and on) and have not found 
> anything that shows how to do this.   Lots of ways to extract rows, but 
> not columns.  I have attempted to use "(x == y)" indices extraction method 
> but that threw error that == was for atomic vectors and lists, and I was 
> doing this on a data frame.
> 
> My test code is below
> 
> #  a technique to get column classes
> library(data.table)
> a <- 1:10
> b <- c("a","b","c","d","e","f","g","h","i","j")
> c <- seq(1.1, .2, length = 10)
> dt1 <- data.table(a,b,c)
> str(dt1)
> col.classes <- sapply(dt1, class)
> head(col.classes)
> dt2 <- subset(dt1, typeof = "double" | "numeric")
> str(dt2)
> dt2   #  not subset
> dt2 <- dt1[, list(typeof = "double")]
> str(dt2)
> class_data <- dt1[,sapply(dt1,is.integer) | sapply(dt1, is.numeric)]
> class_data
> sum(class_data)
> typeof(class_data)
> names(class_data)
> str(class_data)
>  Any help is appreciated
> Carl Sutton CPA


Re: [R] Reading multiple tables from one .txt doc

2016-05-04 Thread Loris Bennett
Mark Fingerle  writes:

> Dear all,

> I have a .txt file which contains multiple tables and I would like to
> read these tables separately in order to create graphs for each one.
> The tables are separated by a blank line, have a variable number of
> lines, fixed nr. Of rows, have a header and a comment above the header
> (#) which contains a specific word that identifies each table. (see
> example below). It would be possible to change the layout of the .txt
> data a bit (Add a word, remove comment etc..)

> I would be extremely grateful if anyone could help me with this daunting task 
> :-)
> Example:
> # CoordA
> ImageX Y Z MeasuredMove MachineMove
> vf_36.png-114.345475   -89.043448 556.073402 
> 0 0
> vf_37.png-111.118715   -89.978534 606.040764 
> 50.080172   50.00
> vf_38.png-107.911209   -90.901958 656.025557 
> 50.096111   50.00
> vf_39.png-104.693931   -91.814392 705.982620 
> 50.068868   50.00
> vf_40.png-101.459549   -92.730113 755.983835 
> 50.114082   50.00
>
> # CoordB
> ImageX Y Z MeasuredMove MachineMove
> vf_36.png-115.345475   -89.043448 556.073402 
> 0 0
> vf_37.png-115.118715   -89.978534 606.040764 
> 50.080172   50.00
> vf_38.png-134.911209   -90.901958 656.025557 
> 50.096111   50.00
> vf_39.png-164.693931   -91.814392 705.982620 
> 50.068868   50.00
> vf_40.png-134.459549   -92.730113 755.983835 
> 50.114082   50.00
>
> # CoordC
> ImageX Y Z MeasuredMove MachineMove
> vf_36.png-168.345475   -89.043448 556.073402 
> 0 0
> vf_37.png-115.118715   -89.978534 606.040764 
> 50.080172   50.00
> vf_38.png-146.911209   -90.901958 656.025557 
> 50.096111   50.00
> vf_39.png-187.693931   -91.814392 705.982620 
> 50.068868   50.00
> vf_40.png-185.459549   -92.730113 755.983835 
> 50.114082   50.00
>
>   [[alternative HTML version deleted]]
>

This is not a solution if you really want separate graphs of the
individual tables, but you could add column "Coord", roll everything
into a single table and then create one or more facet plots from that.

Cheers,

Loris

-- 
This signature is currently under construction.

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