Re: [R] Problem installing rgdal.

2016-10-04 Thread Jeff Newmiller
And if that was not intuitively obvious, googling "CRAN Ubuntu" would lead you 
to [1]. There is also R-sig-debian for these kinds of OS-specific questions 
next time. (I wish there was an R-sig-windows, but I suppose no one would 
support it.)

[1] https://cran.r-project.org/bin/linux/ubuntu/
-- 
Sent from my phone. Please excuse my brevity.

On October 4, 2016 6:12:31 PM PDT, Bob Rudis  wrote:
>​Hey Ron,
>
>I (literally, in the correct use of the term) fired up an Ubuntu 16.04
>vagrant box - https://atlas.hashicorp.com/bento/boxes/ubuntu-16.04 -
>and
>then did:
>
>lsb_release -a
>No LSB modules are available.
>Distributor ID: Ubuntu
>Description: Ubuntu 16.04.1 LTS
>Release: 16.04
>Codename: xenial
>
>and, then:
>
>sudo echo "deb http://cran.rstudio.com/bin/linux/ubuntu xenial/" | sudo
>tee
>-a /etc/apt/sources.list
>gpg --keyserver keyserver.ubuntu.com --recv-key E084DAB9
>gpg -a --export E084DAB9 | sudo apt-key add -
>sudo apt-get update
>sudo apt-get install r-base r-base-dev
>sudo apt-get install libgdal-dev
>sudo apt-get install libproj4-dev
>
>and then did
>
>install.packages("rgdal")
>
>in an R session and it's working fine:
>
>> library(rgdal)
>Loading required package: sp
>rgdal: version: 1.1-10, (SVN revision 622)
>Geospatial Data Abstraction Library extensions to R successfully loaded
> Loaded GDAL runtime: GDAL 1.11.3, released 2015/09/16
> Path to GDAL shared files: /usr/share/gdal/1.11
>Loaded PROJ.4 runtime: Rel. 4.9.2, 08 September 2015, [PJ_VERSION: 492]
> Path to PROJ.4 shared files: (autodetected)
> Linking to sp version: 1.2-3
>
>I wish I could have run into errors and helped debug your issue, but it
>went in flawlessly.
>
>-Bob
>​
>
>
>On Tue, Oct 4, 2016 at 8:31 PM, Rolf Turner 
>wrote:
>
>> On 05/10/16 12:56, ProfJCNash wrote:
>>
>>> Can you build/install the source package? I had a problem once where
>my
>>> libraries were "too recent" for the R package,
>>> but I could build against my installed base. In any event, it may
>point
>>> out the source of the problem.
>>>
>>> I can appreciate your frustration -- been there, but wish I hadn't.
>>>
>>
>> Essentially install.packages() builds from source.
>>
>> I also tried to install from the source tarball; same error resulted.
>>
>> Surely there *must* be somebody out there who understands what's
>going on
>> and how to fix it.  Mustn't there?
>>
>> cheers,
>>
>> Rolf
>>
>> --
>> Technical Editor ANZJS
>> Department of Statistics
>> University of Auckland
>> Phone: +64-9-373-7599 ext. 88276
>>
>> __
>> 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/posti
>> ng-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-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] Problem installing rgdal.

2016-10-04 Thread Bob Rudis
​Hey Ron,

I (literally, in the correct use of the term) fired up an Ubuntu 16.04
vagrant box - https://atlas.hashicorp.com/bento/boxes/ubuntu-16.04 - and
then did:

lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 16.04.1 LTS
Release: 16.04
Codename: xenial

and, then:

sudo echo "deb http://cran.rstudio.com/bin/linux/ubuntu xenial/" | sudo tee
-a /etc/apt/sources.list
gpg --keyserver keyserver.ubuntu.com --recv-key E084DAB9
gpg -a --export E084DAB9 | sudo apt-key add -
sudo apt-get update
sudo apt-get install r-base r-base-dev
sudo apt-get install libgdal-dev
sudo apt-get install libproj4-dev

and then did

install.packages("rgdal")

in an R session and it's working fine:

> library(rgdal)
Loading required package: sp
rgdal: version: 1.1-10, (SVN revision 622)
 Geospatial Data Abstraction Library extensions to R successfully loaded
 Loaded GDAL runtime: GDAL 1.11.3, released 2015/09/16
 Path to GDAL shared files: /usr/share/gdal/1.11
 Loaded PROJ.4 runtime: Rel. 4.9.2, 08 September 2015, [PJ_VERSION: 492]
 Path to PROJ.4 shared files: (autodetected)
 Linking to sp version: 1.2-3

I wish I could have run into errors and helped debug your issue, but it
went in flawlessly.

-Bob
​


On Tue, Oct 4, 2016 at 8:31 PM, Rolf Turner  wrote:

> On 05/10/16 12:56, ProfJCNash wrote:
>
>> Can you build/install the source package? I had a problem once where my
>> libraries were "too recent" for the R package,
>> but I could build against my installed base. In any event, it may point
>> out the source of the problem.
>>
>> I can appreciate your frustration -- been there, but wish I hadn't.
>>
>
> Essentially install.packages() builds from source.
>
> I also tried to install from the source tarball; same error resulted.
>
> Surely there *must* be somebody out there who understands what's going on
> and how to fix it.  Mustn't there?
>
> cheers,
>
> Rolf
>
> --
> Technical Editor ANZJS
> Department of Statistics
> University of Auckland
> Phone: +64-9-373-7599 ext. 88276
>
> __
> 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/posti
> ng-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] Problem installing rgdal.

2016-10-04 Thread Rolf Turner

On 05/10/16 12:56, ProfJCNash wrote:

Can you build/install the source package? I had a problem once where my libraries were 
"too recent" for the R package,
but I could build against my installed base. In any event, it may point out the 
source of the problem.

I can appreciate your frustration -- been there, but wish I hadn't.


Essentially install.packages() builds from source.

I also tried to install from the source tarball; same error resulted.

Surely there *must* be somebody out there who understands what's going 
on and how to fix it.  Mustn't there?


cheers,

Rolf

--
Technical Editor ANZJS
Department of Statistics
University of Auckland
Phone: +64-9-373-7599 ext. 88276

__
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] Problem installing rgdal.

2016-10-04 Thread ProfJCNash
Can you build/install the source package? I had a problem once where my 
libraries were "too recent" for the R package,
but I could build against my installed base. In any event, it may point out the 
source of the problem.

I can appreciate your frustration -- been there, but wish I hadn't.

