Re: [R] Lack-of-fit test for linear mixed effects model (lme) including two fixed effects

2014-05-18 Thread Bert Gunter
This is really the sort of issue that should be discussed with a local
statistical expert.

(1) It is,  a statistical, not an R programming question;

(2) Would be better posed on the R-sig-mixed-moodels list anyway;

(3) As lack of fit tests tend to be basically useless and
scientifically meaningless, the real question is what is the context
for your question -- what are the meaningful practical  (not
statistical) concerns that you want to address with the test? Again,
the sort of thing best discussed in person with a local expert.

Cheers,
Bert


Bert Gunter
Genentech Nonclinical Biostatistics
(650) 467-7374

Data is not information. Information is not knowledge. And knowledge
is certainly not wisdom.
H. Gilbert Welch




On Sat, May 17, 2014 at 10:22 AM, Isabella Zwiener izwie...@gmx.de wrote:

Dear list members,

I fitted a linear mixed effects model using the lme function from nlme
package. In the model I included two fixed effects, one being continuous 
 and
one a factor having 4 categories. Furthermore, I have one random effect 
 (id)
which I want to include as a random intercept only. I used the following
code:

fit1 - lme(outcome ~ fixed1 + fixed2, random = ~1|id)

Now I would like to perform a lack-of-fit test. In a previous post (where
there  was only one continuous fixed effect) I have seen the following
suggestion:

fit1 - lme(outcome ~ fixed1, random = ~1|id, method=ML)
fit2  -  lme(outcome  ~ factor(fixed1, ordered=TRUE), random = ~1|id,
method=ML)
anova(fit1,fit2)

Now my questions are:
1) How do I perform a lack-of-fit test with one continuous and one factor 
 as
fixed affects?
2) Is it necessary to set method=ML for the lack-of-fit test?
3)  If  I have to use method=ML for the lack-of-fit test, should I use
method=ML also in my model taht I would like to interpret? In my original
model I used REML, but only because this is the default in lme and I did 
 not
change it.

As I have not applied a lack-of-fit test before, I would really be glad for
any help!

Best regards,
John
 __
 R-help@r-project.org mailing list
 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
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] Lamperti trnasformation simulation.

2014-05-18 Thread Simon Blomberg

On 17/05/14 19:10, Xuse Chuse wrote:

Dear users,

I am trying to simulate a Lamperti transformation of a brownian motion:
W(e_t). Could anyone give some clue how to do it? Thank you beforehand.

Regards,
C.

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list
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.

See package sde, and Stefano Iacus' excellent book.

Simon.

--
Simon Blomberg, BSc (Hons), PhD, MAppStat, AStat.
Lecturer and Consultant Statistician
School of Biological Sciences
The University of Queensland
St. Lucia Queensland 4072
Australia
T: +61 7 3365 2506
email: S.Blomberg1_at_uq.edu.au
http://www.evolutionarystatistics.org

Policies:
1.  I will NOT analyse your data for you.
2.  Your deadline is your problem.

Statistics is the grammar of science - Karl Pearson.

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


Re: [R] How to Optimize two functions together in R

2014-05-18 Thread Suzen, Mehmet
This deals with the multi-objective optimisation.
Try MCO and emoa packages.

http://stats.stackexchange.com/questions/77580/optimization-of-multiple-objective-functions-with-constraints


On 15 May 2014 17:47, Mingxuan Han han...@purdue.edu wrote:
 I am trying to minimize two functions with same set of parameter(x,y).
 Currently I can only use optim() to minimize the each function one by one.
 Is there any solution I can use to optimize two functions with same set of
 (X,Y) together.



 --
 View this message in context: 
 http://r.789695.n4.nabble.com/How-to-Optimize-two-functions-together-in-R-tp4690654.html
 Sent from the R help mailing list archive at Nabble.com.

 __
 R-help@r-project.org mailing list
 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
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] Discrete and Continuous variables

2014-05-18 Thread Patrick Burns

Perhaps something involving:

sapply(dataFrame, function(z) length(unique(z)))

Pat

On 17/05/2014 17:31, a...@dpi.inpe.br wrote:

Hello everybody!

I have a data frame with discrete and continuous variables something
like this:

011.462707165309.0171912.57041000.
101.552373295559.0171809.01701000.
011.195954445809.0171750.1000.
220.964678766059.0171707.10681000.
101.469273923250.559.0170750.
201.652678853500.707.1068750.


Discrete variables should be specified as factor as.factor() and
continuos variables as numeric as.numeric().
The problem is:
The users that will enter with the variables. Is it possible identify
which input variable are continuous or discrete?

Thank guys!

__
R-help@r-project.org mailing list
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.



--
Patrick Burns
pbu...@pburns.seanet.com
twitter: @burnsstat @portfolioprobe
http://www.portfolioprobe.com/blog
http://www.burns-stat.com
(home of:
 'Impatient R'
 'The R Inferno'
 'Tao Te Programming')

__
R-help@r-project.org mailing list
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] dev-lang/R-3.1.0: biocLite(vsn) removes all files in /

2014-05-18 Thread Uwe Ligges

As alternative, just use R itself for it:


chooseBioCmirror()
setRepositories() # select BioC repositories here
install.packages(vsn)


Which should so the trick without any additional tools not shiped with R 
directly.


Best,
Uwe Ligges


On 18.05.2014 07:38, Jeff Newmiller wrote:

Then you had best not do it again if you don't like that result.

1) This is not the right mailing list for issues having to do with 
bioconductor. Please go to the bioconductor mailing list for that.

2) Running random scripts straight from the internet as root without reviewing 
them is exactly the kind of thing any experienced *nix user would never do. 
That is why user-level accounts have limits on the things they can do. I doubt 
you are supposed to be running anything with your current directory set to /, 
ever, especially not logged in as root.
---
Jeff NewmillerThe .   .  Go Live...
DCN:jdnew...@dcn.davis.ca.usBasics: ##.#.   ##.#.  Live Go...
   Live:   OO#.. Dead: OO#..  Playing
Research Engineer (Solar/BatteriesO.O#.   #.O#.  with
/Software/Embedded Controllers)   .OO#.   .OO#.  rocks...1k
---
Sent from my phone. Please excuse my brevity.

On May 17, 2014 10:16:46 PM PDT, Juergen Rose r...@rz.uni-potsdam.de wrote:

I had the following files in /:

root@caiman:/root(8)# ll /
total 160301
drwxr-xr-x   2 root root  4096 May 16 12:23 bin/
drwxr-xr-x   6 root root  3072 May 14 13:58 boot/
-rw-r--r--   1 root root 38673 May 14 14:22 boot_local-d.log
lrwxrwxrwx   1 root root11 Jan 22  2011 data - data_caiman/
drwxr-xr-x   7 root root  4096 Mar  9 22:29 data_caiman/
lrwxrwxrwx   1 root root23 Dec 29 13:43 data_impala -
/net/impala/data_impala/
lrwxrwxrwx   1 root root21 Jan 27 08:13 data_lynx2 -
/net/lynx2/data_lynx2/
drwxr-xr-x  21 root root  4040 May 14 14:40 dev/
drwxr-xr-x 160 root root 12288 May 17 17:14 etc/
-rw---   1 root root 15687 Dec 26 13:42 grub.cfg_old
lrwxrwxrwx   1 root root11 Jan 23  2011 home - home_caiman/
drwxr-xr-x   5 root root  4096 Dec 26 11:31 home_caiman/
lrwxrwxrwx   1 root root23 Dec 29 13:43 home_impala -
/net/impala/home_impala/
lrwxrwxrwx   1 root root21 Jan 27 08:13 home_lynx2 -
/net/lynx2/home_lynx2/
lrwxrwxrwx   1 root root 5 Mar 30 04:25 lib - lib64/
drwxr-xr-x   3 root root  4096 May 14 04:31 lib32/
drwxr-xr-x  17 root root 12288 May 16 12:23 lib64/
-rw-r--r--   1 root root   1797418 May 14 14:22 login.log
drwx--   2 root root 16384 Jan 20  2011 lost+found/
drwxr-xr-x   2 root root 0 May 14 14:21 misc/
drwxr-xr-x  10 root root  4096 Nov  4  2013 mnt/
drwxr-xr-x   4 root root 0 May 17 17:38 net/
drwxr-xr-x  13 root root  4096 Feb 13 13:25 opt/
dr-xr-xr-x 270 root root 0 May 14 14:21 proc/
drwx--  36 root root  4096 May 17 15:00 root/
drwxr-xr-x  30 root root   840 May 16 18:21 run/
drwxr-xr-x   2 root root 12288 May 16 12:23 sbin/
-rw-r--r--   1 root root 162191459 Jan 13  2011
stage3-amd64-20110113.tar.bz2
dr-xr-xr-x  12 root root 0 May 14 14:21 sys/
drwxrwxrwt  16 root root  1648 May 17 17:14 tmp/
drwxr-xr-x  19 root root  4096 May  6 04:40 usr/
drwxr-xr-x  16 root root  4096 Dec 26 11:17 var/


Then I did as root:
R