Best, JN

On 16-10-04 05:07 PM, Rolf Turner wrote:
> On 05/10/16 01:10, ProfJCNash wrote:
>> I found that I have libgdal1-dev installed too.
>>
>> john@john-J6-2015 ~ $ dpkg -l | grep gdal
>> ii  libgdal-dev 1.10.1+dfsg-5ubuntu1 
>>amd64
>> Geospatial Data Abstraction Library - Development files
>> ii  libgdal1-dev1.10.1+dfsg-5ubuntu1 
>>all
>> Geospatial Data Abstraction Library - Transitional package
>> ii  libgdal1h   1.10.1+dfsg-5ubuntu1 
>>amd64
>> Geospatial Data Abstraction Library
>> john@john-J6-2015 ~ $
>>
>> and I get the following outputs in R:
>>
>>> library(rgdal)
>> Loading required package: sp
>> rgdal: version: 1.1-10, (SVN revision 622)
>>  Geospatial Data Abstraction Library extensions to R successfully loaded
>>  Loaded GDAL runtime: GDAL 1.10.1, released 2013/08/26
>>  Path to GDAL shared files: /usr/share/gdal/1.10
>>  Loaded PROJ.4 runtime: Rel. 4.8.0, 6 March 2012, [PJ_VERSION: 480]
>>  Path to PROJ.4 shared files: (autodetected)
>>  Linking to sp version: 1.2-3
>>> sessionInfo()
>> R version 3.3.1 (2016-06-21)
>> Platform: x86_64-pc-linux-gnu (64-bit)
>> Running under: Ubuntu 14.04.4 LTS
>>
>> locale:
>>  [1] LC_CTYPE=en_CA.UTF-8   LC_NUMERIC=C
>>  [3] LC_TIME=en_CA.UTF-8LC_COLLATE=en_CA.UTF-8
>>  [5] LC_MONETARY=en_CA.UTF-8LC_MESSAGES=en_CA.UTF-8
>>  [7] LC_PAPER=en_CA.UTF-8   LC_NAME=C
>>  [9] LC_ADDRESS=C   LC_TELEPHONE=C
>> [11] LC_MEASUREMENT=en_CA.UTF-8 LC_IDENTIFICATION=C
>>
>> attached base packages:
>> [1] stats graphics  grDevices utils datasets  methods   base
>>
>> other attached packages:
>> [1] rgdal_1.1-10 sp_1.2-3
>>
>> loaded via a namespace (and not attached):
>> [1] grid_3.3.1  lattice_0.20-33
>>>
>>
>> Hope this is helpful.
> 
> 
> Afraid not.  I did not have libgdal1-dev installed, but having installed it I 
> tried
> install.packages("rgdal",lib="/home/rolf/Rlib")
> again and got the same damned error message as before.
> 
>> ** testing if installed package can be loaded
>> Error in dyn.load(file, DLLpath = DLLpath, ...) :
>>   unable to load shared object '/home/rolf/Rlib/rgdal/libs/rgdal.so':
>>   /home/rolf/Rlib/rgdal/libs/rgdal.so: undefined symbol: CPLQuietErrorHandler
>> Error: loading failed
>> Execution halted
> 
> Has anyone out there any other ideas as to what's going wrong for me and how 
> I might fix it?
> 
> cheers,
> 
> Rolf
>

__
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] Problem installing rgdal.

2016-10-04 Thread Rolf Turner

On 05/10/16 01:10, ProfJCNash wrote:

I found that I have libgdal1-dev installed too.

john@john-J6-2015 ~ $ dpkg -l | grep gdal
ii  libgdal-dev 1.10.1+dfsg-5ubuntu1
amd64
Geospatial Data Abstraction Library - Development files
ii  libgdal1-dev1.10.1+dfsg-5ubuntu1
all
Geospatial Data Abstraction Library - Transitional package
ii  libgdal1h   1.10.1+dfsg-5ubuntu1
amd64
Geospatial Data Abstraction Library
john@john-J6-2015 ~ $

and I get the following outputs in R:


library(rgdal)

Loading required package: sp
rgdal: version: 1.1-10, (SVN revision 622)
 Geospatial Data Abstraction Library extensions to R successfully loaded
 Loaded GDAL runtime: GDAL 1.10.1, released 2013/08/26
 Path to GDAL shared files: /usr/share/gdal/1.10
 Loaded PROJ.4 runtime: Rel. 4.8.0, 6 March 2012, [PJ_VERSION: 480]
 Path to PROJ.4 shared files: (autodetected)
 Linking to sp version: 1.2-3

sessionInfo()

R version 3.3.1 (2016-06-21)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 14.04.4 LTS

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

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

other attached packages:
[1] rgdal_1.1-10 sp_1.2-3

loaded via a namespace (and not attached):
[1] grid_3.3.1  lattice_0.20-33




Hope this is helpful.



Afraid not.  I did not have libgdal1-dev installed, but having installed 
it I tried install.packages("rgdal",lib="/home/rolf/Rlib")

again and got the same damned error message as before.


** testing if installed package can be loaded
Error in dyn.load(file, DLLpath = DLLpath, ...) :
  unable to load shared object '/home/rolf/Rlib/rgdal/libs/rgdal.so':
  /home/rolf/Rlib/rgdal/libs/rgdal.so: undefined symbol: CPLQuietErrorHandler
Error: loading failed
Execution halted


Has anyone out there any other ideas as to what's going wrong for me and 
how I might fix it?


cheers,

Rolf

--
Technical Editor ANZJS
Department of Statistics
University of Auckland
Phone: +64-9-373-7599 ext. 88276

__
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 Compile From Source Issue RHEL 6.5

2016-10-04 Thread Jeff Newmiller
You may get a response here, but the Posting Guide is pretty clear that this is 
not the recommended place to ask this question.
-- 
Sent from my phone. Please excuse my brevity.