source(http://bioconductor.org/biocLite.R;)
biocLite(vsn)


Save workspace image? [y/n/c]: n
root@caiman:/root(15)# ll /
total 93
drwxr-xr-x   2 root root  4096 May 16 12:23 bin/
drwxr-xr-x   6 root root  3072 May 14 13:58 boot/
drwxr-xr-x   7 root root  4096 Mar  9 22:29 data_caiman/
drwxr-xr-x  21 root root  4040 May 14 14:40 dev/
drwxr-xr-x 160 root root 12288 May 17 17:14 etc/
drwxr-xr-x   5 root root  4096 Dec 26 11:31 home_caiman/
drwxr-xr-x   3 root root  4096 May 14 04:31 lib32/
drwxr-xr-x  17 root root 12288 May 16 12:23 lib64/
drwx--   2 root root 16384 Jan 20  2011 lost+found/
drwxr-xr-x   2 root root 0 May 14 14:21 misc/
drwxr-xr-x  10 root root  4096 Nov  4  2013 mnt/
drwxr-xr-x   2 root root 0 May 17 17:38 net/
drwxr-xr-x  13 root root  4096 Feb 13 13:25 opt/
dr-xr-xr-x 272 root root 0 May 14 14:21 proc/
drwx--  36 root root  4096 May 17 15:00 root/
drwxr-xr-x  30 root root   840 May 16 18:21 run/
drwxr-xr-x   2 root root 12288 May 16 12:23 sbin/
dr-xr-xr-x  12 root root 0 May 17 17:38 sys/
drwxrwxrwt  19 root root  1752 May 17 18:33 tmp/
drwxr-xr-x  19 root root  4096 May  6 04:40 usr/
drwxr-xr-x  16 root root  4096 Dec 26 11:17 var/

I.e., all not directory files in / disappeared. This happens on two
systems.

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide

Re: [R] dev-lang/R-3.1.0: biocLite(vsn) removes all files in /

2014-05-18 Thread Martin Morgan
This would be very bad and certainly unintended if it were the responsibility of 
biocLite. Can we communicate off-list about this? In particular can you report


  noquote(readLines(http://bioconductor.org/biocLite.R;))

?

Martin Morgan

On 05/17/2014 10:16 PM, Juergen Rose wrote:

I had the following files in /:

root@caiman:/root(8)# ll /
total 160301
drwxr-xr-x   2 root root  4096 May 16 12:23 bin/
drwxr-xr-x   6 root root  3072 May 14 13:58 boot/
-rw-r--r--   1 root root 38673 May 14 14:22 boot_local-d.log
lrwxrwxrwx   1 root root11 Jan 22  2011 data - data_caiman/
drwxr-xr-x   7 root root  4096 Mar  9 22:29 data_caiman/
lrwxrwxrwx   1 root root23 Dec 29 13:43 data_impala - 
/net/impala/data_impala/
lrwxrwxrwx   1 root root21 Jan 27 08:13 data_lynx2 - 
/net/lynx2/data_lynx2/
drwxr-xr-x  21 root root  4040 May 14 14:40 dev/
drwxr-xr-x 160 root root 12288 May 17 17:14 etc/
-rw---   1 root root 15687 Dec 26 13:42 grub.cfg_old
lrwxrwxrwx   1 root root11 Jan 23  2011 home - home_caiman/
drwxr-xr-x   5 root root  4096 Dec 26 11:31 home_caiman/
lrwxrwxrwx   1 root root23 Dec 29 13:43 home_impala - 
/net/impala/home_impala/
lrwxrwxrwx   1 root root21 Jan 27 08:13 home_lynx2 - 
/net/lynx2/home_lynx2/
lrwxrwxrwx   1 root root 5 Mar 30 04:25 lib - lib64/
drwxr-xr-x   3 root root  4096 May 14 04:31 lib32/
drwxr-xr-x  17 root root 12288 May 16 12:23 lib64/
-rw-r--r--   1 root root   1797418 May 14 14:22 login.log
drwx--   2 root root 16384 Jan 20  2011 lost+found/
drwxr-xr-x   2 root root 0 May 14 14:21 misc/
drwxr-xr-x  10 root root  4096 Nov  4  2013 mnt/
drwxr-xr-x   4 root root 0 May 17 17:38 net/
drwxr-xr-x  13 root root  4096 Feb 13 13:25 opt/
dr-xr-xr-x 270 root root 0 May 14 14:21 proc/
drwx--  36 root root  4096 May 17 15:00 root/
drwxr-xr-x  30 root root   840 May 16 18:21 run/
drwxr-xr-x   2 root root 12288 May 16 12:23 sbin/
-rw-r--r--   1 root root 162191459 Jan 13  2011 stage3-amd64-20110113.tar.bz2
dr-xr-xr-x  12 root root 0 May 14 14:21 sys/
drwxrwxrwt  16 root root  1648 May 17 17:14 tmp/
drwxr-xr-x  19 root root  4096 May  6 04:40 usr/
drwxr-xr-x  16 root root  4096 Dec 26 11:17 var/


Then I did as root:
R

source(http://bioconductor.org/biocLite.R;)
biocLite(vsn)


Save workspace image? [y/n/c]: n
root@caiman:/root(15)# ll /
total 93
drwxr-xr-x   2 root root  4096 May 16 12:23 bin/
drwxr-xr-x   6 root root  3072 May 14 13:58 boot/
drwxr-xr-x   7 root root  4096 Mar  9 22:29 data_caiman/
drwxr-xr-x  21 root root  4040 May 14 14:40 dev/
drwxr-xr-x 160 root root 12288 May 17 17:14 etc/
drwxr-xr-x   5 root root  4096 Dec 26 11:31 home_caiman/
drwxr-xr-x   3 root root  4096 May 14 04:31 lib32/
drwxr-xr-x  17 root root 12288 May 16 12:23 lib64/
drwx--   2 root root 16384 Jan 20  2011 lost+found/
drwxr-xr-x   2 root root 0 May 14 14:21 misc/
drwxr-xr-x  10 root root  4096 Nov  4  2013 mnt/
drwxr-xr-x   2 root root 0 May 17 17:38 net/
drwxr-xr-x  13 root root  4096 Feb 13 13:25 opt/
dr-xr-xr-x 272 root root 0 May 14 14:21 proc/
drwx--  36 root root  4096 May 17 15:00 root/
drwxr-xr-x  30 root root   840 May 16 18:21 run/
drwxr-xr-x   2 root root 12288 May 16 12:23 sbin/
dr-xr-xr-x  12 root root 0 May 17 17:38 sys/
drwxrwxrwt  19 root root  1752 May 17 18:33 tmp/
drwxr-xr-x  19 root root  4096 May  6 04:40 usr/
drwxr-xr-x  16 root root  4096 Dec 26 11:17 var/

I.e., all not directory files in / disappeared. This happens on two systems.

__
R-help@r-project.org mailing list
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.




--
Computational Biology / Fred Hutchinson Cancer Research Center
1100 Fairview Ave. N.
PO Box 19024 Seattle, WA 98109

Location: Arnold Building M1 B861
Phone: (206) 667-2793

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


[R] help with xts

2014-05-18 Thread Pete
I have 3 xts objects: test, cond1, cond2
You can download here:

https://dl.dropboxusercontent.com/u/102669/obj.rar

My problem is very simple.

test [ cond1  cond2] = NA   THIS WORKS

test [ cond1  cond2] = -test [ cond1  cond2]   THIS DOESN'T WORKS

Why?

My objective is to substitute all values in test (when cond1  cond2) with
the corresponding values of test but with negative sign

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


Re: [R] help with xts

2014-05-18 Thread Bert Gunter
Presumably -z is not defined for an xts class object,z ? (whereas indexing is)

-- Bert

Bert Gunter
Genentech Nonclinical Biostatistics
(650) 467-7374

Data is not information. Information is not knowledge. And knowledge
is certainly not wisdom.
H. Gilbert Welch




On Sun, May 18, 2014 at 7:25 AM, Pete freeri...@gmail.com wrote:
 I have 3 xts objects: test, cond1, cond2
 You can download here:

 https://dl.dropboxusercontent.com/u/102669/obj.rar

 My problem is very simple.

 test [ cond1  cond2] = NA   THIS WORKS

 test [ cond1  cond2] = -test [ cond1  cond2]   THIS DOESN'T WORKS

 Why?

 My objective is to substitute all values in test (when cond1  cond2) with
 the corresponding values of test but with negative sign

 __
 R-help@r-project.org mailing list
 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
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] help with xts

2014-05-18 Thread Joshua Ulrich
Using subset assignment with an array usually doesn't work well with
xts/zoo objects.  Your case wouldn't even work with a matrix because
you have NA in your array.

In this case, you can achieve the same result using multiplication:
pos.neg.1 - ((cond1  cond2)*-2+1)
test - test * pos.neg.1

Best,
--
Joshua Ulrich  |  about.me/joshuaulrich
FOSS Trading  |  www.fosstrading.com


On Sun, May 18, 2014 at 9:25 AM, Pete freeri...@gmail.com wrote:
 I have 3 xts objects: test, cond1, cond2
 You can download here:

 https://dl.dropboxusercontent.com/u/102669/obj.rar

 My problem is very simple.

 test [ cond1  cond2] = NA   THIS WORKS

 test [ cond1  cond2] = -test [ cond1  cond2]   THIS DOESN'T WORKS

 Why?

 My objective is to substitute all values in test (when cond1  cond2) with
 the corresponding values of test but with negative sign

 __
 R-help@r-project.org mailing list
 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
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] unable to collate and parse R files for package -- unexpected end of input

2014-05-18 Thread Timothy W. Cook
This is the error I get attempting to build and install a package I wrote.

I am using R Studio (but I did try with R CMDs as well).

The file that is blamed in the error is the last file alphabetically.  If I
remove that file.  I get the same error on the remaining last file
alphabetically.  So my guess is that it isn't actually one of these files.
 However, I have no clue how to troubleshoot this problem.  I am quite new
to R.

I built a generator to create this R pkg.  But it is based on a very
similar one that works okay that I built by hand.

They are available in their entirety on GitHub at:
https://github.com/mlhim/R_test_prj

The one that works is:  ccdTest244AllDatatypes299a8123d9f7

The one that doesn't work is: ccdTest244AllDatatypesa5c7aca0036f

The 00install.out file isn't particularly enlightening:
-
* installing *source* package ‘ccdTest244AllDatatypesa5c7aca0036f’ ...
** R
Error in parse(outFile) :

/home/tim/MLHIM/git/R_test_prj/ccdTest244AllDatatypesa5c7aca0036f.Rcheck/00_pkg_src/ccdTest244AllDatatypesa5c7aca0036f/R/meta:43:0:
unexpected end of input
41: return('
http://www.ccdgen.com/ccdlib/ccd-31598ac4-eac4-4f45-928e-a5c7aca0036f.xsd')
42: }
   ^
ERROR: unable to collate and parse R files for package
‘ccdTest244AllDatatypesa5c7aca0036f’
* removing
‘/home/tim/MLHIM/git/R_test_prj/ccdTest244AllDatatypesa5c7aca0036f.Rcheck/ccdTest244AllDatatypesa5c7aca0036f’



* installing *source* package ‘ccdTest244AllDatatypesa5c7aca0036f’ ...
** R
Error in parse(outFile) :

/home/tim/MLHIM/git/R_test_prj/ccdTest244AllDatatypesa5c7aca0036f.Rcheck/00_pkg_src/ccdTest244AllDatatypesa5c7aca0036f/R/meta:43:0:
unexpected end of input
41: return('
http://www.ccdgen.com/ccdlib/ccd-31598ac4-eac4-4f45-928e-a5c7aca0036f.xsd')
42: }
   ^
ERROR: unable to collate and parse R files for package
‘ccdTest244AllDatatypesa5c7aca0036f’
* removing
‘/home/tim/MLHIM/git/R_test_prj/ccdTest244AllDatatypesa5c7aca0036f.Rcheck/ccdTest244AllDatatypesa5c7aca0036f’
-

Any help  is greatly appreciated.

This is part of a large open source effort in healthcare interoperability
and data analysis.

Thanks In Advance,
Tim



Timothy Cook
LinkedIn Profile:http://www.linkedin.com/in/timothywaynecook
MLHIM http://www.mlhim.org

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list
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] filename of current device

2014-05-18 Thread Prof Brian Ripley

On 14/05/2014 23:04, Andreas Leha wrote:

Hi all,

how do I find out about the filename, the currently open (let's say pdf)
device is writing to?

If I find 'dev.cur()' returning 'pdf 3' when I expect 'nulldevice 1' I
would like to know, which file that pdf device is actually targeting.

Any help for my poor organization is highly appreciated...


You cannot know this for an arbitrary device, at least not from R.

Most files in R are opened with the C call fopen() and thereafter 
referred to by a file handle: the file can be renamed, unlinked ... 
whilst the handle is open.  Some system utilities[*] may be able to tell 
you what filepaths are/were associated with file handles open in a 
process, but it cannot be done portably.


However, in R-devel there is the possibility of a device recording extra 
information about itself.  See the NEWS item


• Graphics devices can add attributes to their description in
  .Device and .Devices.  Several of those included with R use a
  filepath attribute.

AFAIR the pdf() device does: let's see

 pdf('/tmp/foo.pdf')
 dev.cur()
pdf
  2
 .Devices
[[1]]
[1] null device

[[2]]
[1] pdf
attr(,filepath)
[1] /tmp/foo.pdf


There is at least one exception: for historical reasons locked in by 
undocumented use in package tkrplot, the win.metafile() device does 
include the file path in the device 'name'.


[*] They have existed at least on Linux, Windows and OS X.

--
Brian D. Ripley,  rip...@stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel:  +44 1865 272861 (self)
1 South Parks Road, +44 1865 272866 (PA)
Oxford OX1 3TG, UKFax:  +44 1865 272595

__
R-help@r-project.org mailing list
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] dev-lang/R-3.1.0: biocLite(vsn) removes all files in /

2014-05-18 Thread peter dalgaard

On 18 May 2014, at 07:38 , Jeff Newmiller jdnew...@dcn.davis.ca.us wrote:

 Then you had best not do it again if you don't like that result.
 
 1) This is not the right mailing list for issues having to do with 
 bioconductor. Please go to the bioconductor mailing list for that.

Hmm, this is one case where I'd really rather not scare people off R-help. 
Non-BioC users do use BioC packages from time to time and what Juergen did is 
what the BioConductor web pages tells new users to do (probably minus the 
as-root bit). A warn-off on R-help seems entirely warranted. Good to see that 
Martin Morgan is taking the issue very seriously in his post below.

 
 2) Running random scripts straight from the internet as root without 
 reviewing them is exactly the kind of thing any experienced *nix user would 
 never do. That is why user-level accounts have limits on the things they can 
 do. I doubt you are supposed to be running anything with your current 
 directory set to /, ever, especially not logged in as root.
 ---
 Jeff NewmillerThe .   .  Go Live...
 DCN:jdnew...@dcn.davis.ca.usBasics: ##.#.   ##.#.  Live Go...
  Live:   OO#.. Dead: OO#..  Playing
 Research Engineer (Solar/BatteriesO.O#.   #.O#.  with
 /Software/Embedded Controllers)   .OO#.   .OO#.  rocks...1k
 --- 
 Sent from my phone. Please excuse my brevity.
 
 On May 17, 2014 10:16:46 PM PDT, Juergen Rose r...@rz.uni-potsdam.de wrote:
 I had the following files in /:
 
 root@caiman:/root(8)# ll /
 total 160301
 drwxr-xr-x   2 root root  4096 May 16 12:23 bin/
 drwxr-xr-x   6 root root  3072 May 14 13:58 boot/
 -rw-r--r--   1 root root 38673 May 14 14:22 boot_local-d.log
 lrwxrwxrwx   1 root root11 Jan 22  2011 data - data_caiman/
 drwxr-xr-x   7 root root  4096 Mar  9 22:29 data_caiman/
 lrwxrwxrwx   1 root root23 Dec 29 13:43 data_impala -
 /net/impala/data_impala/
 lrwxrwxrwx   1 root root21 Jan 27 08:13 data_lynx2 -
 /net/lynx2/data_lynx2/
 drwxr-xr-x  21 root root  4040 May 14 14:40 dev/
 drwxr-xr-x 160 root root 12288 May 17 17:14 etc/
 -rw---   1 root root 15687 Dec 26 13:42 grub.cfg_old
 lrwxrwxrwx   1 root root11 Jan 23  2011 home - home_caiman/
 drwxr-xr-x   5 root root  4096 Dec 26 11:31 home_caiman/
 lrwxrwxrwx   1 root root23 Dec 29 13:43 home_impala -
 /net/impala/home_impala/
 lrwxrwxrwx   1 root root21 Jan 27 08:13 home_lynx2 -
 /net/lynx2/home_lynx2/
 lrwxrwxrwx   1 root root 5 Mar 30 04:25 lib - lib64/
 drwxr-xr-x   3 root root  4096 May 14 04:31 lib32/
 drwxr-xr-x  17 root root 12288 May 16 12:23 lib64/
 -rw-r--r--   1 root root   1797418 May 14 14:22 login.log
 drwx--   2 root root 16384 Jan 20  2011 lost+found/
 drwxr-xr-x   2 root root 0 May 14 14:21 misc/
 drwxr-xr-x  10 root root  4096 Nov  4  2013 mnt/
 drwxr-xr-x   4 root root 0 May 17 17:38 net/
 drwxr-xr-x  13 root root  4096 Feb 13 13:25 opt/
 dr-xr-xr-x 270 root root 0 May 14 14:21 proc/
 drwx--  36 root root  4096 May 17 15:00 root/
 drwxr-xr-x  30 root root   840 May 16 18:21 run/
 drwxr-xr-x   2 root root 12288 May 16 12:23 sbin/
 -rw-r--r--   1 root root 162191459 Jan 13  2011
 stage3-amd64-20110113.tar.bz2
 dr-xr-xr-x  12 root root 0 May 14 14:21 sys/
 drwxrwxrwt  16 root root  1648 May 17 17:14 tmp/
 drwxr-xr-x  19 root root  4096 May  6 04:40 usr/
 drwxr-xr-x  16 root root  4096 Dec 26 11:17 var/
 
 
 Then I did as root:
 R
 source(http://bioconductor.org/biocLite.R;)
 biocLite(vsn)
 
 Save workspace image? [y/n/c]: n
 root@caiman:/root(15)# ll /
 total 93
 drwxr-xr-x   2 root root  4096 May 16 12:23 bin/
 drwxr-xr-x   6 root root  3072 May 14 13:58 boot/
 drwxr-xr-x   7 root root  4096 Mar  9 22:29 data_caiman/
 drwxr-xr-x  21 root root  4040 May 14 14:40 dev/
 drwxr-xr-x 160 root root 12288 May 17 17:14 etc/
 drwxr-xr-x   5 root root  4096 Dec 26 11:31 home_caiman/
 drwxr-xr-x   3 root root  4096 May 14 04:31 lib32/
 drwxr-xr-x  17 root root 12288 May 16 12:23 lib64/
 drwx--   2 root root 16384 Jan 20  2011 lost+found/
 drwxr-xr-x   2 root root 0 May 14 14:21 misc/
 drwxr-xr-x  10 root root  4096 Nov  4  2013 mnt/
 drwxr-xr-x   2 root root 0 May 17 17:38 net/
 drwxr-xr-x  13 root root  4096 Feb 13 13:25 opt/
 dr-xr-xr-x 272 root root 0 May 14 14:21 proc/
 drwx--  36 root root  4096 May 17 15:00 root/
 drwxr-xr-x  30 root root   840 May 16 18:21 run/
 drwxr-xr-x   2 root root 12288 May 16 12:23 sbin/
 dr-xr-xr-x  12 root root 0 May 17 17:38 sys/
 drwxrwxrwt  19 root root  1752 May 17 18:33 tmp/
 drwxr-xr-x  19 root root  4096 May  6 04:40 usr/
 drwxr-xr-x  16 root root  4096 Dec 26 11:17 var/
 
 I.e., all not 

Re: [R] unable to collate and parse R files for package -- unexpected end of input

2014-05-18 Thread Duncan Murdoch

On 18/05/2014, 12:54 PM, Timothy W. Cook wrote:

This is the error I get attempting to build and install a package I wrote.

I am using R Studio (but I did try with R CMDs as well).

The file that is blamed in the error is the last file alphabetically.  If I
remove that file.  I get the same error on the remaining last file
alphabetically.  So my guess is that it isn't actually one of these files.
  However, I have no clue how to troubleshoot this problem.  I am quite new
to R.


This indicates that you open a block using { (or perhaps [ or (), 
but never close it.  Unfortunately the parser doesn't tell you where the 
opening brace was.


A quick way to locate which file is to parse your source files one at a 
time; e.g.


for (f in list.files(somedir/R, full.names=TRUE)) parse(f)

This will get an error on the first file with unmatched braces.  It 
won't tell you where to look in that file, but it's usually not too hard 
to find that by looking.  There are ways to find the spot automatically, 
but they're not trivial:  see the discussion of partial parse results in 
?parse, and fill in a bunch of blanks.  Here without much explanation is 
an example.


f - some file with unbalanced braces
text - readLines(f)
src - srcfile(text)
parse(text=text, srcfile=src)  # Generates error

d - getParseData(src)
d[d$token == '{'  d$parent == 0,]

This will print something like

line1 col1 line2 col2  id parent token terminal text
217373373 217  0   '{' TRUE{

telling you that the brace on line 37 was never matched.  If you don't 
find anything, try other kinds of parens or brackets, though they are 
less likely.


Duncan Murdoch



I built a generator to create this R pkg.  But it is based on a very
similar one that works okay that I built by hand.

They are available in their entirety on GitHub at:
https://github.com/mlhim/R_test_prj

The one that works is:  ccdTest244AllDatatypes299a8123d9f7

The one that doesn't work is: ccdTest244AllDatatypesa5c7aca0036f

The 00install.out file isn't particularly enlightening:
-
* installing *source* package ‘ccdTest244AllDatatypesa5c7aca0036f’ ...
** R
Error in parse(outFile) :

/home/tim/MLHIM/git/R_test_prj/ccdTest244AllDatatypesa5c7aca0036f.Rcheck/00_pkg_src/ccdTest244AllDatatypesa5c7aca0036f/R/meta:43:0:
unexpected end of input
41: return('
http://www.ccdgen.com/ccdlib/ccd-31598ac4-eac4-4f45-928e-a5c7aca0036f.xsd')
42: }
^
ERROR: unable to collate and parse R files for package
‘ccdTest244AllDatatypesa5c7aca0036f’
* removing
‘/home/tim/MLHIM/git/R_test_prj/ccdTest244AllDatatypesa5c7aca0036f.Rcheck/ccdTest244AllDatatypesa5c7aca0036f’



* installing *source* package ‘ccdTest244AllDatatypesa5c7aca0036f’ ...
** R
Error in parse(outFile) :

/home/tim/MLHIM/git/R_test_prj/ccdTest244AllDatatypesa5c7aca0036f.Rcheck/00_pkg_src/ccdTest244AllDatatypesa5c7aca0036f/R/meta:43:0:
unexpected end of input
41: return('
http://www.ccdgen.com/ccdlib/ccd-31598ac4-eac4-4f45-928e-a5c7aca0036f.xsd')
42: }
^
ERROR: unable to collate and parse R files for package
‘ccdTest244AllDatatypesa5c7aca0036f’
* removing
‘/home/tim/MLHIM/git/R_test_prj/ccdTest244AllDatatypesa5c7aca0036f.Rcheck/ccdTest244AllDatatypesa5c7aca0036f’
-

Any help  is greatly appreciated.

This is part of a large open source effort in healthcare interoperability
and data analysis.

Thanks In Advance,
Tim



Timothy Cook
LinkedIn Profile:http://www.linkedin.com/in/timothywaynecook
MLHIM http://www.mlhim.org

[[alternative HTML version deleted]]



__
R-help@r-project.org mailing list
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
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] unable to collate and parse R files for package -- unexpected end of input

2014-05-18 Thread Timothy W. Cook
Thanks Duncan.  Exactly what I needed.  A push in the right direction to
finding it.
I've already found the file and I am sure to find the problem child soon.

Cheers,
Tim



On Sun, May 18, 2014 at 5:24 PM, Duncan Murdoch murdoch.dun...@gmail.comwrote:

 On 18/05/2014, 12:54 PM, Timothy W. Cook wrote:

 This is the error I get attempting to build and install a package I wrote.

 I am using R Studio (but I did try with R CMDs as well).

 The file that is blamed in the error is the last file alphabetically.  If
 I
 remove that file.  I get the same error on the remaining last file
 alphabetically.  So my guess is that it isn't actually one of these files.
   However, I have no clue how to troubleshoot this problem.  I am quite
 new
 to R.


 This indicates that you open a block using { (or perhaps [ or (),
 but never close it.  Unfortunately the parser doesn't tell you where the
 opening brace was.

 A quick way to locate which file is to parse your source files one at a
 time; e.g.

 for (f in list.files(somedir/R, full.names=TRUE)) parse(f)

 This will get an error on the first file with unmatched braces.  It won't
 tell you where to look in that file, but it's usually not too hard to find
 that by looking.  There are ways to find the spot automatically, but
 they're not trivial:  see the discussion of partial parse results in
 ?parse, and fill in a bunch of blanks.  Here without much explanation is an
 example.

 f - some file with unbalanced braces
 text - readLines(f)
 src - srcfile(text)
 parse(text=text, srcfile=src)  # Generates error

 d - getParseData(src)
 d[d$token == '{'  d$parent == 0,]

 This will print something like

 line1 col1 line2 col2  id parent token terminal text
 217373373 217  0   '{' TRUE{

 telling you that the brace on line 37 was never matched.  If you don't
 find anything, try other kinds of parens or brackets, though they are less
 likely.

 Duncan Murdoch


 I built a generator to create this R pkg.  But it is based on a very
 similar one that works okay that I built by hand.

 They are available in their entirety on GitHub at:
 https://github.com/mlhim/R_test_prj

 The one that works is:  ccdTest244AllDatatypes299a8123d9f7

 The one that doesn't work is: ccdTest244AllDatatypesa5c7aca0036f

 The 00install.out file isn't particularly enlightening:
 
 -
 * installing *source* package 
 ‘ccdTest244AllDatatypesa5c7aca0036f’
 ...

 ** R
 Error in parse(outFile) :

 /home/tim/MLHIM/git/R_test_prj/ccdTest244AllDatatypesa5c7aca0
 036f.Rcheck/00_pkg_src/ccdTest244AllDatatypesa5c7aca0036f/R/meta :43:0:
 unexpected end of input
 41: return('
 http://www.ccdgen.com/ccdlib/ccd-31598ac4-eac4-4f45-928e-a5c7aca0036f.xsd
 ')
 42: }
 ^
 ERROR: unable to collate and parse R files for package
 ‘ccdTest244AllDatatypesa5c7aca0036f’
 * removing
 ‘/home/tim/MLHIM/git/R_test_prj/ccdTest244AllDatatypesa5c7aca0
 036f.Rcheck/ccdTest244AllDatatypesa5c7aca0036f’



 * installing *source* package 
 ‘ccdTest244AllDatatypesa5c7aca0036f’
 ...

 ** R
 Error in parse(outFile) :

 /home/tim/MLHIM/git/R_test_prj/ccdTest244AllDatatypesa5c7aca0
 036f.Rcheck/00_pkg_src/ccdTest244AllDatatypesa5c7aca0036f/R/meta :43:0:
 unexpected end of input
 41: return('
 http://www.ccdgen.com/ccdlib/ccd-31598ac4-eac4-4f45-928e-a5c7aca0036f.xsd
 ')
 42: }
 ^
 ERROR: unable to collate and parse R files for package
 ‘ccdTest244AllDatatypesa5c7aca0036f’
 * removing
 ‘/home/tim/MLHIM/git/R_test_prj/ccdTest244AllDatatypesa5c7aca0
 036f.Rcheck/ccdTest244AllDatatypesa5c7aca0036f’

 -

 Any help  is greatly appreciated.

 This is part of a large open source effort in healthcare interoperability
 and data analysis.

 Thanks In Advance,
 Tim


 
 Timothy Cook
 LinkedIn Profile:http://www.linkedin.com/in/timothywaynecook
 MLHIM http://www.mlhim.org

 [[alternative HTML version deleted]]



 __
 R-help@r-project.org mailing list
 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.





-- 


Timothy Cook
LinkedIn Profile:http://www.linkedin.com/in/timothywaynecook
MLHIM http://www.mlhim.org

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list
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] unable to collate and parse R files for package -- unexpected end of input

2014-05-18 Thread Timothy W. Cook
Yep, found it.  I was missing a carriage return in the generator so the
closing '}' was ending up on the line above with a comment.

Thanks again.



On Sun, May 18, 2014 at 5:40 PM, Timothy W. Cook t...@mlhim.org wrote:

 Thanks Duncan.  Exactly what I needed.  A push in the right direction to
 finding it.
 I've already found the file and I am sure to find the problem child soon.

 Cheers,
 Tim



 On Sun, May 18, 2014 at 5:24 PM, Duncan Murdoch 
 murdoch.dun...@gmail.comwrote:

 On 18/05/2014, 12:54 PM, Timothy W. Cook wrote:

 This is the error I get attempting to build and install a package I
 wrote.

 I am using R Studio (but I did try with R CMDs as well).

 The file that is blamed in the error is the last file alphabetically.
  If I
 remove that file.  I get the same error on the remaining last file
 alphabetically.  So my guess is that it isn't actually one of these
 files.
   However, I have no clue how to troubleshoot this problem.  I am quite
 new
 to R.


 This indicates that you open a block using { (or perhaps [ or (),
 but never close it.  Unfortunately the parser doesn't tell you where the
 opening brace was.

 A quick way to locate which file is to parse your source files one at a
 time; e.g.

 for (f in list.files(somedir/R, full.names=TRUE)) parse(f)

 This will get an error on the first file with unmatched braces.  It won't
 tell you where to look in that file, but it's usually not too hard to find
 that by looking.  There are ways to find the spot automatically, but
 they're not trivial:  see the discussion of partial parse results in
 ?parse, and fill in a bunch of blanks.  Here without much explanation is an
 example.

 f - some file with unbalanced braces
 text - readLines(f)
 src - srcfile(text)
 parse(text=text, srcfile=src)  # Generates error

 d - getParseData(src)
 d[d$token == '{'  d$parent == 0,]

 This will print something like

 line1 col1 line2 col2  id parent token terminal text
 217373373 217  0   '{' TRUE{

 telling you that the brace on line 37 was never matched.  If you don't
 find anything, try other kinds of parens or brackets, though they are less
 likely.

 Duncan Murdoch


 I built a generator to create this R pkg.  But it is based on a very
 similar one that works okay that I built by hand.

 They are available in their entirety on GitHub at:
 https://github.com/mlhim/R_test_prj

 The one that works is:  ccdTest244AllDatatypes299a8123d9f7

 The one that doesn't work is: ccdTest244AllDatatypesa5c7aca0036f

 The 00install.out file isn't particularly enlightening:
 
 -
 * installing *source* package 
 ‘ccdTest244AllDatatypesa5c7aca0036f’
 ...

 ** R
 Error in parse(outFile) :

 /home/tim/MLHIM/git/R_test_prj/ccdTest244AllDatatypesa5c7aca0
 036f.Rcheck/00_pkg_src/ccdTest244AllDatatypesa5c7aca0036f/R/meta :43:0:
 unexpected end of input
 41: return('
 http://www.ccdgen.com/ccdlib/ccd-31598ac4-eac4-4f45-928e-
 a5c7aca0036f.xsd')
 42: }
 ^
 ERROR: unable to collate and parse R files for package
 ‘ccdTest244AllDatatypesa5c7aca0036f’
 * removing
 ‘/home/tim/MLHIM/git/R_test_prj/ccdTest244AllDatatypesa5c7aca0
 036f.Rcheck/ccdTest244AllDatatypesa5c7aca0036f’



 * installing *source* package 
 ‘ccdTest244AllDatatypesa5c7aca0036f’
 ...

 ** R
 Error in parse(outFile) :

 /home/tim/MLHIM/git/R_test_prj/ccdTest244AllDatatypesa5c7aca0
 036f.Rcheck/00_pkg_src/ccdTest244AllDatatypesa5c7aca0036f/R/meta :43:0:
 unexpected end of input
 41: return('
 http://www.ccdgen.com/ccdlib/ccd-31598ac4-eac4-4f45-928e-
 a5c7aca0036f.xsd')
 42: }
 ^
 ERROR: unable to collate and parse R files for package
 ‘ccdTest244AllDatatypesa5c7aca0036f’
 * removing
 ‘/home/tim/MLHIM/git/R_test_prj/ccdTest244AllDatatypesa5c7aca0
 036f.Rcheck/ccdTest244AllDatatypesa5c7aca0036f’

 -

 Any help  is greatly appreciated.

 This is part of a large open source effort in healthcare interoperability
 and data analysis.

 Thanks In Advance,
 Tim


 
 Timothy Cook
 LinkedIn Profile:http://www.linkedin.com/in/timothywaynecook
 MLHIM http://www.mlhim.org

 [[alternative HTML version deleted]]



 __
 R-help@r-project.org mailing list
 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.





 --

 
 Timothy Cook
 LinkedIn Profile:http://www.linkedin.com/in/timothywaynecook
 MLHIM http://www.mlhim.org




-- 


Timothy Cook
LinkedIn Profile:http://www.linkedin.com/in/timothywaynecook
MLHIM http://www.mlhim.org

[[alternative HTML version 

[R] Is there an easier way than this to list all functions in the global environment?

2014-05-18 Thread Byron Dom


After an unsuccessful search thru several books plus online documentation, I 
was unable to find a simple way to do this, so I wrote my own function (see 
below) to do it.  I'm relatively new to R however, so I'm guessing that there 
must be an easier way to do it.

I want to list all functions and only the functions (not other objects also) in 
the global environment.

I'm working with several old R workspaces that contain a very large number of 
objects -- functions, data structures, etc. and I would to be able to easily 
find out which objects are functions.

The function below (listfunc()) works fine. I'm just asking this for future 
reference.

+++
listfunc - function() { 
# lists names of all function objects in the global environment 
obj - objects(.GlobalEnv) 
funclist - character(length = 0) 
for (i in 1:length(obj)) { 
    if (mode(get(obj[i])) == function) funclist - c(funclist,obj[i]) 
  } 
return(funclist) 
}
+++

__
R-help@r-project.org mailing list
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] Is there an easier way than this to list all functions in the global environment?

2014-05-18 Thread Peter Alspach
Tena koe Byron

Many years ago, I came across the following function by Simon Fear:

function (splitby = mode, pos = 1, ...) 
{
lsout - ls(pos = pos, ...)
tapply(lsout, sapply(lsout, function(x) {
splitby(get(x))
}), invisible)
}

from which one can deduce that, given your obj, the following line could 
replace your loop:

obj[sapply(obj, function(x) mode(get(x))=='function')]

For future reference, it can be slow in R to  continually append to an object:

test - character(0)
system.time(for (i in 1:10^5) test - c(test, as.character(i)))
#   user  system elapsed 
#  47.860.02   47.89 
test - character(10^5)
system.time(for (i in 1:10^5) test[i] - as.character(i))
#   user  system elapsed 
#   0.250.000.25

HTH 

Peter Alspach
-Original Message-
From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On 
Behalf Of Byron Dom
Sent: Monday, 19 May 2014 10:50 a.m.
To: r-help@r-project.org
Subject: [R] Is there an easier way than this to list all functions in the 
global environment?



After an unsuccessful search thru several books plus online documentation, I 
was unable to find a simple way to do this, so I wrote my own function (see 
below) to do it.  I'm relatively new to R however, so I'm guessing that there 
must be an easier way to do it.

I want to list all functions and only the functions (not other objects also) in 
the global environment.

I'm working with several old R workspaces that contain a very large number of 
objects -- functions, data structures, etc. and I would to be able to easily 
find out which objects are functions.

The function below (listfunc()) works fine. I'm just asking this for future 
reference.

+++
listfunc - function() {
# lists names of all function objects in the global environment obj - 
objects(.GlobalEnv) funclist - character(length = 0) for (i in 1:length(obj)) {
    if (mode(get(obj[i])) == function) funclist - c(funclist,obj[i])
  }
return(funclist)
}
+++

__
R-help@r-project.org mailing list
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.
The contents of this e-mail are confidential and may be ...{{dropped:14}}

__
R-help@r-project.org mailing list
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] Saving the ouput data

2014-05-18 Thread jwd
Or you can try help(sink).

JWDougherty

__
R-help@r-project.org mailing list
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] Is there an easier way than this to list all functions in the global environment?

2014-05-18 Thread arun


Hi,

You may also check ?lsf.str()
c(lsf.str())
A.K.


On Sunday, May 18, 2014 7:27 PM, Peter Alspach 
peter.alsp...@plantandfood.co.nz wrote:
Tena koe Byron

Many years ago, I came across the following function by Simon Fear:

function (splitby = mode, pos = 1, ...) 
{
    lsout - ls(pos = pos, ...)
    tapply(lsout, sapply(lsout, function(x) {
        splitby(get(x))
    }), invisible)
}

from which one can deduce that, given your obj, the following line could 
replace your loop:

obj[sapply(obj, function(x) mode(get(x))=='function')]

For future reference, it can be slow in R to  continually append to an object:

test - character(0)
system.time(for (i in 1:10^5) test - c(test, as.character(i)))
#   user  system elapsed 
#  47.86    0.02   47.89 
test - character(10^5)
system.time(for (i in 1:10^5) test[i] - as.character(i))
#   user  system elapsed 
#   0.25    0.00    0.25

HTH 

Peter Alspach
-Original Message-
From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On 
Behalf Of Byron Dom
Sent: Monday, 19 May 2014 10:50 a.m.
To: r-help@r-project.org
Subject: [R] Is there an easier way than this to list all functions in the 
global environment?



After an unsuccessful search thru several books plus online documentation, I 
was unable to find a simple way to do this, so I wrote my own function (see 
below) to do it.  I'm relatively new to R however, so I'm guessing that there 
must be an easier way to do it.

I want to list all functions and only the functions (not other objects also) in 
the global environment.

I'm working with several old R workspaces that contain a very large number of 
objects -- functions, data structures, etc. and I would to be able to easily 
find out which objects are functions.

The function below (listfunc()) works fine. I'm just asking this for future 
reference.

+++
listfunc - function() {
# lists names of all function objects in the global environment obj - 
objects(.GlobalEnv) funclist - character(length = 0) for (i in 1:length(obj)) {
    if (mode(get(obj[i])) == function) funclist - c(funclist,obj[i])
  }
return(funclist)
}
+++

__
R-help@r-project.org mailing list
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.
The contents of this e-mail are confidential and may be ...{{dropped:14}}

__
R-help@r-project.org mailing list
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
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] dev-lang/R-3.1.0: biocLite(vsn) removes all files in /

2014-05-18 Thread jwd
On Sun, 18 May 2014 07:16:46 +0200
Juergen Rose r...@rz.uni-potsdam.de wrote:

What disappeared are links and three files.  The links are recreatable,
although they would be better placed in user space rather than
under /.  Of the three files, the *bz2 appears to be part of a Gentoo
release, the second a grub configuration backup - not needed, and the
last a log file.  While the locaton of these files and links might be
an idiosyncrasy of the Linux distribution you are using, most
distributions are inherently more careful in configuration.  You should
get into the habit of creating a user with more limited scope than root
and learn to use su and sudo if you need super-user rights.
Working from root could seriously imperil your system and your work's
integrity.  

JWDougherty

__
R-help@r-project.org mailing list
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] Testing parallel regression assumption

2014-05-18 Thread caoweina
Dear Rose :
I saw your questions about the R function that performs brant test. Have 
you worked out ?  Please give some advice. I need to do  the brant test in R . 
Thank you very much!
   sincerely!

   Anna
__
R-help@r-project.org mailing list
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] Second axis on bottom of graph

2014-05-18 Thread Hurr
Sorry, I'm enclosing incomplete not-runnable code.

axis(1,tick=TRUE,at=horTicLocs,labels=rep(,length(horLabels)),padj=0)
staxlab(1,at=horTicLocs,labels=horLabels,srt=90,adj=c(1,0)) 
nFrqTicInvls=9; frqTicLocs - vector(length=nFrqTicInvls+1); 
frqLabels - vector(length=nFrqTicInvls+1); 
frqInvl=(horAxisLims[2]-horAxisLims[1])/nFrqTicInvls 
for(i in 1:(nFrqTicInvls+1))frqTicLocs[i]=horAxisLims[1]+(i-1)*frqInvl 
for(i in
1:(nFrqTicInvls+1))frqLabels[i]=.jcall(OuWid,S,sR,frqTicLocs[i],as.integer(4))
 
for(i in 1:(nFrqTicInvls+1))print(frqLabels[i]) 
axis(1,tick=TRUE,line=3.5,at=frqTicLocs,labels=rep(,length(frqLabels)),padj=0)
 
staxlab(1,at=frqTicLocs,labels=frqLabels,srt=90,adj=c(1,0)) 

The first axis and first staxlab works.
The second axis is OK below the first axis.
The print(frqLabels[i]) is OK.
But the second staxlab puts the frqLabels[i] on the first (upper) axis.
I must have to add something to the second staxlab to select second axis? 

Hurr




--
View this message in context: 
http://r.789695.n4.nabble.com/Second-axis-on-bottom-of-graph-tp4690696p4690803.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@r-project.org mailing list
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] Second axis on bottom of graph

2014-05-18 Thread Jim Lemon
On Sun, 18 May 2014 09:56:03 PM Hurr wrote:
 Sorry, I'm enclosing incomplete not-runnable code.
 
 
axis(1,tick=TRUE,at=horTicLocs,labels=rep(,length(horLabels)),padj=0)
 staxlab(1,at=horTicLocs,labels=horLabels,srt=90,adj=c(1,0))
 nFrqTicInvls=9; frqTicLocs - vector(length=nFrqTicInvls+1);
 frqLabels - vector(length=nFrqTicInvls+1);
 frqInvl=(horAxisLims[2]-horAxisLims[1])/nFrqTicInvls
 for(i in 1:(nFrqTicInvls+1))frqTicLocs[i]=horAxisLims[1]+(i-1)*frqInvl
 for(i in
 1:
(nFrqTicInvls+1))frqLabels[i]=.jcall(OuWid,S,sR,frqTicLocs[i],as.integ
 er(4)) for(i in 1:(nFrqTicInvls+1))print(frqLabels[i])
 
axis(1,tick=TRUE,line=3.5,at=frqTicLocs,labels=rep(,length(frqLabels)),pad
 j=0) staxlab(1,at=frqTicLocs,labels=frqLabels,srt=90,adj=c(1,0))
 
 The first axis and first staxlab works.
 The second axis is OK below the first axis.
 The print(frqLabels[i]) is OK.
 But the second staxlab puts the frqLabels[i] on the first (upper) axis.
 I must have to add something to the second staxlab to select second 
axis?
 
Try looking at the help page, in particular the top.line argument.

Jim

__
R-help@r-project.org mailing list
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-es] Utilizar scripts de PHP en R

2014-05-18 Thread Alvaro Franquet
Hola a todos, Estoy interesado en usar un Script de PHP desde R y me
gustaría saber si eso es posible y como se hace. Muchas gracias de antemano
por las respuestas.

[[alternative HTML version deleted]]

___
R-help-es mailing list
R-help-es@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-help-es