On October 4, 2016 11:27:07 AM PDT, "Barros, Chris"  wrote:
>Hi-
>
>I’m compiling R from source and running into an issue when enabling
>--enable-R-shlib. I get the following below. I did try and add “-fPIC"
>to the bzip2 makefile with no luck.
>
>/usr/bin/ld: /usr/local/apps/R/3.3.1/library/lib/libbz2.a(bzlib.o):
>relocation R_X86_64_32S against `.text' can not be used when making a
>shared object; recompile with -fPIC
>
>/usr/local/apps/R/3.3.1/library/lib/libbz2.a: could not read symbols:
>Bad value
>
>collect2: ld returned 1 exit status
>
>
>
>
>apps/R/3.3.1/library/include/  -c g_cntrlify.c -o g_cntrlify.o
>
>gcc -std=gnu99 -I../../src/extra  -I. -I../../src/include
>-I../../src/include  -I/usr/local/include -I../../src/nmath
>-DHAVE_CONFIG_H   -fopenmp -fpic 
>-I/usr/local/apps/R/3.3.1/library/include/
>-I/usr/local/apps/R/3.3.1/library/include/  -c g_fontdb.c -o g_fontdb.o
>
>gcc -std=gnu99 -I../../src/extra  -I. -I../../src/include
>-I../../src/include  -I/usr/local/include -I../../src/nmath
>-DHAVE_CONFIG_H   -fopenmp -fpic 
>-I/usr/local/apps/R/3.3.1/library/include/
>-I/usr/local/apps/R/3.3.1/library/include/  -c g_her_glyph.c -o
>g_her_glyph.o
>
>gfortran  -fopenmp -fpic  -g -O2  -c xxxpr.f -o xxxpr.o
>
>gcc -std=gnu99 -shared -fopenmp -L/usr/local/apps/R/3.3.1/library/lib 
>-o libR.so CommandLineArgs.o Rdynload.o Renviron.o RNG.o agrep.o
>apply.o arithmetic.o array.o attrib.o bind.o builtin.o character.o
>coerce.o colors.o complex.o connections.o context.o cum.o dcf.o
>datetime.o debug.o deparse.o devices.o dotcode.o dounzip.o dstruct.o
>duplicate.o edit.o engine.o envir.o errors.o eval.o format.o gevents.o
>gram.o gram-ex.o graphics.o grep.o identical.o inlined.o inspect.o
>internet.o iosupport.o lapack.o list.o localecharset.o logic.o main.o
>mapply.o match.o memory.o names.o objects.o options.o paste.o
>platform.o plot.o plot3d.o plotmath.o print.o printarray.o
>printvector.o printutils.o qsort.o radixsort.o random.o raw.o
>registration.o relop.o rlocale.o saveload.o scan.o seq.o serialize.o
>sort.o source.o split.o sprintf.o startup.o subassign.o subscript.o
>subset.o summary.o sysutils.o times.o unique.o util.o version.o
>g_alab_her.o g_cntrlify.o g_fontdb.o g_her_glyph.o xxxpr.o   `ls
>../unix/*.o ../appl/*.o ../nmath/*.o` ../extra/tre/libtre.a   
>-L../../lib -lRblas -lgfortran -lm   -lreadline  -lpcre -llzma -lbz2
>-lz -lrt -ldl -lm
>
>/usr/bin/ld: /usr/local/apps/R/3.3.1/library/lib/libbz2.a(bzlib.o):
>relocation R_X86_64_32S against `.text' can not be used when making a
>shared object; recompile with -fPIC
>
>/usr/local/apps/R/3.3.1/library/lib/libbz2.a: could not read symbols:
>Bad value
>
>collect2: ld returned 1 exit status
>
>make[3]: *** [libR.so] Error 1
>
>make[3]: Leaving directory
>`/usr/local/apps/R/3.3.1/R-3.3.1-source/src/main'
>
>make[2]: *** [R] Error 2
>
>make[2]: Leaving directory
>`/usr/local/apps/R/3.3.1/R-3.3.1-source/src/main'
>
>make[1]: *** [R] Error 1
>
>make[1]: Leaving directory `/usr/local/apps/R/3.3.1/R-3.3.1-source/src'
>
>make: *** [R] Error 1
>
>Any help would be appreciated.
>
>Christopher Barros | Sr. Systems Engineer| Information Technology Group
>| Harvard Business School| 617.496.5180|
>cbar...@hbs.edu
>
>
>   [[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.

Re: [R] NA treatment when comparing two vectors

2016-10-04 Thread fabien verger
Thank you all - Bert, Marc and William - for your suggestions and the
material (Rseek, r4stats.com...).
Following your advices, I will create a dedicated function since I will
have to use this tool in many programs.
Actually, I regularly load economic data from various sources and I need to
spot what is *different* than the previous version, and what is *new*,
hence the utility of this function and this special NA treatment.
Thanks again for your help and for your reactivity.
Fabien


2016-10-04 21:17 GMT+02:00 Marc Schwartz :

> Bill,
>
> I had initially thought of using all.equal() along with isTrue(), however
> Fabien's desire for a pairwise element based approach, along with the
> specific NA handling steered me away from it and towards code along the
> lines of what Bert had offered, which builds on the basic notion of
> approximate numeric equality as used in all.equal().
>
> Regards,
>
> Marc
>
>
> > On Oct 4, 2016, at 2:02 PM, William Dunlap via R-help <
> r-help@r-project.org> wrote:
> >
> > The all.equal function returns TRUE if two objects are pretty similar to
> > one another and a textual description of the differences if not.  Use
> > isTRUE on its output if you just want a TRUE/FALSE answer.
> >
> >> all.equal(c(1,2*(1+.Machine$double.eps),NaN), c(1,2,NaN))
> >  [1] TRUE
> >> all.equal(c(1,2*(1+.Machine$double.eps),NaN), c(1,2,NaN), tolerance=0)
> >  [1] "Mean relative difference: 2.220446e-16"
> >> isTRUE(all.equal(c(1,2*(1+.Machine$double.eps),NaN), c(1,2,NaN),
> > tolerance=0))
> >  [1] FALSE
> >> all.equal(c(a=1, b=2), c(x=1, b=2))
> >  [1] "Names: 1 string mismatch"
> >
> >
> >
> > Bill Dunlap
> > TIBCO Software
> > wdunlap tibco.com
> >
> > On Tue, Oct 4, 2016 at 9:51 AM, fabien verger 
> > wrote:
> >
> >> Hello,
> >>
> >> I want to get the differences when comparing 2 vectors, by pair
> (element by
> >> element).
> >> I'd like to get TRUEs when:
> >> - the two compared elements are different and non-missing (like `!=`
> does)
> >> - one element is missing and the other is not missing (unfortunatelly
> `!=`
> >> gives NA and not TRUE)
> >> Note that I don't want to get TRUEs when both are missing. NA or FALSE
> are
> >> fine.
> >>
> >> Given a and b:
> >>> a <- c(1, 2, 3,  NA, NA)
> >>> b <- c(1, 9, NA, 4 , NA)
> >>
> >> The only solution I found is:
> >>
> >>> a != b | (is.na(a) != is.na(b))
> >> [1] FALSE  TRUE  TRUE  TRUENA
> >>
> >> Is there a single function which can do the same?
> >> I searched for other comparison tools but found nothing relevant.
> >>
> >> And I would like also to avoid using `!=` because I'm often comparing
> >> floating numbers computed by different algorithms (so rounded
> differently).
> >>
> >> I found identical() interesting (for exemple, !(identical(NA, 99)) gives
> >> TRUE) but the result of !(identical(a, b) is a single logical, not a
> vector
> >> of logicals.
> >>
> >> Many thanks in advance for your help.
> >> P.S. I am new to R, coming from SAS. Actually, I'm looking for the R
> >> function that replicates the SAS instruction: if a ^= b;
> >>
> >>[[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.
>
>

[[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 Compile From Source Issue RHEL 6.5

2016-10-04 Thread Barros, Chris
Hi-

I’m compiling R from source and running into an issue when enabling 
--enable-R-shlib. I get the following below. I did try and add “-fPIC" to the 
bzip2 makefile with no luck.

/usr/bin/ld: /usr/local/apps/R/3.3.1/library/lib/libbz2.a(bzlib.o): relocation 
R_X86_64_32S against `.text' can not be used when making a shared object; 
recompile with -fPIC

/usr/local/apps/R/3.3.1/library/lib/libbz2.a: could not read symbols: Bad value

collect2: ld returned 1 exit status




apps/R/3.3.1/library/include/  -c g_cntrlify.c -o g_cntrlify.o

gcc -std=gnu99 -I../../src/extra  -I. -I../../src/include -I../../src/include  
-I/usr/local/include -I../../src/nmath -DHAVE_CONFIG_H   -fopenmp -fpic  
-I/usr/local/apps/R/3.3.1/library/include/ 
-I/usr/local/apps/R/3.3.1/library/include/  -c g_fontdb.c -o g_fontdb.o

gcc -std=gnu99 -I../../src/extra  -I. -I../../src/include -I../../src/include  
-I/usr/local/include -I../../src/nmath -DHAVE_CONFIG_H   -fopenmp -fpic  
-I/usr/local/apps/R/3.3.1/library/include/ 
-I/usr/local/apps/R/3.3.1/library/include/  -c g_her_glyph.c -o g_her_glyph.o

gfortran  -fopenmp -fpic  -g -O2  -c xxxpr.f -o xxxpr.o

gcc -std=gnu99 -shared -fopenmp -L/usr/local/apps/R/3.3.1/library/lib  -o 
libR.so CommandLineArgs.o Rdynload.o Renviron.o RNG.o agrep.o apply.o 
arithmetic.o array.o attrib.o bind.o builtin.o character.o coerce.o colors.o 
complex.o connections.o context.o cum.o dcf.o datetime.o debug.o deparse.o 
devices.o dotcode.o dounzip.o dstruct.o duplicate.o edit.o engine.o envir.o 
errors.o eval.o format.o gevents.o gram.o gram-ex.o graphics.o grep.o 
identical.o inlined.o inspect.o internet.o iosupport.o lapack.o list.o 
localecharset.o logic.o main.o mapply.o match.o memory.o names.o objects.o 
options.o paste.o platform.o plot.o plot3d.o plotmath.o print.o printarray.o 
printvector.o printutils.o qsort.o radixsort.o random.o raw.o registration.o 
relop.o rlocale.o saveload.o scan.o seq.o serialize.o sort.o source.o split.o 
sprintf.o startup.o subassign.o subscript.o subset.o summary.o sysutils.o 
times.o unique.o util.o version.o g_alab_her.o g_cntrlify.o g_fontdb.o 
g_her_glyph.o xxxpr.o   `ls ../unix/*.o ../appl/*.o ../nmath/*.o` 
../extra/tre/libtre.a-L../../lib -lRblas -lgfortran -lm   -lreadline  
-lpcre -llzma -lbz2 -lz -lrt -ldl -lm

/usr/bin/ld: /usr/local/apps/R/3.3.1/library/lib/libbz2.a(bzlib.o): relocation 
R_X86_64_32S against `.text' can not be used when making a shared object; 
recompile with -fPIC

/usr/local/apps/R/3.3.1/library/lib/libbz2.a: could not read symbols: Bad value

collect2: ld returned 1 exit status

make[3]: *** [libR.so] Error 1

make[3]: Leaving directory `/usr/local/apps/R/3.3.1/R-3.3.1-source/src/main'

make[2]: *** [R] Error 2

make[2]: Leaving directory `/usr/local/apps/R/3.3.1/R-3.3.1-source/src/main'

make[1]: *** [R] Error 1

make[1]: Leaving directory `/usr/local/apps/R/3.3.1/R-3.3.1-source/src'

make: *** [R] Error 1

Any help would be appreciated.

Christopher Barros | Sr. Systems Engineer| Information Technology Group | 
Harvard Business School| 617.496.5180| 
cbar...@hbs.edu


[[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] NA treatment when comparing two vectors

2016-10-04 Thread Marc Schwartz
Bill,

I had initially thought of using all.equal() along with isTrue(), however 
Fabien's desire for a pairwise element based approach, along with the specific 
NA handling steered me away from it and towards code along the lines of what 
Bert had offered, which builds on the basic notion of approximate numeric 
equality as used in all.equal().

Regards,

Marc


> On Oct 4, 2016, at 2:02 PM, William Dunlap via R-help  
> wrote:
> 
> The all.equal function returns TRUE if two objects are pretty similar to
> one another and a textual description of the differences if not.  Use
> isTRUE on its output if you just want a TRUE/FALSE answer.
> 
>> all.equal(c(1,2*(1+.Machine$double.eps),NaN), c(1,2,NaN))
>  [1] TRUE
>> all.equal(c(1,2*(1+.Machine$double.eps),NaN), c(1,2,NaN), tolerance=0)
>  [1] "Mean relative difference: 2.220446e-16"
>> isTRUE(all.equal(c(1,2*(1+.Machine$double.eps),NaN), c(1,2,NaN),
> tolerance=0))
>  [1] FALSE
>> all.equal(c(a=1, b=2), c(x=1, b=2))
>  [1] "Names: 1 string mismatch"
> 
> 
> 
> Bill Dunlap
> TIBCO Software
> wdunlap tibco.com
> 
> On Tue, Oct 4, 2016 at 9:51 AM, fabien verger 
> wrote:
> 
>> Hello,
>> 
>> I want to get the differences when comparing 2 vectors, by pair (element by
>> element).
>> I'd like to get TRUEs when:
>> - the two compared elements are different and non-missing (like `!=` does)
>> - one element is missing and the other is not missing (unfortunatelly `!=`
>> gives NA and not TRUE)
>> Note that I don't want to get TRUEs when both are missing. NA or FALSE are
>> fine.
>> 
>> Given a and b:
>>> a <- c(1, 2, 3,  NA, NA)
>>> b <- c(1, 9, NA, 4 , NA)
>> 
>> The only solution I found is:
>> 
>>> a != b | (is.na(a) != is.na(b))
>> [1] FALSE  TRUE  TRUE  TRUENA
>> 
>> Is there a single function which can do the same?
>> I searched for other comparison tools but found nothing relevant.
>> 
>> And I would like also to avoid using `!=` because I'm often comparing
>> floating numbers computed by different algorithms (so rounded differently).
>> 
>> I found identical() interesting (for exemple, !(identical(NA, 99)) gives
>> TRUE) but the result of !(identical(a, b) is a single logical, not a vector
>> of logicals.
>> 
>> Many thanks in advance for your help.
>> P.S. I am new to R, coming from SAS. Actually, I'm looking for the R
>> function that replicates the SAS instruction: if a ^= b;
>> 
>>[[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-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] NA treatment when comparing two vectors

2016-10-04 Thread William Dunlap via R-help
The all.equal function returns TRUE if two objects are pretty similar to
one another and a textual description of the differences if not.  Use
isTRUE on its output if you just want a TRUE/FALSE answer.

  > all.equal(c(1,2*(1+.Machine$double.eps),NaN), c(1,2,NaN))
  [1] TRUE
  > all.equal(c(1,2*(1+.Machine$double.eps),NaN), c(1,2,NaN), tolerance=0)
  [1] "Mean relative difference: 2.220446e-16"
  > isTRUE(all.equal(c(1,2*(1+.Machine$double.eps),NaN), c(1,2,NaN),
tolerance=0))
  [1] FALSE
  > all.equal(c(a=1, b=2), c(x=1, b=2))
  [1] "Names: 1 string mismatch"



Bill Dunlap
TIBCO Software
wdunlap tibco.com

On Tue, Oct 4, 2016 at 9:51 AM, fabien verger 
wrote:

> Hello,
>
> I want to get the differences when comparing 2 vectors, by pair (element by
> element).
> I'd like to get TRUEs when:
> - the two compared elements are different and non-missing (like `!=` does)
> - one element is missing and the other is not missing (unfortunatelly `!=`
> gives NA and not TRUE)
> Note that I don't want to get TRUEs when both are missing. NA or FALSE are
> fine.
>
> Given a and b:
> > a <- c(1, 2, 3,  NA, NA)
> > b <- c(1, 9, NA, 4 , NA)
>
> The only solution I found is:
>
> > a != b | (is.na(a) != is.na(b))
> [1] FALSE  TRUE  TRUE  TRUENA
>
> Is there a single function which can do the same?
> I searched for other comparison tools but found nothing relevant.
>
> And I would like also to avoid using `!=` because I'm often comparing
> floating numbers computed by different algorithms (so rounded differently).
>
> I found identical() interesting (for exemple, !(identical(NA, 99)) gives
> TRUE) but the result of !(identical(a, b) is a single logical, not a vector
> of logicals.
>
> Many thanks in advance for your help.
> P.S. I am new to R, coming from SAS. Actually, I'm looking for the R
> function that replicates the SAS instruction: if a ^= b;
>
> [[alternative HTML version deleted]]
>
> __
> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/
> posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] NA treatment when comparing two vectors

2016-10-04 Thread Marc Schwartz
Hi,

A couple of comments:

1. Fabien, since you are transitioning from SAS, you may find the resources 
that Bob Muenchen has made available to be of value:

http://r4stats.com/ 

There is a free download (PDF) of an earlier version of his book available via 
his web site as well.


2. Presuming that Bert's approach satisfies your functional requirements in 
this case, you can encapsulate his code into a function that you might find 
easier to use moving forward. For example:

IsDiff <- function(a, b, tol = 1e-15) {
  xor(is.na(a),is.na(b)) | (abs(b-a) > tol)
}

a <- c(1, 2, 3,  NA, NA)
b <- c(1, 9, NA, 4 , NA)

> IsDiff(a, b)
[1] FALSE  TRUE  TRUE  TRUENA

Of course, you can call the function anything you wish, as long as it is a 
legal object name in R.

You could even create a new infix operator along the lines of the following, 
with the restriction that this approach can only take two arguments, so you 
would hard code the tolerance level in the function body:

"%ID%" <- function(a, b) {
  xor(is.na(a),is.na(b)) | (abs(b-a) > 1e-15)
}

> a %ID% b
[1] FALSE  TRUE  TRUE  TRUENA


Bear in mind that a substantial portion of R is written in R itself, with a 
core set of functionality in C and FORTRAN where performance is materially 
enhanced by the use of compiled code. Thus, extending R's functionality, as 
Bert notes, is typically done by useRs encapsulating enhanced functionality in 
new R functions and the now thousands of packages on CRAN generally follow that 
same paradigm for specific applications.

Regards,

Marc Schwartz


> On Oct 4, 2016, at 12:33 PM, Bert Gunter  wrote:
> 
> Fabien:
> 
> In general, R's philosophy as a programming language is that it should
> make it easy (and maybe efficient) to do the (data analysis) things
> you want to do, not necessarily provide all pre-packaged procedures
> (although with all the packages, it seems to come close to that!). So
> the following seems to fall into that paradigm (using your example a
> and b)
> 
>> tol <- 1e-15
> 
>> xor(is.na(a),is.na(b)) | (abs(b-a) > tol)
> [1] FALSE  TRUE  TRUE  TRUENA
> 
> 
> As you noted, defining equality of floating point numbers is a tricky
> business, so that you may prefer some other approach to that which I
> used. There may well be "pre-packaged" ways to do this, but I didn't
> look. You might try searching rseek.org for "defining numerical
> equality in R" or some such to see.
> 
> 
> 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 Tue, Oct 4, 2016 at 9:51 AM, fabien verger  wrote:
>> Hello,
>> 
>> I want to get the differences when comparing 2 vectors, by pair (element by
>> element).
>> I'd like to get TRUEs when:
>> - the two compared elements are different and non-missing (like `!=` does)
>> - one element is missing and the other is not missing (unfortunatelly `!=`
>> gives NA and not TRUE)
>> Note that I don't want to get TRUEs when both are missing. NA or FALSE are
>> fine.
>> 
>> Given a and b:
>>> a <- c(1, 2, 3,  NA, NA)
>>> b <- c(1, 9, NA, 4 , NA)
>> 
>> The only solution I found is:
>> 
>>> a != b | (is.na(a) != is.na(b))
>> [1] FALSE  TRUE  TRUE  TRUENA
>> 
>> Is there a single function which can do the same?
>> I searched for other comparison tools but found nothing relevant.
>> 
>> And I would like also to avoid using `!=` because I'm often comparing
>> floating numbers computed by different algorithms (so rounded differently).
>> 
>> I found identical() interesting (for exemple, !(identical(NA, 99)) gives
>> TRUE) but the result of !(identical(a, b) is a single logical, not a vector
>> of logicals.
>> 
>> Many thanks in advance for your help.
>> P.S. I am new to R, coming from SAS. Actually, I'm looking for the R
>> function that replicates the SAS instruction: if a ^= b;


[[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] NA treatment when comparing two vectors

2016-10-04 Thread Bert Gunter
Fabien:

In general, R's philosophy as a programming language is that it should
make it easy (and maybe efficient) to do the (data analysis) things
you want to do, not necessarily provide all pre-packaged procedures
(although with all the packages, it seems to come close to that!). So
the following seems to fall into that paradigm (using your example a
and b)

> tol <- 1e-15

> xor(is.na(a),is.na(b)) | (abs(b-a) > tol)
[1] FALSE  TRUE  TRUE  TRUENA


As you noted, defining equality of floating point numbers is a tricky
business, so that you may prefer some other approach to that which I
used. There may well be "pre-packaged" ways to do this, but I didn't
look. You might try searching rseek.org for "defining numerical
equality in R" or some such to see.


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 Tue, Oct 4, 2016 at 9:51 AM, fabien verger  wrote:
> Hello,
>
> I want to get the differences when comparing 2 vectors, by pair (element by
> element).
> I'd like to get TRUEs when:
> - the two compared elements are different and non-missing (like `!=` does)
> - one element is missing and the other is not missing (unfortunatelly `!=`
> gives NA and not TRUE)
> Note that I don't want to get TRUEs when both are missing. NA or FALSE are
> fine.
>
> Given a and b:
>> a <- c(1, 2, 3,  NA, NA)
>> b <- c(1, 9, NA, 4 , NA)
>
> The only solution I found is:
>
>> a != b | (is.na(a) != is.na(b))
> [1] FALSE  TRUE  TRUE  TRUENA
>
> Is there a single function which can do the same?
> I searched for other comparison tools but found nothing relevant.
>
> And I would like also to avoid using `!=` because I'm often comparing
> floating numbers computed by different algorithms (so rounded differently).
>
> I found identical() interesting (for exemple, !(identical(NA, 99)) gives
> TRUE) but the result of !(identical(a, b) is a single logical, not a vector
> of logicals.
>
> Many thanks in advance for your help.
> P.S. I am new to R, coming from SAS. Actually, I'm looking for the R
> function that replicates the SAS instruction: if a ^= b;
>
> [[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.


Re: [R] To submit R jobs via SLURM

2016-10-04 Thread Sema Atasever
Thank you very much for your help.

On Mon, Oct 3, 2016 at 10:35 PM, Erin Hodgess 
wrote:

> Get a SLURM batch file from someone there and make the appropriate changes
> to it.  Best way to learn.
>
>
>
> On Mon, Oct 3, 2016 at 2:10 PM, Dominik Schneider 
> wrote:
>
>> I typically call Rscript inside an sbatch file.
>>
>> *batch_r.sh*
>> #! /bin/bash
>>
>> cd /home//aso_regression_project #make sure you change to
>> your
>> correct working directory
>> Rscript scripts/run_splitsample-modeling.R
>>
>>
>> and on the commandline of the login node:
>> sbatch batch_r.sh
>>
>>
>> There are lots of slurm configurations you can specify. Google for them.
>> Just add these under the first line and modify as needed:
>> #SBATCH --qos=
>> #SBATCH --mem=
>> #SBATCH --mail-type=begin,end,abort
>> #SBATCH --mail-user=use...@email.com
>> #SBATCH --time=
>> #SBATCH --nodes=
>> #SBATCH --job-name=myjob
>> #SBATCH --output=/home//run-%A_%a.Sout #special output filename
>>
>>
>> Dominik
>>
>>
>> On Mon, Oct 3, 2016 at 3:03 AM, Sema Atasever 
>> wrote:
>>
>> > Dear Authorized Sir / Madam,
>> >
>> > I have an R script file in which it includes this lines:
>> >
>> > How can i to submit this R jobs via SLURM? Thanks in advance.
>> >
>> > *testscript.R*
>> > data=read.table("seqDist.50", header=FALSE)[-1]
>> > attach(data)
>> > d=as.matrix(data)
>> > library(cluster)
>> > cluster.pam = pam(d,6)
>> > table(cluster.pam$clustering)
>> >
>> > filenameclu = paste("outputfile", ".txt")
>> > write.table(cluster.pam$clustering, file=outputfile,sep=",")
>> >
>> > [[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/posti
>> ng-guide.html
>> and provide commented, minimal, self-contained, reproducible code.
>>
>
>
>
> --
> Erin Hodgess
> Associate Professor
> Department of Mathematical and Statistics
> University of Houston - Downtown
> mailto: erinm.hodg...@gmail.com
>

[[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] R-help Digest, Vol 164, Issue 4

2016-10-04 Thread Kamil Bartoń

Hi Caitie,
whatever it is you want to achieve, you seem to be doing it in a very complicated way. The code you 
gave appears to be for producing a model selection table, yet you say you're trying to do model 
averaging.


If you want a model selection table, why not use the one `dredge` produces (with evaluate=TRUE, you 
can add R^2 via argument 'extra')?
If you actually mean model averaging, there is `model.avg` that can be used directly on `dredge`'s 
output.


cheers,
k



W dniu 2016-10-04 o 12:00, r-help-requ...@r-project.org pisze:

Message: 10
Date: Mon, 3 Oct 2016 05:47:11 +
From: Caitie Kuempel 
To: "r-help@r-project.org" 
Subject: [R] Error in aictab with CLM model "function not yet defined"
Message-ID: 
Content-Type: text/plain; charset="UTF-8"

Hi R help,

I am trying to do some AIC model averaging on a CLM model in R and keep getting 
the error:

Error in aictab.default(cand.set = Cand.model0, modnames = Modnames0,  :
Function not yet defined for this object class


The MuMIn package says that the functions should work for clm and clmm models 
so I'm not sure if I'm missing something or if there is an extra step?  Any 
help or examples would be appreciated.

My model (m1) works fine- which I fit using the clm() function from the package 
ordinal.  Then I run the following:

dred<-dredge(m1,rank="AICc",trace=TRUE,evaluate=FALSE)
Cand.model0<-list()
r2val<-rep(0,length(dred)) # r-square values
for(i in 1:length(dred))
{
  print(length(dred)-i)
  Cand.model0[[i]]<-clm(as.character(dred[[i]])[2],data=datt2,REML=FALSE)
  #r2val[i]<-summary(Cand.model0[[i]])$r.squared
}

Modnames0 <- paste("mod", 1:length(Cand.model0), sep = " ")
t0<-aictab(cand.set=Cand.model0, modnames=Modnames0, sort = TRUE, second.ord = 
TRUE,nobs = NULL)
Error in aictab.default(cand.set = Cand.model0, modnames = Modnames0,  :
Function not yet defined for this object class

Thanks for your time.

Best,

Caitie

[[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] NA treatment when comparing two vectors

2016-10-04 Thread fabien verger
Hello,

I want to get the differences when comparing 2 vectors, by pair (element by
element).
I'd like to get TRUEs when:
- the two compared elements are different and non-missing (like `!=` does)
- one element is missing and the other is not missing (unfortunatelly `!=`
gives NA and not TRUE)
Note that I don't want to get TRUEs when both are missing. NA or FALSE are
fine.

Given a and b:
> a <- c(1, 2, 3,  NA, NA)
> b <- c(1, 9, NA, 4 , NA)

The only solution I found is:

> a != b | (is.na(a) != is.na(b))
[1] FALSE  TRUE  TRUE  TRUENA

Is there a single function which can do the same?
I searched for other comparison tools but found nothing relevant.

And I would like also to avoid using `!=` because I'm often comparing
floating numbers computed by different algorithms (so rounded differently).

I found identical() interesting (for exemple, !(identical(NA, 99)) gives
TRUE) but the result of !(identical(a, b) is a single logical, not a vector
of logicals.

Many thanks in advance for your help.
P.S. I am new to R, coming from SAS. Actually, I'm looking for the R
function that replicates the SAS instruction: if a ^= b;

[[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] What does lm() output coefficient mean when it's been given a categorical predictor of string values?

2016-10-04 Thread peter dalgaard

> On 04 Oct 2016, at 17:39 , mviljamaa  wrote:
> 
> I'm using lm() for a model that has a predictor that has two values {poika, 
> tyttö} (boy and girl in Finnish).
> 
> I make a model with this categorical variable:
> 
> fit1 <- lm(dta$X.U.FEFF..mpist. ~ dta$sukup + dta$HISEI + dta$SES)
> 
> and while the variable/vector is here named as dta$sukup, what lm() returns 
> is a coefficient
> 
> dta$sukuptyttö
>   -6.19756
> 
> What does the added 'tyttö' in the variable mean? Does it mean that 'tyttö' 
> has been interpreted as 1 and 'poika' as 0?

Short answer: Yes.

Long answer: Yes, if treatment contrast parametrization is being used.

See help(contrasts) for a lead-in to an even longer answer.

-- 
Peter Dalgaard, Professor,
Center for Statistics, Copenhagen Business School
Solbjerg Plads 3, 2000 Frederiksberg, Denmark
Phone: (+45)38153501
Office: A 4.23
Email: pd@cbs.dk  Priv: pda...@gmail.com

__
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] What does lm() output coefficient mean when it's been given a categorical predictor of string values?

2016-10-04 Thread David Winsemius

> On Oct 4, 2016, at 8:39 AM, mviljamaa  wrote:
> 
> I'm using lm() for a model that has a predictor that has two values {poika, 
> tyttö} (boy and girl in Finnish).
> 
> I make a model with this categorical variable:
> 
> fit1 <- lm(dta$X.U.FEFF..mpist. ~ dta$sukup + dta$HISEI + dta$SES)
> 
> and while the variable/vector is here named as dta$sukup, what lm() returns 
> is a coefficient
> 
> dta$sukuptyttö
> -6.19756
> 
> What does the added 'tyttö' in the variable mean? Does it mean that 'tyttö' 
> has been interpreted as 1 and 'poika' as 0?

Yes.


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

__
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] What does lm() output coefficient mean when it's been given a categorical predictor of string values?

2016-10-04 Thread mviljamaa
I'm using lm() for a model that has a predictor that has two values 
{poika, tyttö} (boy and girl in Finnish).


I make a model with this categorical variable:

fit1 <- lm(dta$X.U.FEFF..mpist. ~ dta$sukup + dta$HISEI + dta$SES)

and while the variable/vector is here named as dta$sukup, what lm() 
returns is a coefficient


dta$sukuptyttö
 -6.19756

What does the added 'tyttö' in the variable mean? Does it mean that 
'tyttö' has been interpreted as 1 and 'poika' as 0?


__
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] Trouble with parameter estimation in nonlinear regression model

2016-10-04 Thread Adams, Jean
Syela,

If you want to constrain parameter "a" to be positive, you can rewrite the
equation replacing "a" with "exp(theta)".  Then when you get the estimate
for "theta", simply convert it back to "a".

Jean

On Mon, Oct 3, 2016 at 12:23 PM, Syela Mohd Noor 
wrote:

> Hi all, I had a problem with the parameter estimation of the Brass Gompertz
> model for my dissertation. I run the code for several times based on
> different years and it was fine until the seventh year onward where I got
> negative values for the parameter (a) which did not make sense since it
> represents the total fertility rate of a country.
> This is my code :
>
> gom.eq=function(a, b, c)
>
> {
>
> age=c(17.5, 22.5, 27.5, 32.5, 37.5, 42.5 , 47.5)
>
> k=(-(age-14)/b)
>
> (a*((c/b)*(exp((k)-(c*(exp(k)))
>
> }
>
>
>
> varlist=list(
> ASFR$Y1960,ASFR$Y1965,ASFR$Y1970,ASFR$Y1975,ASFR$Y1980,ASFR$Y1985,
>
> ASFR$Y1990,ASFR$Y1995,ASFR$Y2000,ASFR$Y2005,ASFR$Y2010,ASFR$Y2013)
>
>
>
> gom.models=lapply(varlist, function(varlist)
>
> {
>
> nlsLM(varlist~gom.eq(a,b,c),data=ASFR,start=list(a=1 , b=1, c=1),trace=T)
>
> })
>
> summary(gom.models)
>
>
>
> gom.models[1:12]
>
>
>
>
> Any idea to solve the problem?
>
>
> Regards,
>
> Syela M.N.
>
> [[alternative HTML version deleted]]
>
> __
> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/
> posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>
>

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Problem installing rgdal.

2016-10-04 Thread ProfJCNash
I found that I have libgdal1-dev installed too.

john@john-J6-2015 ~ $ dpkg -l | grep gdal
ii  libgdal-dev 1.10.1+dfsg-5ubuntu1
amd64
Geospatial Data Abstraction Library - Development files
ii  libgdal1-dev1.10.1+dfsg-5ubuntu1
all
Geospatial Data Abstraction Library - Transitional package
ii  libgdal1h   1.10.1+dfsg-5ubuntu1
amd64
Geospatial Data Abstraction Library
john@john-J6-2015 ~ $

and I get the following outputs in R:

> library(rgdal)
Loading required package: sp
rgdal: version: 1.1-10, (SVN revision 622)
 Geospatial Data Abstraction Library extensions to R successfully loaded
 Loaded GDAL runtime: GDAL 1.10.1, released 2013/08/26
 Path to GDAL shared files: /usr/share/gdal/1.10
 Loaded PROJ.4 runtime: Rel. 4.8.0, 6 March 2012, [PJ_VERSION: 480]
 Path to PROJ.4 shared files: (autodetected)
 Linking to sp version: 1.2-3
> sessionInfo()
R version 3.3.1 (2016-06-21)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 14.04.4 LTS

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

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

other attached packages:
[1] rgdal_1.1-10 sp_1.2-3

loaded via a namespace (and not attached):
[1] grid_3.3.1  lattice_0.20-33
>

Hope this is helpful.

JN

On 16-10-04 02:19 AM, Rolf Turner wrote:
> 
> I have recently acquired a new laptop and a new OS (Ubuntu 16.04) and have 
> encountered a problem when trying to install
> rgdal.
> 
> The initial hiccups were overcome by installing "libgdal-dev" and 
> "libproj-dev" on my system, and then re-installing the
> package "sp" (as advised by postings that I googled up on StackOverflow.
> 
> But then I came to a shuddering halt when I got the following error response 
> to run
> install.packages("rgdal",lib="/home/rolf/Rlib")
> 
> Error in dyn.load(file, DLLpath = DLLpath, ...) :
>   unable to load shared object '/home/rolf/Rlib/rgdal/libs/rgdal.so':
>   /home/rolf/Rlib/rgdal/libs/rgdal.so: undefined symbol: CPLQuietErrorHandler
> 
> I've googled around a bit on that and could find nothing that I could 
> comprehend.
> 
> Can anyone point me in the right direction?  Ta.
> 
> cheers,
> 
> Rolf Turner

__
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] Error in aictab with CLM model "function not yet defined"

2016-10-04 Thread Kamil Bartoń

Hi Caitie,
whatever it is you want to achieve, you seem to be doing it in a very complicated way. The code you 
gave appears to be for producing a model selection table, yet you say you're trying to do model 
averaging.


If you want a model selection table, why not use the one `dredge` produces (with evaluate=TRUE, you 
can add R^2 via argument 'extra')?
If you actually mean model averaging, there is `model.avg` that can be used directly on `dredge`'s 
output.


cheers,
k



W dniu 2016-10-04 o 12:00, r-help-requ...@r-project.org pisze:

Message: 10
Date: Mon, 3 Oct 2016 05:47:11 +
From: Caitie Kuempel 
To: "r-help@r-project.org" 
Subject: [R] Error in aictab with CLM model "function not yet defined"
Message-ID: 
Content-Type: text/plain; charset="UTF-8"

Hi R help,

I am trying to do some AIC model averaging on a CLM model in R and keep getting 
the error:

Error in aictab.default(cand.set = Cand.model0, modnames = Modnames0,  :
Function not yet defined for this object class


The MuMIn package says that the functions should work for clm and clmm models 
so I'm not sure if I'm missing something or if there is an extra step?  Any 
help or examples would be appreciated.

My model (m1) works fine- which I fit using the clm() function from the package 
ordinal.  Then I run the following:

dred<-dredge(m1,rank="AICc",trace=TRUE,evaluate=FALSE)
Cand.model0<-list()
r2val<-rep(0,length(dred)) # r-square values
for(i in 1:length(dred))
{
  print(length(dred)-i)
  Cand.model0[[i]]<-clm(as.character(dred[[i]])[2],data=datt2,REML=FALSE)
  #r2val[i]<-summary(Cand.model0[[i]])$r.squared
}

Modnames0 <- paste("mod", 1:length(Cand.model0), sep = " ")
t0<-aictab(cand.set=Cand.model0, modnames=Modnames0, sort = TRUE, second.ord = 
TRUE,nobs = NULL)
Error in aictab.default(cand.set = Cand.model0, modnames = Modnames0,  :
Function not yet defined for this object class

Thanks for your time.

Best,

Caitie

[[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] Problem installing rgdal.

2016-10-04 Thread Rolf Turner


I have recently acquired a new laptop and a new OS (Ubuntu 16.04) and 
have encountered a problem when trying to install rgdal.


The initial hiccups were overcome by installing "libgdal-dev" and 
"libproj-dev" on my system, and then re-installing the package "sp" (as 
advised by postings that I googled up on StackOverflow.


But then I came to a shuddering halt when I got the following error 
response to run install.packages("rgdal",lib="/home/rolf/Rlib")


Error in dyn.load(file, DLLpath = DLLpath, ...) :
  unable to load shared object '/home/rolf/Rlib/rgdal/libs/rgdal.so':
  /home/rolf/Rlib/rgdal/libs/rgdal.so: undefined symbol: 
CPLQuietErrorHandler


I've googled around a bit on that and could find nothing that I could 
comprehend.


Can anyone point me in the right direction?  Ta.

cheers,

Rolf Turner
--
Technical Editor ANZJS
Department of Statistics
University of Auckland
Phone: +64-9-373-7599 ext. 88276

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