Re: [R] Error in file.exists(swf.file) : invalid 'file' argument

2014-07-08 Thread David Winsemius

On Jul 8, 2014, at 5:49 PM, Jeff Newmiller wrote:

> Code is corrupted. Please post in plain text as the Posting Guide indicates 
> is expected of you.

To explain a bit further Making text BOLD in formatted email adds 
extraneous asterisks in what some of us see in a plain text mail client. We 
could conceivably do some sort of global replacement of the '*'  ... but why 
should we? You are expected to post in plain text.  

Furthermore I'm guessing that saveSWF is a function from some non-base package. 
I do not see a library(,) or require(.) call that loads the package.

-- 
David,
> ---
> Jeff NewmillerThe .   .  Go Live...
> DCN:Basics: ##.#.   ##.#.  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 July 8, 2014 2:28:04 PM PDT, Cheryl Johnson  
> wrote:
>> *I am receiving the error message ���*Error in file.exists(swf.file) :
>> invalid 'file' argument*��� from my swf2html command. In addition,
>> there is a
>> command that says the Flash file was created: ���*Flash has been
>> created at:
>> C:\Users\CHERYL\AppData\Local\Temp\Rtmp6n6FXw\file2.swf*���*
>> 
>> *Below is the R code. Thanks in advance for any guidance.*
>> 
>> 
>> 
>> *g<-c(0.1,0.2,0.3)*
>> 
>> *#This function produces the swf file.*
>> 
>> *myanimation<-function(v){*
>> 
>> *output1=saveSWF({*
>> 
>> **
>> 
>> *}, img.name  = "file",swf.name  =
>> "file2.swf" , single.opts = "'utf8': false", autoplay = FALSE , *
>> 
>> *interval = 0.1, imgdir = "directory", htmlfile = "random.html",
>> ani.height
>> = 500, *
>> 
>> *ani.width = 500, title = "groups", *
>> 
>> *description = c("group1", "group2"))*
>> 
>> *return(output1)*
>> 
>> }
>> 
>> #These commands create the html page.
>> 
>> dir.create(file.path(tempdir(),"R2HTML"))
>> 
>> target <-
>> HTMLInitFile(file.path(tempdir(),"R2HTML"),filename="sample2",
>> BackGroundColor="#EE")
>> 
>> HTMLInsertGraph("Title",file=target)
>> 
>> #This for loop calls the animation function with each value of g.
>> 
>> for(v in g){
>> 
>> output2=myanimation(v)
>> 
>> HTML(swf2html(output2),file=target)
>> 
>> }
>> 
>>  [[alternative HTML version deleted]]


David Winsemius
Alameda, CA, USA

__
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] reorder a list

2014-07-08 Thread arun
You may also try:
library(reshape2)
 A2 <- melt(A1)

split(A2[,2],A2[,1])
A.K.




On Tuesday, July 8, 2014 12:57 PM, Lorenzo Alfieri  wrote:
Hi,
I'm trying to find a way to reorder the elements of a list.
Let's say I have a list like this:
A1<-list(c(1:4),c(2,4,5),23,c(4,5,13))

> A1
[[1]]
[1] 1 2 3 4

[[2]]
[1] 2 4 5

[[3]]
[1] 23

[[4]]
[1]  4  5 13

All the elements included in it are values, while each sublist is a time index
Now, I'd like to reorder the list (without looping) so to obtain one sublist 
for each value, which include all the time indices where each value appears.
In other words, the result should look like this:
>A2
[[1]]
[1] 1

[[2]]
[1] 1 2    #because value "2" appears in the time index [[1]] and [[2]] of A1

[[3]]
[1] 1

[[4]]
[1] 1 2 4

[[5]]
[1] 2 4

[[13]]
[1] 4

[[23]]
[1] 3

Any suggestion?
Thanks
Alfio

                          
    [[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] Error in file.exists(swf.file) : invalid 'file' argument

2014-07-08 Thread Jeff Newmiller
Code is corrupted. Please post in plain text as the Posting Guide indicates is 
expected of you.
---
Jeff NewmillerThe .   .  Go Live...
DCN:Basics: ##.#.   ##.#.  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 July 8, 2014 2:28:04 PM PDT, Cheryl Johnson  
wrote:
>*I am receiving the error message ���*Error in file.exists(swf.file) :
>invalid 'file' argument*��� from my swf2html command. In addition,
>there is a
>command that says the Flash file was created: ���*Flash has been
>created at:
>C:\Users\CHERYL\AppData\Local\Temp\Rtmp6n6FXw\file2.swf*���*
>
>*Below is the R code. Thanks in advance for any guidance.*
>
>
>
>*g<-c(0.1,0.2,0.3)*
>
>*#This function produces the swf file.*
>
>*myanimation<-function(v){*
>
>*output1=saveSWF({*
>
>**
>
>*}, img.name  = "file",swf.name  =
>"file2.swf" , single.opts = "'utf8': false", autoplay = FALSE , *
>
>*interval = 0.1, imgdir = "directory", htmlfile = "random.html",
>ani.height
>= 500, *
>
>*ani.width = 500, title = "groups", *
>
>*description = c("group1", "group2"))*
>
>*return(output1)*
>
>}
>
>#These commands create the html page.
>
>dir.create(file.path(tempdir(),"R2HTML"))
>
>target <-
>HTMLInitFile(file.path(tempdir(),"R2HTML"),filename="sample2",
>BackGroundColor="#EE")
>
>HTMLInsertGraph("Title",file=target)
>
>#This for loop calls the animation function with each value of g.
>
>for(v in g){
>
>  output2=myanimation(v)
>
>  HTML(swf2html(output2),file=target)
>
>}
>
>   [[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.


[R] Error in file.exists(swf.file) : invalid 'file' argument

2014-07-08 Thread Cheryl Johnson
*I am receiving the error message “*Error in file.exists(swf.file) :
invalid 'file' argument*” from my swf2html command. In addition, there is a
command that says the Flash file was created: “*Flash has been created at:
C:\Users\CHERYL\AppData\Local\Temp\Rtmp6n6FXw\file2.swf*”*

*Below is the R code. Thanks in advance for any guidance.*



*g<-c(0.1,0.2,0.3)*

*#This function produces the swf file.*

*myanimation<-function(v){*

*output1=saveSWF({*

**

*}, img.name  = "file",swf.name  =
"file2.swf" , single.opts = "'utf8': false", autoplay = FALSE , *

*interval = 0.1, imgdir = "directory", htmlfile = "random.html", ani.height
= 500, *

*ani.width = 500, title = "groups", *

*description = c("group1", "group2"))*

*return(output1)*

}

#These commands create the html page.

dir.create(file.path(tempdir(),"R2HTML"))

target <- HTMLInitFile(file.path(tempdir(),"R2HTML"),filename="sample2",
BackGroundColor="#EE")

HTMLInsertGraph("Title",file=target)

#This for loop calls the animation function with each value of g.

for(v in g){

  output2=myanimation(v)

  HTML(swf2html(output2),file=target)

}

[[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] unable to install rJava in centos R

2014-07-08 Thread Harish Nair
Iam unable to install rJava in centos R, its the base to install rhdfs.
Please help and look at the output i got while installing rJava.
> install.packages( c("rJava"))
Installing package into
‘/home/training/R/x86_64-redhat-linux-gnu-library/3.1’
(as ‘lib’ is unspecified)
--- Please select a CRAN mirror for use in this session ---
trying URL 'http://ftp.iitm.ac.in/cran/src/contrib/rJava_0.9-6.tar.gz'
Content type 'application/x-gzip' length 567515 bytes (554 Kb)
opened URL
==
downloaded 554 Kb

* installing *source* package ‘rJava’ ...
** package ‘rJava’ successfully unpacked and MD5 sums checked
checking for gcc... gcc -m64 -std=gnu99
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc -m64 -std=gnu99 accepts -g... yes
checking for gcc -m64 -std=gnu99 option to accept ISO C89... none needed
checking how to run the C preprocessor... gcc -m64 -std=gnu99 -E
checking for grep that handles long lines and -e... /bin/grep
checking for egrep... /bin/grep -E
checking for ANSI C header files... yes
checking for sys/wait.h that is POSIX.1 compatible... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking for string.h... (cached) yes
checking sys/time.h usability... yes
checking sys/time.h presence... yes
checking for sys/time.h... yes
checking for unistd.h... (cached) yes
checking for an ANSI C-conforming const... yes
checking whether time.h and sys/time.h may both be included... yes
configure: checking whether gcc -m64 -std=gnu99 supports static inline...
yes
checking whether setjmp.h is POSIX.1 compatible... yes
checking whether sigsetjmp is declared... yes
checking whether siglongjmp is declared... yes
checking Java support in R... present:
interpreter : '/usr/bin/java'
archiver: '/usr/bin/jar'
compiler: '/usr/bin/javac'
header prep.: '/usr/bin/javah'
cpp flags   : '-I/usr/java/jdk1.6.0_31/jre/../include
-I/usr/java/jdk1.6.0_31/jre/../include/linux'
java libs   : '-L/usr/java/jdk1.6.0_31/jre/lib/amd64/server -ljvm'
checking whether Java run-time works... yes
checking whether -Xrs is supported... yes
checking whether JNI programs can be compiled... yes
checking JNI data types... configure: error: One or more JNI types differ
from the corresponding native type. You may need to use non-standard
compiler flags or a different compiler in order to fix this.
ERROR: configuration failed for package ‘rJava’
* removing ‘/home/training/R/x86_64-redhat-linux-gnu-library/3.1/rJava’

The downloaded source packages are in
‘/tmp/Rtmp1RKjkQ/downloaded_packages’
Warning message:
In install.packages(c("rJava")) :
  installation of package ‘rJava’ had non-zero exit status

Please find below what I got from R CMD javareconf -ed, its showing the
correct path i have given on the bash.profile file. please let me know what
about i do to install rJava and then rhdfs..
$ R CMD javareconf -ed
Java interpreter : /etc/alternatives/java_sdk_openjdk/jre/bin/java
Java version : 1.6.0_30
Java home path   : /etc/alternatives/java_sdk_openjdk
Java compiler: /etc/alternatives/java_sdk_openjdk/bin/javac
Java headers gen.: /etc/alternatives/java_sdk_openjdk/bin/javah
Java archive tool: /etc/alternatives/java_sdk_openjdk/bin/jar

trying to compile and link a JNI progam
detected JNI cpp flags: -I$(JAVA_HOME)/include
-I$(JAVA_HOME)/include/linux
detected JNI linker flags :
-L/usr/lib/jvm/java-1.6.0-openjdk-1.6.0.0.x86_64/jre/lib/amd64/server -ljvm
gcc -m64 -std=gnu99 -I/usr/include/R -DNDEBUG
-I/etc/alternatives/java_sdk_openjdk/include
-I/etc/alternatives/java_sdk_openjdk/include/linux -I/usr/local/include
 -fpic  -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions
-fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic  -c
conftest.c -o conftest.o
gcc -m64 -std=gnu99 -shared -L/usr/local/lib64 -o conftest.so conftest.o
-L/usr/lib/jvm/java-1.6.0-openjdk-1.6.0.0.x86_64/jre/lib/amd64/server -ljvm
-L/usr/lib64/R/lib -lR


JAVA_HOME: /etc/alternatives/java_sdk_openjdk
Java library path:
/usr/lib/jvm/java-1.6.0-openjdk-1.6.0.0.x86_64/jre/lib/amd64/server
JNI cpp flags: -I$(JAVA_HOME)/include -I$(JAVA_HOME)/include/linux
JNI linker flags :
-L/usr/lib/jvm/java-1.6.0-openjdk-1.6.0.0.x86_64/jre/lib/amd64/server -ljvm
Updating Java configuration in /usr/lib64/R
/usr/lib64/R/bin/javareconf: line 405: /usr/lib64/R/etc/Makeconf.new:
Permission denied
*** cannot create /usr/lib64/R/etc/Makeconf.new
*** Please run as root if required.

[[alternative HTML versio

Re: [R] Seprate last name and first name into two columns

2014-07-08 Thread farnoosh sheikhi
It actually worked perfectly.
Thank you so much. I always learn a lot from you:).

 
Farnoosh




On Monday, July 7, 2014 6:51 PM, arun  wrote:
 


Not sure this helps as you provided only very little info.

library(stringr)

str1 <- c("TE MA CRUZ  ABEL","JOSE  AN    ANDRA","AL    MIGUEL","ALV", 
"Farnoosh  Sheikhi", "D  Art", "Rob K Kim")

do.call(rbind,lapply(str_split(str_replace_all(str1,perl('(?<= )([A-Za-z]+)$'), 
",\\1"),","),function(x) {x1 <- str_trim(x); if(length(x1)==1) c(NA, x1) else 
x1}))
    [,1] [,2] 
[1,] "TE MA CRUZ" "ABEL"   
[2,] "JOSE  AN"   "ANDRA"  
[3,] "AL" "MIGUEL" 
[4,] NA   "ALV"    
[5,] "Farnoosh"   "Sheikhi"
[6,] "D"  "Art"    
[7,] "Rob K"  "Kim"    





On Monday, July 7, 2014 3:39 PM, farnoosh sheikhi  wrote:



Last names: 

TE MA CRUZ

JOSE  AN

AL
ALV

Farnoosh




On Monday, July 7, 2014 10:41 AM, arun  wrote:



Can you specify what should be the last name in the cases you showed?
I thought First name will be "Te Ma Cruz", "Jose An", AL, and what about "ALV".






On Monday, July 7, 2014 1:34 PM, farnoosh sheikhi  wrote:



4: "TE MA CRUZ      ABEL"
3: "JOSE  AN    ANDRA"
2: "AL        MIGUEL"

1: "ALV"


There is only 4 last name with one pattern and the pattern is "LastName  
FirstName"

Thanks.
Farnoosh


On Monday, July 7, 2014 10:29 AM, arun  wrote:




Please show all the five patterns.  Also, in this case, which one is the last 
name?



On Monday, July 7, 2014 1:21 PM, farnoosh sheikhi  wrote:



Something like this: "DE LI TRUZ      ANGEL  J.


Farnoosh




On Monday, July 7, 2014 10:16 AM, arun  wrote:




Could you show the 5 patterns?
Arun


On Monday, July 7, 2014 12:44 PM, farnoosh sheikhi  
wrote:



Hi
Arun,

Thanks for the email. It looks like I have 5 patterns, but most the names are 2 
and 3 pattern.
What
is the best way to separate them?
Thanks tons.




On Friday, July 4, 2014 2:01 AM, arun  wrote:



Hi Farnoosh,
You dont' have to go through all the lines. 
You can try:

library(stringr)
vec1 <- c("Arun Kirshna Sasikala Appukuttan", "Farnoosh Sheikhi", "D Art")
sapply(str_match_all(vec1, '\\S+'),length)
#[1] 4 2 2

 which(sapply(str_match_all(vec1, '\\S+'),length)>2) #gives the index of lines 
or strings with >2 words
#[1] 1


Arun









On
Friday, July 4, 2014 2:39 AM, farnoosh sheikhi  wrote:



Hi Arun, 
I have about 2 names. So hard to go through every line. I mostly have space 
between first and last name. Is there a way to check that by writing codes?
Sent from Yahoo
Mail on Android 






Subject:  Re: Seprate last name and first name into two columns 
Sent:  Fri, Jul 4, 2014 2:03:13 AM 


Hi Farnoosh,

In cases with multiple first or last names, For e.g. "Rob K Kim", here, last 
name should be
Kim.  But, for "Arun Kirshna Sasikala Appukuttan", the last name would be 
"Sasikala Appukuttan".  Do you have any
other pattern to identify the first and
last names?
Arun




 wrote:



Hi Arun,

Hope all is well. I have a data set that last name and first name recorded into 
one column with space between them.
Some thing like this:

data<-as.data.frame(c("Farnoosh  Sheikhi", "D  Art", "Rob K Kim"))
data
colnames(data)<-"Name"

I want to separate them into two
columns. 
Thanks a lot and happy 4th in advance.

Farnoosh
[[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] [R-es] Consulta paquetización con versión R 3.1.0

2014-07-08 Thread Eva Prieto Castro
Thank you, Frede. People like you make me feel a very good person.

I am from Spain and my English is not good; moreover I did not go to school
the day of insults lesson, so fortunately I do not understand most of your
words in this mail.

Conclusion: Ignorance is bliss (in this case...)

I am sure Ducan knows I am grateful to him for saving my ignorance with his
knowledge. Thanks, Duncan.

Eva


2014-07-08 19:12 GMT+02:00 Frede Aakmann Tøgersen :

>  Congratulations Eva
>
>  I have been following this thread loosely.  Well in the sense that I
> really didn't understand what was going on but hopefully thinking that I
> could learn something from it.
>
>  Your approach to your particular setup didn't pay any attention to the
> heed by Duncan. So you hard headed (pig headed, stubborn as a monkey)
> wanted it to be your way.
>
>  Now I guess you accidentally found the error you introduced between
> R-3.0.2 and R-3.1.0.
>
>  Thank you for your persistent work that took you a step further to doing
> it all wrong in R.
>
>  And thanks to Duncan for adding invaluable help to this list.
>
>  Br. Frede
>
>
>  Sendt fra Samsung mobil
>   Oprindelig meddelelse 
> Fra: Eva Prieto Castro
> Dato:08/07/2014 18.39 (GMT+01:00)
> Til: Duncan Murdoch
> Cc: r-help
> Emne: Re: [R] [R-es] Consulta paquetización con versión R 3.1.0
>
>  Solved!!
>
> I removed this line:
>
> .ChrL.env$bStarted <- FALSE
>
> And run ok!!
>
> I supose the method let the fact of initializing data structure, but not
> the fact of assign.
>
> The basic example runs ok. Now I have to test all the project.
>
>
> Thanks!!
>
> Eva
>
>
>
> 2014-07-08 13:02 GMT+02:00 Eva Prieto Castro :
>
> > Duncan,
> >
> > Not always the .ChrL.env is non-existent, but also the functions in the
> > package (when I use the package) do not find it. If you ChrL.Start it
> does
> > not find the environment created.
> >
> > The situation is like (at all effects) the environment created was beeing
> > obviated by the package.
> >
> > Eva
> >
> >
> > 2014-07-08 12:55 GMT+02:00 Eva Prieto Castro  >:
> >
> >> Duncan,
> >>
> >> I don't export it in the sense that I dont't include it in namespaces as
> >> "export()" because it is not a function. Simply I include it in
> >> ChrL-internal.r, as follows:
> >>
> >>  .ChrL.env <- new.env()
> >>
> >>
> >> I always dit it in this way and it run (simple past!) ok, but now it
> does
> >> not run and I don't know the reason.
> >>
> >> Thanks.
> >>
> >> Eva
> >>
> >>
> >> 2014-07-08 12:49 GMT+02:00 Duncan Murdoch :
> >>
> >>> On 08/07/2014, 12:56 AM, Eva Prieto Castro wrote:
> >>> > Duncan,
> >>> >
> >>> > Yes, it has exactly that line.
> >>> >
> >>> > I know it does not exists because of this:
> >>> >
> >>> >> library("ChrL")
> >>> >> .ChrL.env
> >>> > Error: objeto '.ChrL.env' no encontrado
> >>>
> >>> That says that you did not export it.  It is only visible from code
> >>> within the package.
> >>>
> >>> Duncan Murdoch
> >>>
> >>> >
> >>> >
> >>> >
> >>> > However, it should be as follows:
> >>> >
> >>> >> library("ChrL")
> >>> >> .ChrL.env
> >>> > 
> >>> >
> >>> >
> >>> > I'm desperate; I have to solve this urgently and I don't find the
> >>> solution.
> >>> >
> >>> > Thanks again.
> >>> >
> >>> > Eva
> >>> >
> >>> >
> >>> > 2014-07-08 1:56 GMT+02:00 Duncan Murdoch  >>> > >:
> 
> >>> >
> >>> > On 07/07/2014, 7:13 PM, Eva Prieto Castro wrote:
> >>> > > Duncan,
> >>> > >
> >>> > > The ChrL folder has the following components:
> >>> > >
> >>> > > * Description file
> >>> > > * Namespace file
> >>> > > * R folder, including 3 files: CheckGloCreated.r, ChrL.Start.r
> >>> and
> >>> > > ChrL-internal.r
> >>> > >
> >>> >
> >>> > And does ChrL-internal.r contain just one line as you said
> before,
> >>> i.e.
> >>> >
> >>> > .ChrL.env <- new.env()
> >>> >
> >>> > ?
> >>> >
> >>> > If so, how have you determined that .ChrL.env does not exist?
> >>>  Names
> >>> > that start with a "." don't show up in ls() listings by default.
> >>> You
> >>> > can't use exists() to test for .ChrL.env in either of the other
> >>> files,
> >>> > because they are probably sourced before it is (depending on the
> >>> > collation order).  It won't exist when you run them, but it will
> >>> exist
> >>> > in the package namespace when you load the package.
> >>> >
> >>> > Duncan Murdoch
> >>> >
> >>> > > Obs.: Sometimes I remove man folder and another I adjust the rd
> >>> files.
> >>> > > In all cases the result is the same:.ChrL.env does not exist!.
> >>> > >
> >>> > > Description file:
> >>> > >
> >>> > > Package: ChrL
> >>> > > Type: Package
> >>> > > Title: What the package does (short line)
> >>> > > Version: 1.0
> >>> > > Date: 2014-07-08
> >>> > > Author: Eva Prieto Castro
> >>> > > Maintainer: Eva Prieto Castro  >>> > 
> >>> > > 

Re: [R] reorder a list

2014-07-08 Thread William Dunlap
f <- function (x) {
lengths <- vapply(x, FUN = length, FUN.VALUE = 0L)
split(rep(seq_along(x), lengths), unlist(x, use.names = FALSE))
}
f(A1) # gives about what you want (has, e.g., name 23, not position
23, in output)
Bill Dunlap
TIBCO Software
wdunlap tibco.com


On Tue, Jul 8, 2014 at 9:39 AM, Lorenzo Alfieri  wrote:
> Hi,
> I'm trying to find a way to reorder the elements of a list.
> Let's say I have a list like this:
> A1<-list(c(1:4),c(2,4,5),23,c(4,5,13))
>
>> A1
> [[1]]
> [1] 1 2 3 4
>
> [[2]]
> [1] 2 4 5
>
> [[3]]
> [1] 23
>
> [[4]]
> [1]  4  5 13
>
> All the elements included in it are values, while each sublist is a time index
> Now, I'd like to reorder the list (without looping) so to obtain one sublist 
> for each value, which include all the time indices where each value appears.
> In other words, the result should look like this:
>>A2
> [[1]]
> [1] 1
>
> [[2]]
> [1] 1 2#because value "2" appears in the time index [[1]] and [[2]] of A1
>
> [[3]]
> [1] 1
>
> [[4]]
> [1] 1 2 4
>
> [[5]]
> [1] 2 4
>
> [[13]]
> [1] 4
>
> [[23]]
> [1] 3
>
> Any suggestion?
> Thanks
> Alfio
>
>
> [[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] reorder a list

2014-07-08 Thread Greg Snow
Oops, I combined 2 ideas (by chance it still worked), the last line
should have been one of the following:

split( rep( seq_along(A1), sapply(A1,length) ), tmp )

split( as.numeric(sub('\\..*$','',names(tmp))), tmp )

On Tue, Jul 8, 2014 at 11:41 AM, Greg Snow <538...@gmail.com> wrote:
> Here is another approach inspired by Jim's answer:
>
>> names(A1) <- paste0(seq_along(A1),'.')
>> tmp <- unlist(A1)
>> split( rep( seq_along(A1), sapply(A1,length) ), 
>> as.numeric(sub('\\..+$','',tmp)) )
> $`1`
> [1] 1
>
> $`2`
> [1] 1 2
>
> $`3`
> [1] 1
>
> $`4`
> [1] 1 2 4
>
> $`5`
> [1] 2 4
>
> $`13`
> [1] 4
>
> $`23`
> [1] 3
>
> On Tue, Jul 8, 2014 at 11:10 AM, jim holtman  wrote:
>> Try this:
>>
>>> A1<-list(c(1:4),c(2,4,5),23,c(4,5,13))
>>>
>>> # unlist with the list number
>>> result <- do.call(rbind, sapply(seq(length(A1)), function(.indx){
>> + cbind(value = A1[[.indx]], index = .indx)
>> + }))
>>>
>>> ans <- split(result[, 2], result[, 1])
>>> ans
>> $`1`
>> [1] 1
>>
>> $`2`
>> [1] 1 2
>>
>> $`3`
>> [1] 1
>>
>> $`4`
>> [1] 1 2 4
>>
>> $`5`
>> [1] 2 4
>>
>> $`13`
>> [1] 4
>>
>> $`23`
>> [1] 3
>>
>>
>>
>> Jim Holtman
>> Data Munger Guru
>>
>> What is the problem that you are trying to solve?
>> Tell me what you want to do, not how you want to do it.
>>
>>
>> On Tue, Jul 8, 2014 at 12:39 PM, Lorenzo Alfieri 
>> wrote:
>>
>>> Hi,
>>> I'm trying to find a way to reorder the elements of a list.
>>> Let's say I have a list like this:
>>> A1<-list(c(1:4),c(2,4,5),23,c(4,5,13))
>>>
>>> > A1
>>> [[1]]
>>> [1] 1 2 3 4
>>>
>>> [[2]]
>>> [1] 2 4 5
>>>
>>> [[3]]
>>> [1] 23
>>>
>>> [[4]]
>>> [1]  4  5 13
>>>
>>> All the elements included in it are values, while each sublist is a time
>>> index
>>> Now, I'd like to reorder the list (without looping) so to obtain one
>>> sublist for each value, which include all the time indices where each value
>>> appears.
>>> In other words, the result should look like this:
>>> >A2
>>> [[1]]
>>> [1] 1
>>>
>>> [[2]]
>>> [1] 1 2#because value "2" appears in the time index [[1]] and [[2]] of
>>> A1
>>>
>>> [[3]]
>>> [1] 1
>>>
>>> [[4]]
>>> [1] 1 2 4
>>>
>>> [[5]]
>>> [1] 2 4
>>>
>>> [[13]]
>>> [1] 4
>>>
>>> [[23]]
>>> [1] 3
>>>
>>> Any suggestion?
>>> Thanks
>>> Alfio
>>>
>>>
>>> [[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.
>>>
>>
>> [[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.
>
>
>
> --
> Gregory (Greg) L. Snow Ph.D.
> 538...@gmail.com



-- 
Gregory (Greg) L. Snow Ph.D.
538...@gmail.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] reorder a list

2014-07-08 Thread Greg Snow
Here is another approach inspired by Jim's answer:

> names(A1) <- paste0(seq_along(A1),'.')
> tmp <- unlist(A1)
> split( rep( seq_along(A1), sapply(A1,length) ), 
> as.numeric(sub('\\..+$','',tmp)) )
$`1`
[1] 1

$`2`
[1] 1 2

$`3`
[1] 1

$`4`
[1] 1 2 4

$`5`
[1] 2 4

$`13`
[1] 4

$`23`
[1] 3

On Tue, Jul 8, 2014 at 11:10 AM, jim holtman  wrote:
> Try this:
>
>> A1<-list(c(1:4),c(2,4,5),23,c(4,5,13))
>>
>> # unlist with the list number
>> result <- do.call(rbind, sapply(seq(length(A1)), function(.indx){
> + cbind(value = A1[[.indx]], index = .indx)
> + }))
>>
>> ans <- split(result[, 2], result[, 1])
>> ans
> $`1`
> [1] 1
>
> $`2`
> [1] 1 2
>
> $`3`
> [1] 1
>
> $`4`
> [1] 1 2 4
>
> $`5`
> [1] 2 4
>
> $`13`
> [1] 4
>
> $`23`
> [1] 3
>
>
>
> Jim Holtman
> Data Munger Guru
>
> What is the problem that you are trying to solve?
> Tell me what you want to do, not how you want to do it.
>
>
> On Tue, Jul 8, 2014 at 12:39 PM, Lorenzo Alfieri 
> wrote:
>
>> Hi,
>> I'm trying to find a way to reorder the elements of a list.
>> Let's say I have a list like this:
>> A1<-list(c(1:4),c(2,4,5),23,c(4,5,13))
>>
>> > A1
>> [[1]]
>> [1] 1 2 3 4
>>
>> [[2]]
>> [1] 2 4 5
>>
>> [[3]]
>> [1] 23
>>
>> [[4]]
>> [1]  4  5 13
>>
>> All the elements included in it are values, while each sublist is a time
>> index
>> Now, I'd like to reorder the list (without looping) so to obtain one
>> sublist for each value, which include all the time indices where each value
>> appears.
>> In other words, the result should look like this:
>> >A2
>> [[1]]
>> [1] 1
>>
>> [[2]]
>> [1] 1 2#because value "2" appears in the time index [[1]] and [[2]] of
>> A1
>>
>> [[3]]
>> [1] 1
>>
>> [[4]]
>> [1] 1 2 4
>>
>> [[5]]
>> [1] 2 4
>>
>> [[13]]
>> [1] 4
>>
>> [[23]]
>> [1] 3
>>
>> Any suggestion?
>> Thanks
>> Alfio
>>
>>
>> [[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.
>>
>
> [[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.



-- 
Gregory (Greg) L. Snow Ph.D.
538...@gmail.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] reorder a list

2014-07-08 Thread Greg Snow
And here is another approach:

> out <- vector('list',length(unique(unlist(A1
> names(out) <- sort(unique(unlist(A1)))
> for( i in seq_along(A1) ) {
+ for( j in as.character(A1[[i]]) ) {
+ out[[j]] <- c(out[[j]], i)
+ }
+ }
>
> out
$`1`
[1] 1

$`2`
[1] 1 2

$`3`
[1] 1

$`4`
[1] 1 2 4

$`5`
[1] 2 4

$`13`
[1] 4

$`23`
[1] 3

Which approach is faster/more efficient could depend on what your real
data looks like, how big the list is, how large/variable the vectors
within the list are.  Both methods could probably also be improved,
but unless the list is big enough that either takes quite a bit of
time then it is probably not worth the time to optimize them.

On Tue, Jul 8, 2014 at 11:11 AM, Greg Snow <538...@gmail.com> wrote:
> Here is one approach that gives almost the same answer as your example:
>
>> A1<-list(c(1:4),c(2,4,5),23,c(4,5,13))
>>
>> A2 <- sort(unique(unlist(A1)))
>> names(A2) <- A2
>> sapply(A2, function(x) which( sapply(A1, function(y) x %in% y) ),
> + simplify=FALSE, USE.NAMES=TRUE )
> $`1`
> [1] 1
>
> $`2`
> [1] 1 2
>
> $`3`
> [1] 1
>
> $`4`
> [1] 1 2 4
>
> $`5`
> [1] 2 4
>
> $`13`
> [1] 4
>
> $`23`
> [1] 3
>
> If you want the `23` to be in the 23rd element of the list (with empty
> values before it) then just change A2 to be a vector from 1 to the
> largest value
>
> On Tue, Jul 8, 2014 at 10:39 AM, Lorenzo Alfieri  wrote:
>> Hi,
>> I'm trying to find a way to reorder the elements of a list.
>> Let's say I have a list like this:
>> A1<-list(c(1:4),c(2,4,5),23,c(4,5,13))
>>
>>> A1
>> [[1]]
>> [1] 1 2 3 4
>>
>> [[2]]
>> [1] 2 4 5
>>
>> [[3]]
>> [1] 23
>>
>> [[4]]
>> [1]  4  5 13
>>
>> All the elements included in it are values, while each sublist is a time 
>> index
>> Now, I'd like to reorder the list (without looping) so to obtain one sublist 
>> for each value, which include all the time indices where each value appears.
>> In other words, the result should look like this:
>>>A2
>> [[1]]
>> [1] 1
>>
>> [[2]]
>> [1] 1 2#because value "2" appears in the time index [[1]] and [[2]] of A1
>>
>> [[3]]
>> [1] 1
>>
>> [[4]]
>> [1] 1 2 4
>>
>> [[5]]
>> [1] 2 4
>>
>> [[13]]
>> [1] 4
>>
>> [[23]]
>> [1] 3
>>
>> Any suggestion?
>> Thanks
>> Alfio
>>
>>
>> [[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.
>
>
>
> --
> Gregory (Greg) L. Snow Ph.D.
> 538...@gmail.com



-- 
Gregory (Greg) L. Snow Ph.D.
538...@gmail.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] [R-es] Consulta paquetización con versión R 3.1.0

2014-07-08 Thread Frede Aakmann Tøgersen
Congratulations Eva

I have been following this thread loosely.  Well in the sense that I really 
didn't understand what was going on but hopefully thinking that I could learn 
something from it.

Your approach to your particular setup didn't pay any attention to the heed by 
Duncan. So you hard headed (pig headed, stubborn as a monkey) wanted it to be 
your way.

Now I guess you accidentally found the error you introduced between R-3.0.2 and 
R-3.1.0.

Thank you for your persistent work that took you a step further to doing it all 
wrong in R.

And thanks to Duncan for adding invaluable help to this list.

Br. Frede


Sendt fra Samsung mobil
 Oprindelig meddelelse 
Fra: Eva Prieto Castro
Dato:08/07/2014 18.39 (GMT+01:00)
Til: Duncan Murdoch
Cc: r-help
Emne: Re: [R] [R-es] Consulta paquetización con versión R 3.1.0

Solved!!

I removed this line:

.ChrL.env$bStarted <- FALSE

And run ok!!

I supose the method let the fact of initializing data structure, but not
the fact of assign.

The basic example runs ok. Now I have to test all the project.


Thanks!!

Eva



2014-07-08 13:02 GMT+02:00 Eva Prieto Castro :

> Duncan,
>
> Not always the .ChrL.env is non-existent, but also the functions in the
> package (when I use the package) do not find it. If you ChrL.Start it does
> not find the environment created.
>
> The situation is like (at all effects) the environment created was beeing
> obviated by the package.
>
> Eva
>
>
> 2014-07-08 12:55 GMT+02:00 Eva Prieto Castro :
>
>> Duncan,
>>
>> I don't export it in the sense that I dont't include it in namespaces as
>> "export()" because it is not a function. Simply I include it in
>> ChrL-internal.r, as follows:
>>
>>  .ChrL.env <- new.env()
>>
>>
>> I always dit it in this way and it run (simple past!) ok, but now it does
>> not run and I don't know the reason.
>>
>> Thanks.
>>
>> Eva
>>
>>
>> 2014-07-08 12:49 GMT+02:00 Duncan Murdoch :
>>
>>> On 08/07/2014, 12:56 AM, Eva Prieto Castro wrote:
>>> > Duncan,
>>> >
>>> > Yes, it has exactly that line.
>>> >
>>> > I know it does not exists because of this:
>>> >
>>> >> library("ChrL")
>>> >> .ChrL.env
>>> > Error: objeto '.ChrL.env' no encontrado
>>>
>>> That says that you did not export it.  It is only visible from code
>>> within the package.
>>>
>>> Duncan Murdoch
>>>
>>> >
>>> >
>>> >
>>> > However, it should be as follows:
>>> >
>>> >> library("ChrL")
>>> >> .ChrL.env
>>> > 
>>> >
>>> >
>>> > I'm desperate; I have to solve this urgently and I don't find the
>>> solution.
>>> >
>>> > Thanks again.
>>> >
>>> > Eva
>>> >
>>> >
>>> > 2014-07-08 1:56 GMT+02:00 Duncan Murdoch >> > >:
>>> >
>>> > On 07/07/2014, 7:13 PM, Eva Prieto Castro wrote:
>>> > > Duncan,
>>> > >
>>> > > The ChrL folder has the following components:
>>> > >
>>> > > * Description file
>>> > > * Namespace file
>>> > > * R folder, including 3 files: CheckGloCreated.r, ChrL.Start.r
>>> and
>>> > > ChrL-internal.r
>>> > >
>>> >
>>> > And does ChrL-internal.r contain just one line as you said before,
>>> i.e.
>>> >
>>> > .ChrL.env <- new.env()
>>> >
>>> > ?
>>> >
>>> > If so, how have you determined that .ChrL.env does not exist?
>>>  Names
>>> > that start with a "." don't show up in ls() listings by default.
>>> You
>>> > can't use exists() to test for .ChrL.env in either of the other
>>> files,
>>> > because they are probably sourced before it is (depending on the
>>> > collation order).  It won't exist when you run them, but it will
>>> exist
>>> > in the package namespace when you load the package.
>>> >
>>> > Duncan Murdoch
>>> >
>>> > > Obs.: Sometimes I remove man folder and another I adjust the rd
>>> files.
>>> > > In all cases the result is the same:.ChrL.env does not exist!.
>>> > >
>>> > > Description file:
>>> > >
>>> > > Package: ChrL
>>> > > Type: Package
>>> > > Title: What the package does (short line)
>>> > > Version: 1.0
>>> > > Date: 2014-07-08
>>> > > Author: Eva Prieto Castro
>>> > > Maintainer: Eva Prieto Castro >> > 
>>> > > >> >>>
>>> > > Description: Test Pkg
>>> > > License: Unlimited
>>> > >
>>> > > Namespace file:
>>> > > exportPattern("^[[:alpha:]]+")
>>> > >
>>> > > I also test with this namespace file:
>>> > > export(ChrL.Start)
>>> > >
>>> > > Thank you very much, again.
>>> > >
>>> > > Eva
>>> > >
>>> > >
>>> > > 2014-07-08 0:55 GMT+02:00 Duncan Murdoch <
>>> murdoch.dun...@gmail.com
>>> > 
>>> > > > murdoch.dun...@gmail.com>>>:
>>> > >
>>> > > On 07/07/2014, 6:39 PM, Eva Prieto Castro wrote:
>>> > > > Hi again, Duncan
>>> > > >
>>> > > > I think I must tell you all the 

Re: [R] reorder a list

2014-07-08 Thread jim holtman
Try this:

> A1<-list(c(1:4),c(2,4,5),23,c(4,5,13))
>
> # unlist with the list number
> result <- do.call(rbind, sapply(seq(length(A1)), function(.indx){
+ cbind(value = A1[[.indx]], index = .indx)
+ }))
>
> ans <- split(result[, 2], result[, 1])
> ans
$`1`
[1] 1

$`2`
[1] 1 2

$`3`
[1] 1

$`4`
[1] 1 2 4

$`5`
[1] 2 4

$`13`
[1] 4

$`23`
[1] 3



Jim Holtman
Data Munger Guru

What is the problem that you are trying to solve?
Tell me what you want to do, not how you want to do it.


On Tue, Jul 8, 2014 at 12:39 PM, Lorenzo Alfieri 
wrote:

> Hi,
> I'm trying to find a way to reorder the elements of a list.
> Let's say I have a list like this:
> A1<-list(c(1:4),c(2,4,5),23,c(4,5,13))
>
> > A1
> [[1]]
> [1] 1 2 3 4
>
> [[2]]
> [1] 2 4 5
>
> [[3]]
> [1] 23
>
> [[4]]
> [1]  4  5 13
>
> All the elements included in it are values, while each sublist is a time
> index
> Now, I'd like to reorder the list (without looping) so to obtain one
> sublist for each value, which include all the time indices where each value
> appears.
> In other words, the result should look like this:
> >A2
> [[1]]
> [1] 1
>
> [[2]]
> [1] 1 2#because value "2" appears in the time index [[1]] and [[2]] of
> A1
>
> [[3]]
> [1] 1
>
> [[4]]
> [1] 1 2 4
>
> [[5]]
> [1] 2 4
>
> [[13]]
> [1] 4
>
> [[23]]
> [1] 3
>
> Any suggestion?
> Thanks
> Alfio
>
>
> [[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.
>

[[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] reorder a list

2014-07-08 Thread Greg Snow
Here is one approach that gives almost the same answer as your example:

> A1<-list(c(1:4),c(2,4,5),23,c(4,5,13))
>
> A2 <- sort(unique(unlist(A1)))
> names(A2) <- A2
> sapply(A2, function(x) which( sapply(A1, function(y) x %in% y) ),
+ simplify=FALSE, USE.NAMES=TRUE )
$`1`
[1] 1

$`2`
[1] 1 2

$`3`
[1] 1

$`4`
[1] 1 2 4

$`5`
[1] 2 4

$`13`
[1] 4

$`23`
[1] 3

If you want the `23` to be in the 23rd element of the list (with empty
values before it) then just change A2 to be a vector from 1 to the
largest value

On Tue, Jul 8, 2014 at 10:39 AM, Lorenzo Alfieri  wrote:
> Hi,
> I'm trying to find a way to reorder the elements of a list.
> Let's say I have a list like this:
> A1<-list(c(1:4),c(2,4,5),23,c(4,5,13))
>
>> A1
> [[1]]
> [1] 1 2 3 4
>
> [[2]]
> [1] 2 4 5
>
> [[3]]
> [1] 23
>
> [[4]]
> [1]  4  5 13
>
> All the elements included in it are values, while each sublist is a time index
> Now, I'd like to reorder the list (without looping) so to obtain one sublist 
> for each value, which include all the time indices where each value appears.
> In other words, the result should look like this:
>>A2
> [[1]]
> [1] 1
>
> [[2]]
> [1] 1 2#because value "2" appears in the time index [[1]] and [[2]] of A1
>
> [[3]]
> [1] 1
>
> [[4]]
> [1] 1 2 4
>
> [[5]]
> [1] 2 4
>
> [[13]]
> [1] 4
>
> [[23]]
> [1] 3
>
> Any suggestion?
> Thanks
> Alfio
>
>
> [[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.



-- 
Gregory (Greg) L. Snow Ph.D.
538...@gmail.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] reorder a list

2014-07-08 Thread Lorenzo Alfieri
Hi,
I'm trying to find a way to reorder the elements of a list.
Let's say I have a list like this:
A1<-list(c(1:4),c(2,4,5),23,c(4,5,13))

> A1
[[1]]
[1] 1 2 3 4

[[2]]
[1] 2 4 5

[[3]]
[1] 23

[[4]]
[1]  4  5 13

All the elements included in it are values, while each sublist is a time index
Now, I'd like to reorder the list (without looping) so to obtain one sublist 
for each value, which include all the time indices where each value appears.
In other words, the result should look like this:
>A2
[[1]]
[1] 1

[[2]]
[1] 1 2#because value "2" appears in the time index [[1]] and [[2]] of A1

[[3]]
[1] 1

[[4]]
[1] 1 2 4

[[5]]
[1] 2 4

[[13]]
[1] 4

[[23]]
[1] 3

Any suggestion?
Thanks
Alfio

  
[[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] [R-es] Consulta paquetización con versión R 3.1.0

2014-07-08 Thread Eva Prieto Castro
Solved!!

I removed this line:

.ChrL.env$bStarted <- FALSE

And run ok!!

I supose the method let the fact of initializing data structure, but not
the fact of assign.

The basic example runs ok. Now I have to test all the project.


Thanks!!

Eva



2014-07-08 13:02 GMT+02:00 Eva Prieto Castro :

> Duncan,
>
> Not always the .ChrL.env is non-existent, but also the functions in the
> package (when I use the package) do not find it. If you ChrL.Start it does
> not find the environment created.
>
> The situation is like (at all effects) the environment created was beeing
> obviated by the package.
>
> Eva
>
>
> 2014-07-08 12:55 GMT+02:00 Eva Prieto Castro :
>
>> Duncan,
>>
>> I don't export it in the sense that I dont't include it in namespaces as
>> "export()" because it is not a function. Simply I include it in
>> ChrL-internal.r, as follows:
>>
>>  .ChrL.env <- new.env()
>>
>>
>> I always dit it in this way and it run (simple past!) ok, but now it does
>> not run and I don't know the reason.
>>
>> Thanks.
>>
>> Eva
>>
>>
>> 2014-07-08 12:49 GMT+02:00 Duncan Murdoch :
>>
>>> On 08/07/2014, 12:56 AM, Eva Prieto Castro wrote:
>>> > Duncan,
>>> >
>>> > Yes, it has exactly that line.
>>> >
>>> > I know it does not exists because of this:
>>> >
>>> >> library("ChrL")
>>> >> .ChrL.env
>>> > Error: objeto '.ChrL.env' no encontrado
>>>
>>> That says that you did not export it.  It is only visible from code
>>> within the package.
>>>
>>> Duncan Murdoch
>>>
>>> >
>>> >
>>> >
>>> > However, it should be as follows:
>>> >
>>> >> library("ChrL")
>>> >> .ChrL.env
>>> > 
>>> >
>>> >
>>> > I'm desperate; I have to solve this urgently and I don't find the
>>> solution.
>>> >
>>> > Thanks again.
>>> >
>>> > Eva
>>> >
>>> >
>>> > 2014-07-08 1:56 GMT+02:00 Duncan Murdoch >> > >:
>>> >
>>> > On 07/07/2014, 7:13 PM, Eva Prieto Castro wrote:
>>> > > Duncan,
>>> > >
>>> > > The ChrL folder has the following components:
>>> > >
>>> > > * Description file
>>> > > * Namespace file
>>> > > * R folder, including 3 files: CheckGloCreated.r, ChrL.Start.r
>>> and
>>> > > ChrL-internal.r
>>> > >
>>> >
>>> > And does ChrL-internal.r contain just one line as you said before,
>>> i.e.
>>> >
>>> > .ChrL.env <- new.env()
>>> >
>>> > ?
>>> >
>>> > If so, how have you determined that .ChrL.env does not exist?
>>>  Names
>>> > that start with a "." don't show up in ls() listings by default.
>>> You
>>> > can't use exists() to test for .ChrL.env in either of the other
>>> files,
>>> > because they are probably sourced before it is (depending on the
>>> > collation order).  It won't exist when you run them, but it will
>>> exist
>>> > in the package namespace when you load the package.
>>> >
>>> > Duncan Murdoch
>>> >
>>> > > Obs.: Sometimes I remove man folder and another I adjust the rd
>>> files.
>>> > > In all cases the result is the same:.ChrL.env does not exist!.
>>> > >
>>> > > Description file:
>>> > >
>>> > > Package: ChrL
>>> > > Type: Package
>>> > > Title: What the package does (short line)
>>> > > Version: 1.0
>>> > > Date: 2014-07-08
>>> > > Author: Eva Prieto Castro
>>> > > Maintainer: Eva Prieto Castro >> > 
>>> > > >> >>>
>>> > > Description: Test Pkg
>>> > > License: Unlimited
>>> > >
>>> > > Namespace file:
>>> > > exportPattern("^[[:alpha:]]+")
>>> > >
>>> > > I also test with this namespace file:
>>> > > export(ChrL.Start)
>>> > >
>>> > > Thank you very much, again.
>>> > >
>>> > > Eva
>>> > >
>>> > >
>>> > > 2014-07-08 0:55 GMT+02:00 Duncan Murdoch <
>>> murdoch.dun...@gmail.com
>>> > 
>>> > > > murdoch.dun...@gmail.com>>>:
>>> > >
>>> > > On 07/07/2014, 6:39 PM, Eva Prieto Castro wrote:
>>> > > > Hi again, Duncan
>>> > > >
>>> > > > I think I must tell you all the details of the method I
>>> use, in
>>> > > order to
>>> > > > make possible you notice my error.
>>> > >
>>> > > Your error is in calling package.skeleton.  As I said before,
>>> > you should
>>> > > have done this once, when you first thought of creating the
>>> ChrL
>>> > > package, and *you should never call it again* for that
>>> package.
>>> > >
>>> > > The normal workflow after the single call to that function is
>>> > to edit
>>> > > the files in the ChrL directory.  Don't call package.skeleton
>>> > again.
>>> > >
>>> > > If you want to describe the problems you are having, you
>>> should be
>>> > > describing the contents of the ChrL directory, not how they
>>> were
>>> > > created.  That is normally irrelevant, except t

Re: [R] PCA with a lot of zeros

2014-07-08 Thread Martyn Byng
Hi,

Not sure if these are relevant as they have been on my "must look at" list for 
some time and I've not managed to get around to it ...

http://www.cmap.polytechnique.fr/~aspremon/PDF/SPCAhandbookSV.pdf
http://www2.imm.dtu.dk/projects/manifold/Papers/sparsepc.pdf

Martyn

-Original Message-
From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On 
Behalf Of Jim Silverton
Sent: 08 July 2014 17:30
To: r-help@r-project.org
Subject: Re: [R] PCA with a lot of zeros

Hello all,
I was wondering if R has some routine that can handle PCA with a lot of zeros. 
I have fourteen variables - these variables represent angles...so there are 
some negative and some positive angles. Histograms appear sparse
- in the sense that there are gaps. Any ideas or papers would be greatly 
appreciated.


--
Thanks,
Jim.

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


This e-mail has been scanned for all viruses by Star.\ _...{{dropped:3}}

__
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] [R-es] Consulta paquetización con versión R 3.1.0

2014-07-08 Thread Eva Prieto Castro
Duncan,

Not always the .ChrL.env is non-existent, but also the functions in the
package (when I use the package) do not find it. If you ChrL.Start it does
not find the environment created.

The situation is like (at all effects) the environment created was beeing
obviated by the package.

Eva


2014-07-08 12:55 GMT+02:00 Eva Prieto Castro :

> Duncan,
>
> I don't export it in the sense that I dont't include it in namespaces as
> "export()" because it is not a function. Simply I include it in
> ChrL-internal.r, as follows:
>
>  .ChrL.env <- new.env()
>
>
> I always dit it in this way and it run (simple past!) ok, but now it does
> not run and I don't know the reason.
>
> Thanks.
>
> Eva
>
>
> 2014-07-08 12:49 GMT+02:00 Duncan Murdoch :
>
>> On 08/07/2014, 12:56 AM, Eva Prieto Castro wrote:
>> > Duncan,
>> >
>> > Yes, it has exactly that line.
>> >
>> > I know it does not exists because of this:
>> >
>> >> library("ChrL")
>> >> .ChrL.env
>> > Error: objeto '.ChrL.env' no encontrado
>>
>> That says that you did not export it.  It is only visible from code
>> within the package.
>>
>> Duncan Murdoch
>>
>> >
>> >
>> >
>> > However, it should be as follows:
>> >
>> >> library("ChrL")
>> >> .ChrL.env
>> > 
>> >
>> >
>> > I'm desperate; I have to solve this urgently and I don't find the
>> solution.
>> >
>> > Thanks again.
>> >
>> > Eva
>> >
>> >
>> > 2014-07-08 1:56 GMT+02:00 Duncan Murdoch > > >:
>> >
>> > On 07/07/2014, 7:13 PM, Eva Prieto Castro wrote:
>> > > Duncan,
>> > >
>> > > The ChrL folder has the following components:
>> > >
>> > > * Description file
>> > > * Namespace file
>> > > * R folder, including 3 files: CheckGloCreated.r, ChrL.Start.r and
>> > > ChrL-internal.r
>> > >
>> >
>> > And does ChrL-internal.r contain just one line as you said before,
>> i.e.
>> >
>> > .ChrL.env <- new.env()
>> >
>> > ?
>> >
>> > If so, how have you determined that .ChrL.env does not exist?  Names
>> > that start with a "." don't show up in ls() listings by default. You
>> > can't use exists() to test for .ChrL.env in either of the other
>> files,
>> > because they are probably sourced before it is (depending on the
>> > collation order).  It won't exist when you run them, but it will
>> exist
>> > in the package namespace when you load the package.
>> >
>> > Duncan Murdoch
>> >
>> > > Obs.: Sometimes I remove man folder and another I adjust the rd
>> files.
>> > > In all cases the result is the same:.ChrL.env does not exist!.
>> > >
>> > > Description file:
>> > >
>> > > Package: ChrL
>> > > Type: Package
>> > > Title: What the package does (short line)
>> > > Version: 1.0
>> > > Date: 2014-07-08
>> > > Author: Eva Prieto Castro
>> > > Maintainer: Eva Prieto Castro > > 
>> > > > >>>
>> > > Description: Test Pkg
>> > > License: Unlimited
>> > >
>> > > Namespace file:
>> > > exportPattern("^[[:alpha:]]+")
>> > >
>> > > I also test with this namespace file:
>> > > export(ChrL.Start)
>> > >
>> > > Thank you very much, again.
>> > >
>> > > Eva
>> > >
>> > >
>> > > 2014-07-08 0:55 GMT+02:00 Duncan Murdoch <
>> murdoch.dun...@gmail.com
>> > 
>> > > > >>>:
>> > >
>> > > On 07/07/2014, 6:39 PM, Eva Prieto Castro wrote:
>> > > > Hi again, Duncan
>> > > >
>> > > > I think I must tell you all the details of the method I
>> use, in
>> > > order to
>> > > > make possible you notice my error.
>> > >
>> > > Your error is in calling package.skeleton.  As I said before,
>> > you should
>> > > have done this once, when you first thought of creating the
>> ChrL
>> > > package, and *you should never call it again* for that
>> package.
>> > >
>> > > The normal workflow after the single call to that function is
>> > to edit
>> > > the files in the ChrL directory.  Don't call package.skeleton
>> > again.
>> > >
>> > > If you want to describe the problems you are having, you
>> should be
>> > > describing the contents of the ChrL directory, not how they
>> were
>> > > created.  That is normally irrelevant, except that in your
>> > case, I think
>> > > that is the source of the problem.
>> > >
>> > > Duncan Murdoch
>> > >
>> > > However, you must know that this
>> > > > method run on 3.0.1 version (not in 3.0.2 and not in 3.1.0;
>> this
>> > > is the
>> > > > problem!).
>> > > >
>> > > > 1) This is my code in "D:/probando.r" :
>> > > >
>> > > >
>> > > > .ChrL.env <- new.env()
>

Re: [R] [R-es] Consulta paquetización con versión R 3.1.0

2014-07-08 Thread Eva Prieto Castro
Duncan,

I don't export it in the sense that I dont't include it in namespaces as
"export()" because it is not a function. Simply I include it in
ChrL-internal.r, as follows:

 .ChrL.env <- new.env()


I always dit it in this way and it run (simple past!) ok, but now it does
not run and I don't know the reason.

Thanks.

Eva


2014-07-08 12:49 GMT+02:00 Duncan Murdoch :

> On 08/07/2014, 12:56 AM, Eva Prieto Castro wrote:
> > Duncan,
> >
> > Yes, it has exactly that line.
> >
> > I know it does not exists because of this:
> >
> >> library("ChrL")
> >> .ChrL.env
> > Error: objeto '.ChrL.env' no encontrado
>
> That says that you did not export it.  It is only visible from code
> within the package.
>
> Duncan Murdoch
>
> >
> >
> >
> > However, it should be as follows:
> >
> >> library("ChrL")
> >> .ChrL.env
> > 
> >
> >
> > I'm desperate; I have to solve this urgently and I don't find the
> solution.
> >
> > Thanks again.
> >
> > Eva
> >
> >
> > 2014-07-08 1:56 GMT+02:00 Duncan Murdoch  > >:
> >
> > On 07/07/2014, 7:13 PM, Eva Prieto Castro wrote:
> > > Duncan,
> > >
> > > The ChrL folder has the following components:
> > >
> > > * Description file
> > > * Namespace file
> > > * R folder, including 3 files: CheckGloCreated.r, ChrL.Start.r and
> > > ChrL-internal.r
> > >
> >
> > And does ChrL-internal.r contain just one line as you said before,
> i.e.
> >
> > .ChrL.env <- new.env()
> >
> > ?
> >
> > If so, how have you determined that .ChrL.env does not exist?  Names
> > that start with a "." don't show up in ls() listings by default. You
> > can't use exists() to test for .ChrL.env in either of the other
> files,
> > because they are probably sourced before it is (depending on the
> > collation order).  It won't exist when you run them, but it will
> exist
> > in the package namespace when you load the package.
> >
> > Duncan Murdoch
> >
> > > Obs.: Sometimes I remove man folder and another I adjust the rd
> files.
> > > In all cases the result is the same:.ChrL.env does not exist!.
> > >
> > > Description file:
> > >
> > > Package: ChrL
> > > Type: Package
> > > Title: What the package does (short line)
> > > Version: 1.0
> > > Date: 2014-07-08
> > > Author: Eva Prieto Castro
> > > Maintainer: Eva Prieto Castro  > 
> > > >>
> > > Description: Test Pkg
> > > License: Unlimited
> > >
> > > Namespace file:
> > > exportPattern("^[[:alpha:]]+")
> > >
> > > I also test with this namespace file:
> > > export(ChrL.Start)
> > >
> > > Thank you very much, again.
> > >
> > > Eva
> > >
> > >
> > > 2014-07-08 0:55 GMT+02:00 Duncan Murdoch  > 
> > >  >>>:
> > >
> > > On 07/07/2014, 6:39 PM, Eva Prieto Castro wrote:
> > > > Hi again, Duncan
> > > >
> > > > I think I must tell you all the details of the method I use,
> in
> > > order to
> > > > make possible you notice my error.
> > >
> > > Your error is in calling package.skeleton.  As I said before,
> > you should
> > > have done this once, when you first thought of creating the
> ChrL
> > > package, and *you should never call it again* for that package.
> > >
> > > The normal workflow after the single call to that function is
> > to edit
> > > the files in the ChrL directory.  Don't call package.skeleton
> > again.
> > >
> > > If you want to describe the problems you are having, you
> should be
> > > describing the contents of the ChrL directory, not how they
> were
> > > created.  That is normally irrelevant, except that in your
> > case, I think
> > > that is the source of the problem.
> > >
> > > Duncan Murdoch
> > >
> > > However, you must know that this
> > > > method run on 3.0.1 version (not in 3.0.2 and not in 3.1.0;
> this
> > > is the
> > > > problem!).
> > > >
> > > > 1) This is my code in "D:/probando.r" :
> > > >
> > > >
> > > > .ChrL.env <- new.env()
> > > > .ChrL.env$lGlo <- list()
> > > > .ChrL.env$bStarted <- FALSE
> > > >
> > > > CheckGloCreated <- function() {
> > > >   if (.ChrL.env$bStarted == TRUE) {
> > > > stop("Data structures were already initialized.",
> > call.=FALSE)
> > > >   }
> > > > }
> > > > ChrL.Start <- function() {
> > > >   CheckGloCreated()
> > > >   cat("Tested.\n")
> > > > }
> > > >
> > > > 2) I open RGUI and run the following:
> > > >
> > 

Re: [R] [R-es] Consulta paquetización con versión R 3.1.0

2014-07-08 Thread Eva Prieto Castro
Hi again,

I tested again without dot (i.e. ChrL.env and not .ChrL.env) and the
problem exists too.

I don't have any other idea to test.

Regards.

Eva


2014-07-08 7:00 GMT+02:00 Eva Prieto Castro :

> Moreover, with ls(all.names=TRUE) it should appear and it does not.
>
> Eva
>
>
> 2014-07-08 6:56 GMT+02:00 Eva Prieto Castro :
>
>> Duncan,
>>
>> Yes, it has exactly that line.
>>
>> I know it does not exists because of this:
>>
>> > library("ChrL")
>> > .ChrL.env
>> Error: objeto '.ChrL.env' no encontrado
>>
>>
>>
>> However, it should be as follows:
>>
>> > library("ChrL")
>> > .ChrL.env
>> 
>>
>>
>> I'm desperate; I have to solve this urgently and I don't find the
>> solution.
>>
>> Thanks again.
>>
>> Eva
>>
>>
>> 2014-07-08 1:56 GMT+02:00 Duncan Murdoch :
>>
>>> On 07/07/2014, 7:13 PM, Eva Prieto Castro wrote:
>>> > Duncan,
>>> >
>>> > The ChrL folder has the following components:
>>> >
>>> > * Description file
>>> > * Namespace file
>>> > * R folder, including 3 files: CheckGloCreated.r, ChrL.Start.r and
>>> > ChrL-internal.r
>>> >
>>>
>>> And does ChrL-internal.r contain just one line as you said before, i.e.
>>>
>>> .ChrL.env <- new.env()
>>>
>>> ?
>>>
>>> If so, how have you determined that .ChrL.env does not exist?  Names
>>> that start with a "." don't show up in ls() listings by default. You
>>> can't use exists() to test for .ChrL.env in either of the other files,
>>> because they are probably sourced before it is (depending on the
>>> collation order).  It won't exist when you run them, but it will exist
>>> in the package namespace when you load the package.
>>>
>>> Duncan Murdoch
>>>
>>> > Obs.: Sometimes I remove man folder and another I adjust the rd files.
>>> > In all cases the result is the same:.ChrL.env does not exist!.
>>> >
>>> > Description file:
>>> >
>>> > Package: ChrL
>>> > Type: Package
>>> > Title: What the package does (short line)
>>> > Version: 1.0
>>> > Date: 2014-07-08
>>> > Author: Eva Prieto Castro
>>> > Maintainer: Eva Prieto Castro >> > >
>>> > Description: Test Pkg
>>> > License: Unlimited
>>> >
>>> > Namespace file:
>>> > exportPattern("^[[:alpha:]]+")
>>> >
>>> > I also test with this namespace file:
>>> > export(ChrL.Start)
>>> >
>>> > Thank you very much, again.
>>> >
>>> > Eva
>>> >
>>> >
>>> > 2014-07-08 0:55 GMT+02:00 Duncan Murdoch >> > >:
>>> >
>>> > On 07/07/2014, 6:39 PM, Eva Prieto Castro wrote:
>>> > > Hi again, Duncan
>>> > >
>>> > > I think I must tell you all the details of the method I use, in
>>> > order to
>>> > > make possible you notice my error.
>>> >
>>> > Your error is in calling package.skeleton.  As I said before, you
>>> should
>>> > have done this once, when you first thought of creating the ChrL
>>> > package, and *you should never call it again* for that package.
>>> >
>>> > The normal workflow after the single call to that function is to
>>> edit
>>> > the files in the ChrL directory.  Don't call package.skeleton
>>> again.
>>> >
>>> > If you want to describe the problems you are having, you should be
>>> > describing the contents of the ChrL directory, not how they were
>>> > created.  That is normally irrelevant, except that in your case, I
>>> think
>>> > that is the source of the problem.
>>> >
>>> > Duncan Murdoch
>>> >
>>> > However, you must know that this
>>> > > method run on 3.0.1 version (not in 3.0.2 and not in 3.1.0; this
>>> > is the
>>> > > problem!).
>>> > >
>>> > > 1) This is my code in "D:/probando.r" :
>>> > >
>>> > >
>>> > > .ChrL.env <- new.env()
>>> > > .ChrL.env$lGlo <- list()
>>> > > .ChrL.env$bStarted <- FALSE
>>> > >
>>> > > CheckGloCreated <- function() {
>>> > >   if (.ChrL.env$bStarted == TRUE) {
>>> > > stop("Data structures were already initialized.",
>>> call.=FALSE)
>>> > >   }
>>> > > }
>>> > > ChrL.Start <- function() {
>>> > >   CheckGloCreated()
>>> > >   cat("Tested.\n")
>>> > > }
>>> > >
>>> > > 2) I open RGUI and run the following:
>>> > >
>>> > > setwd("D:/")
>>> > > source("probando.r", encoding="utf-8")
>>> > > package.skeleton(name="ChrL", path="D:/")
>>> > >
>>> > > 3) At this point, ChrL folder has been created in D:/, so I
>>> adjust
>>> > > Description and Namespace files. In R folder, ChrL-internal.r
>>> file
>>> > is as
>>> > > I indicate below...
>>> > >
>>> > >>>
>>> > >>>
>>> > >>> My Namespace:
>>> > >>>
>>> > >>> export(ChrL.Start)
>>> > >>>
>>> > >>>
>>> > >>> My ChrL-internal.R:
>>> > >>>
>>> > >>> .ChrL.env <- new.env()
>>> > >
>>> > > 3) I go to bin folder (C:/Program Files/R/R-3.1.0/bin) and run
>>> the
>>> > > following:
>>> > >
>>> > > R CMD INSTALL D:/ChrL
>>> > >
>>> > > R CMD check D:/ChrL
>>> > >
>>> > > R CMD build D:/ChrL
>>> > 

[R] Formating cell with xlsx package

2014-07-08 Thread Soeren Groettrup
Hello everybody,

I am trying to format an excel file with R, which seems to me a quite 
hideous task.

However, I am using the 'xlsx' package, and I want to change the color 
of the bottom line without erasing the existing style of a cell. I ran 
the following code, but it gives me an error and I can't get it to work.

wb <- xlsx:::loadWorkbook(file = "Data/test.xlsx")
sheet <- xlsx:::getSheets(wb)[[1]]
rows  <- xlsx:::getRows(sheet, rowIndex=1)
cell.1 <- xlsx:::getCells(rows, colIndex=1)[[1]]
cs <- xlsx:::getCellStyle(cell.1) + Border(color = "green", position = 
"BOTTOM")

Error in xlsx:::getCellStyle(cell.1) + Border(color = "green", position = 
"BOTTOM") :
   non-numeric argument to binary operator



What am I doing wrong? Can anyone please help me.

Thank you very much!

Sincerely,
Sören

[[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] PCA with a lot of zeros

2014-07-08 Thread Jim Silverton
Hello all,
I was wondering if R has some routine that can handle PCA with a lot of
zeros. I have fourteen variables - these variables represent angles...so
there are some negative and some positive angles. Histograms appear sparse
- in the sense that there are gaps. Any ideas or papers would be greatly
appreciated.


-- 
Thanks,
Jim.

[[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] Survival Analysis with an Historical Control

2014-07-08 Thread Paul Miller
Hello All,

I'm trying to figure out how to perform a survival analysis with an historical 
control. I've spent some time looking online and in my boooks but haven't found 
much showing how to do this. Was wondering if there is a R package that can do 
it, or if there are resources somewhere that show the actual steps one takes, 
or if some knowledgeable person might be willing to share some code. 

Here is a statement that describes the sort of analyis I'm being asked to do.

A one-sample parametric test assuming an exponential form of survival was used 
to test the hypothesis that the treatment produces a median PFS no greater than 
the historical control PFS of 16 weeks.  A sample median PFS greater than 20.57 
weeks would fall beyond the critical value associated with the null hypothesis, 
and would be considered statistically significant at alpha = .05, 1 tailed.  

My understanding is that the cutoff of 20.57 weeks was obtained using an online 
calculator that can be found at:

http://www.swogstat.org/stat/public/one_survival.htm

Thus far, I've been unable to determine what values were plugged into the 
calculator to get the cutoff.

There's another calculator for a nonparamertric test that can be found at:

http://www.swogstat.org/stat/public/one_nonparametric_survival.htm

It would be nice to try doing this using both a parameteric and a 
non-parametric model.

So my first question would be whether the approach outlined above is valid or 
if the analysis should be done some other way. If the basic idea is correct, is 
it relatively easy (for a Terry Therneau type genius) to implement the whole 
thing using R? The calculator is a great tool, but, if reasonable, it would be 
nice to be able to look at some code to see how the numbers actually get 
produced.

Below are some sample survival data and code in case this proves helpful.

Thanks,

Paul

###
 Example Data: GD2 Vaccine 
###

connection <- textConnection("
GD2  1   8 12  GD2  3 -12 10  GD2  6 -52  7
GD2  7  28 10  GD2  8  44  6  GD2 10  14  8
GD2 12   3  8  GD2 14 -52  9  GD2 15  35 11
GD2 18   6 13  GD2 20  12  7  GD2 23  -7 13
GD2 24 -52  9  GD2 26 -52 12  GD2 28  36 13
GD2 31 -52  8  GD2 33   9 10  GD2 34 -11 16
GD2 36 -52  6  GD2 39  15 14  GD2 40  13 13
GD2 42  21 13  GD2 44 -24 16  GD2 46 -52 13
GD2 48  28  9  GD2  2  15  9  GD2  4 -44 10
GD2  5  -2 12  GD2  9   8  7  GD2 11  12  7
GD2 13 -52  7  GD2 16  21  7  GD2 17  19 11
GD2 19   6 16  GD2 21  10 16  GD2 22 -15  6
GD2 25   4 15  GD2 27  -9  9  GD2 29  27 10
GD2 30   1 17  GD2 32  12  8  GD2 35  20  8
GD2 37 -32  8  GD2 38  15  8  GD2 41   5 14
GD2 43  35 13  GD2 45  28  9  GD2 47   6 15
")

hsv <- data.frame(scan(connection, list(VAC="", PAT=0, WKS=0, X=0)))
hsv <- transform(hsv, CENS=ifelse(WKS < 1, 1, 0), WKS=abs(WKS))
head(hsv)

require("survival")

survObj <- Surv(hsv$WKS, hsv$CENS==0) ~ 1

km <- survfit(survObj, type=c("kaplan-meier"))
print(km)

paraExp <- survreg(survObj, dist="exponential")
print(paraExp)

__
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] Extrapolation of rarefaction curve

2014-07-08 Thread gktahon
Hi all,

I used R (vegan package) to make rarefaction curves and I calculated the
Chao index for each curve. However, the plateau is far from reached.
What I want to do now is the following:
Based on the Chao index, I want to extrapolate the curve so I get an x-value
which gives me an estimation of the total number of clones I'd have to pick
up and sequence in order to have a full coverage of the species diversity in
my sample. 
Is there anyone who knows how to do this? Using vegan or any other package?
Or is there any other way to calculate this x-value?

Thanks in advance!


Guillaume



--
View this message in context: 
http://r.789695.n4.nabble.com/Extrapolation-of-rarefaction-curve-tp4693693.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] eclat problem

2014-07-08 Thread Alvaro Flores
Thanks Uwe, i'll try to contact with them. I was expecting someone with the 
same problem here!

Kind regards.


Alvaro.




-Mensaje original-
De: Uwe Ligges [mailto:lig...@statistik.tu-dortmund.de] 
Enviado el: martes, 08 de julio de 2014 8:29
Para: Alvaro Flores; r-help@r-project.org
Asunto: Re: [R] eclat problem

This is something for the authors of that package...

Best,
Uwe Ligges




On 07.07.2014 22:56, Alvaro Flores wrote:
>
>
> I'm working with arule packages and I'm constantly trying to mine frequent 
> itemsets in different datasets. But recently R kept returning the same error 
> message :
>
>
>
> Error in eclat(txn, parameter = list(supp = 0.001)) :
>
>internal error in trio library
>
>
>
> Is just this particular dataset that gives me problems.
>
>
>
> Anyone has ever passed and fixed this error?
>
>
>
> Here are an example of the transaction data set:
>
> items
>
> 1  {001200-3,
>
>  004100-3,
>
>  004200-5,
>
>  004500-9,
>
>  004600-5}
>
> 2  {001524-K,
>
>  002100-2}
>
> 3  {00179,
>
>  03807,
>
>  08019,
>
>  09314,
>
>  12432}
>
> 4  {002000}
>
> 5  {002600-4,
>
>  002700-0}
>
> 6  {004115-F,
>
>  02/100073A,
>
>  02/630935A,
>
>  044.1567.0,
>
>  044.1567.0/I,
>
>  1010301FA,
>
>  1012015-400-,
>
>  1117285,
>
>  1118100-201-4020,
>
>  1118105-051-M,
>
>  173171,
>
>  1903628,
>
>  1903628/I,
>
>  1903629,
>
>  1903629/I,
>
>  1907566,
>
>  1907567,
>
>  1907570,
>
>  1907571,
>
>  1931018,
>
>  2.4419.340.0,
>
>  215420/N,
>
>  2654408-N,
>
>  2992242,
>
>  2992544,
>
>  2996416,
>
>  2VC-115561,
>
>  320/04133A,
>
>  4102AZL.14.100N00,
>
>  4110Z.14.30,
>
>  4625547,
>
>  477556,
>
>  477556/O,
>
>  478736,
>
>  478736/O,
>
>  500054655,
>
>  581/18096,
>
>  6170005,
>
>  957E-6731 A,
>
>  BF8T-6731 BA,
>
>  BG2X-6731 CA,
>
>  DBPN-6731 A,
>
>  F2NN-6714 AB,
>
>  LF16015,
>
>  LF3000,
>
>  LF3345,
>
>  LF3346,
>
>  LF3349,
>
>  LF3806,
>
>  LF4054,
>
>  LF9009,
>
>  RE504836,
>
>  RE59754,
>
>  T19044/I,
>
>  TAE-115561,
>
>  W-950/7,
>
>  ZP520}
>
> 7  {005226,
>
>  012.0348.0,
>
>  012.0349.0,
>
>  02/910150A,
>
>  1105010E834N00,
>
>  1105020D354,
>
>  1117011-630-W,
>
>  1117025-621-,
>
>  1372444,
>
>  1393640,
>
>  1457434310001,
>
>  1521219,
>
>  1873018,
>
>  1901605,
>
>  1902134,
>
>  1902138,
>
>  1902138/I,
>
>  1907640,
>
>  1907640/I,
>
>  1908547,
>
>  1908547/I,
>
>  1930010,
>
>  19BG920-30001,
>
>  20430751,
>
>  20514654,
>
>  20976003/O,
>
>  20998367,
>
>  215460,
>
>  26560143,
>
>  26560201,
>
>  26560201/I,
>
>  2710806,
>
>  2992241,
>
>  2992241/I,
>
>  2992300,
>
>  2992662,
>
>  2992662/I,
>
>  2995711,
>
>  2997376,
>
>  2R0-127177,
>
>  2R0-127177 A,
>
>  2RD-127491,
>
>  32/401102,
>
>  32/912001A,
>
>  32/925423,
>
>  32/925760,
>
>  32/925869,
>
>  32/925915,
>
>  320/07155,
>
>  343144,
>
>  4102H.15.110,
>
>  4102H.15.110N00,
>
>  4102H.15.20,
>
>  500315480,
>
>  500315480/I,
>
>  500316868,
>
>  550228,
>
>  550228/N,
>
>  582042,
>
>  612630080011N00,
>
>  612630080087,
>
>  7146717,
>
>  8159975/O,
>
>  81BASE921,
>
>  98439681,
>
>  AR50041,
>
>  BC1132N01,
>
>  BF0X-9155 AA,
>
>  BF5T-9155 AB,
>
>  BF8T-9155 DA,
>
>  DDN-99162 B,
>
>  DONN-9N074 BG,
>
>  E5HT-9155 CA,
>
>  E7HN-9155 AA,
>
>  FF42000,
>
>  FF5421,
>
>  FF5458,
>
>  FF5488,
>
>  FS1000,
>
>  FS1015,
>
>  FS1241,
>
>  FS1242,
>
>  FS1280,
>
>  PSD460/1,
>
>  PSD970/1,
>
>  R28-30M,
>
>  RC45MB,
>
>  RE62418,
>
>  RK120MBQ2,
>
>  T22VA,
>
>  WK-723}
>
> 8  {005227,
>
>  2641311,
>
>  2641371,
>
>  2641406,
>
>  2641725,
>
>  2641729,
>
>  2641808,
>
>  376518,
>
>  4757883,
>
>  72013,
>
>  72061,
>
>  8190393,
>
>  9986316,
>
>  D8NN-9350 AA,
>
>  DDN-9350,
>
>  RE42211}
>
> 9  {0055,
>
>  0087,
>
>  0482,
>
>  0484,
>
>  0531,
>
>  11329,
>
>  8311}
>
> 10 {007.0762.0/40,
>
>  014.0428.0,
>
>  1114036,
>
>  1118369,
>
>  1118375,
>
>  1118376,
>
>  1118377,
>
>  1118379,
>
>  1305546,
>
>  1312934,
>
>  1677591,
>
>  1677592,
>
>  1677593,
>
>  2.1539.130.0,
>
>  2.1539.259.0,
>
>  20515059/C,
>
>  275092/C,
>
>  275636/C,
>
>  2RD-107124,
>
>  31358393-G,
>
>  3135X031,
>
>  3135X063,
>
>  4622074,
>
>  4622074/G,
>
>  4742199,
>
>  4742202

Re: [R] eclat problem

2014-07-08 Thread Uwe Ligges

This is something for the authors of that package...

Best,
Uwe Ligges




On 07.07.2014 22:56, Alvaro Flores wrote:



I'm working with arule packages and I'm constantly trying to mine frequent 
itemsets in different datasets. But recently R kept returning the same error 
message :



Error in eclat(txn, parameter = list(supp = 0.001)) :

   internal error in trio library



Is just this particular dataset that gives me problems.



Anyone has ever passed and fixed this error?



Here are an example of the transaction data set:

items

1  {001200-3,

 004100-3,

 004200-5,

 004500-9,

 004600-5}

2  {001524-K,

 002100-2}

3  {00179,

 03807,

 08019,

 09314,

 12432}

4  {002000}

5  {002600-4,

 002700-0}

6  {004115-F,

 02/100073A,

 02/630935A,

 044.1567.0,

 044.1567.0/I,

 1010301FA,

 1012015-400-,

 1117285,

 1118100-201-4020,

 1118105-051-M,

 173171,

 1903628,

 1903628/I,

 1903629,

 1903629/I,

 1907566,

 1907567,

 1907570,

 1907571,

 1931018,

 2.4419.340.0,

 215420/N,

 2654408-N,

 2992242,

 2992544,

 2996416,

 2VC-115561,

 320/04133A,

 4102AZL.14.100N00,

 4110Z.14.30,

 4625547,

 477556,

 477556/O,

 478736,

 478736/O,

 500054655,

 581/18096,

 6170005,

 957E-6731 A,

 BF8T-6731 BA,

 BG2X-6731 CA,

 DBPN-6731 A,

 F2NN-6714 AB,

 LF16015,

 LF3000,

 LF3345,

 LF3346,

 LF3349,

 LF3806,

 LF4054,

 LF9009,

 RE504836,

 RE59754,

 T19044/I,

 TAE-115561,

 W-950/7,

 ZP520}

7  {005226,

 012.0348.0,

 012.0349.0,

 02/910150A,

 1105010E834N00,

 1105020D354,

 1117011-630-W,

 1117025-621-,

 1372444,

 1393640,

 1457434310001,

 1521219,

 1873018,

 1901605,

 1902134,

 1902138,

 1902138/I,

 1907640,

 1907640/I,

 1908547,

 1908547/I,

 1930010,

 19BG920-30001,

 20430751,

 20514654,

 20976003/O,

 20998367,

 215460,

 26560143,

 26560201,

 26560201/I,

 2710806,

 2992241,

 2992241/I,

 2992300,

 2992662,

 2992662/I,

 2995711,

 2997376,

 2R0-127177,

 2R0-127177 A,

 2RD-127491,

 32/401102,

 32/912001A,

 32/925423,

 32/925760,

 32/925869,

 32/925915,

 320/07155,

 343144,

 4102H.15.110,

 4102H.15.110N00,

 4102H.15.20,

 500315480,

 500315480/I,

 500316868,

 550228,

 550228/N,

 582042,

 612630080011N00,

 612630080087,

 7146717,

 8159975/O,

 81BASE921,

 98439681,

 AR50041,

 BC1132N01,

 BF0X-9155 AA,

 BF5T-9155 AB,

 BF8T-9155 DA,

 DDN-99162 B,

 DONN-9N074 BG,

 E5HT-9155 CA,

 E7HN-9155 AA,

 FF42000,

 FF5421,

 FF5458,

 FF5488,

 FS1000,

 FS1015,

 FS1241,

 FS1242,

 FS1280,

 PSD460/1,

 PSD970/1,

 R28-30M,

 RC45MB,

 RE62418,

 RK120MBQ2,

 T22VA,

 WK-723}

8  {005227,

 2641311,

 2641371,

 2641406,

 2641725,

 2641729,

 2641808,

 376518,

 4757883,

 72013,

 72061,

 8190393,

 9986316,

 D8NN-9350 AA,

 DDN-9350,

 RE42211}

9  {0055,

 0087,

 0482,

 0484,

 0531,

 11329,

 8311}

10 {007.0762.0/40,

 014.0428.0,

 1114036,

 1118369,

 1118375,

 1118376,

 1118377,

 1118379,

 1305546,

 1312934,

 1677591,

 1677592,

 1677593,

 2.1539.130.0,

 2.1539.259.0,

 20515059/C,

 275092/C,

 275636/C,

 2RD-107124,

 31358393-G,

 3135X031,

 3135X063,

 4622074,

 4622074/G,

 4742199,

 4742202,

 4770623,

 4803030/G,

 500337911,

 61316752,

 61316793,

 7114756,

 8815939,

 99435938,

 99448192,

 99467115,

 BF0X-6055 AA,

 BF0X-6055 AA/C,

 BF0X-6055 AA/CM,

 BF0X-6055 AA/M,

 BF8T-6055 AA,

 TAE-107125,

 TAF-107127,

 TE3-107125}

11 {008.4748.4,

 026566T3,

 1370794,

 1393185,

 1868005,

 2UH-141025,

 353430,

 5016033/034,

 5196807,

 9959900,

 9962518,

 E6NN-7563 AA,

 EONN-7563 BA,

 XC45-7563 BA/C/P,

 XC45-7563 CA}

12 {009.4749.3,

 1865836,

 2RD-141031,

 3191991,

 3610274,

 42102093,

 4999812/R,

 525587/D,

 887889,

 96HU-7550 AA,

 96HU-7550 AA/C,

 97HU-7550 AA/C,

 AL33315,

 C7NN-7550 V,

 D1NN-7550 A,

 D5NN-7550 A,

 E6NN-7550 ABL}

13 {0118,

 VLF-3200,

 VLF-3202,

 VLF-3205}

14 {014.5259.0/10,

 014.5260.0/10,

 014.5261.

Re: [R] writing matrices of different rows in a file

2014-07-08 Thread Uwe Ligges



On 07.07.2014 10:05, carol white wrote:

Hi,
What is the best way of writing of matrices of different rows in a file? Should 
the matrices with the same number of rows be written first and then, empty 
columns for the matrices with a smaller number of rows followed by the matrices 
with a larger number of rows? Not a good solution (see below).

Can't they be written with 1 script?

m = rbind(c(1,2),c(2,44))
n = rbind(c(1,3),c(2,4),c(5,8))

write.csv(cbind(m,n),...)
Error in .Method(..., deparse.level = deparse.level) :
   number of rows of matrices must match (see arg 2)


write.csv(cbind(m,n[1.2,]),...)
  write.csv(cbind(cbind(rep(" ",1), rep(" ",1)),n[3,]),...)

Warning message:
In write.csv(cbind(cbind(rep(" ", 1), rep(" ", 1)), n[3,  :
   attempt to set 'append' ignored



First combine them into one matrix, e.g. with missing values, then write...


Best,
Uwe Ligges




Thanks

Carol
[[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] (PLM- package) Residual-Plotting and missing Values

2014-07-08 Thread Uwe Ligges

If you havn't got a response yet, ask the package authors.

Best,
Uwe Ligges



On 01.07.2014 16:21, Katharina Mersmann wrote:

Dear R-Community,

I tried plotting the residuals of an FE-model estimated via plm .

And detected that there are no residuals in the plot for the last two
countries.

I guess this happens because for some countries values are missing and R
gives me the following for




fixed.reg1.new$resid[1]


  5

-0.4051985



Because the first 4 elements are missing. So there are residuals different
from zero for the last two countries, but because of NA there´s a shift
because the residuals are not padded to the correct length.



I´ve  read  in https://stat.ethz.ch/pipermail/r-help/2008-June/166312.html
and the manual

that na.action=na.exclude is useful in lm-case to avoid this:  “when
na.exclude is used the residuals and predictions are padded to the correct
length by inserting NAs for cases omitted by na.exclude”



and tried it for my plm regression, but it does not work.



Perhaps you have an Idea how to get residuals into the correct length? Or
another way to deal with it?









To make it easier explaining the way of proceeding, a reproducible example
could be:




# add NA´s for firm 6







data("Grunfeld", package = "plm")



Grunfeld$inv2= ifelse(Grunfeld$firm==6,NA, Grunfeld$inv)



data<- pdata.frame(Grunfeld,index=c("firm","year"))



fixed.reg1.1 <- plm(value~inv2+capital,


+data = data,na.action=na.exclude ,index=c("firm","year"),
model="within")


#resid(fixed.reg1.1)



# no values for firm 6, no residuals displayed from 101-120



fixed.reg1.1$resid[105]


  125

9.371963


require(lattice)



xyplot(resid(fixed.reg1.1) ~ firm, data=data)


# As you can see because of  the NA´s of firm 6 ,there´s a shift because the
residuals are not padded to the correct length,

#  and looking at the plot suggests there are no residuals for firm 10,
which is not true.







Thanks in advance for your help!

Have a nice day Katie








[[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] R help

2014-07-08 Thread Uwe Ligges



On 01.07.2014 17:18, Andre Weeks wrote:

To whom it may concern:

I installed R 3.1 and I get this.

In normalizePath(path.expand(path), winslash, mustWork) :
   path[1]="\\network\users\aweeks\My Documents/R/win-library/3.1": Access
is denied

Is there any way to change this path? I have looked it up on the internet
but cannot seem to find the right option.

If you could help me out, that would be fantastic.


See

?.libPaths

and find that you can set an environmetn variable R_LIBS_USER to change 
that path.


Best,
Uwe Ligges





Thanks in advance and have a wonderful day!



__
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] Predictions from "coxph" or "cph" objects

2014-07-08 Thread Göran Broström

On 2014-07-06 11:17, Göran Broström wrote:

On 2014-07-06 10:48, Göran Broström wrote:

David and Axel,

I have two comments to your discussion:

(i) The area under the survival curve is equal to the mean of the
distribution, so the estimate of the mean should be the sum of the areas
of the rectangles defined by the estimated survival curve and the
successive distances between observed event times.

Thus,

  > surv <- pred$surv
  > time <- pred$time
  > sum(surv * diff(time))

should give you the (estimated) mean). (Note that time[1] == 0, and
length(time) == length(surv) + 1)


Well, this is not quite true; on the first interval the survival curve
is one, so you need to

  > surv <- c(1, surv)

first. But then the lengths of the surv and time vectors do not match so
you need to add a (large) time at the end of time. If the largest
observation is an event, 'no problem' (surv is zero), but otherwise ...

Btw, I tried

  > exit <- rexp(10)
  > event <- rep(1, 10)
  > fit <- coxph(Surv(exit, event) ~ 1)

  > survfit(fit)$surv
   [1] 0.90483742 0.80968410 0.71454371 0.61942215 0.52432953 0.42928471
   [7] 0.33432727 0.23955596 0.14529803 0.05345216

  > survfit(Surv(exit, event) ~ 1)$surv
[1] 0.9 0.8 0.7 0.6 0.5 0.4 0.3 0.2 0.1 0.0

so be careful ...


Addendum: Note the argument 'type':

> survfit(fit, type = "kalbfleisch-prentice")$surv
 [1] 0.9 0.8 0.7 0.6 0.5 0.4 0.3 0.2 0.1 0.0

This gives, I think (at least if no ties), the nonparametric maximum 
likelihood estimator (NPMLE) of the baseline survivor function in the PH 
model, and thus coincides with the Kaplan-Meier estimator in the case of 
no covariates. It drops down to zero if the largest observation is a 
failure. See Kalbfleisch & Prentice (1980), pp. 84-86.


I suppose that the default type ( = "efron") simply uses the formula 
S(t) = exp(-H(t)) (on an estimator of H(t)), which never drops down to 
zero, censorings or no censorings. This relation does not hold for 
discrete-time distributions, and even if our underlying model is 
continuous, the resulting non-parametric estimator of H(t) define a 
discrete-time distribution, which causes a small dilemma for the purist. 
(Should 'type = "kalbfleisch-prentice"' be the default in survfit?)


However, in practice this is of no importance at all. If you stick to 
the median and quantiles.


Göran



Göran



(I do not think that David's suggestion gives the same answer, but I may
be wrong.)

(ii) With censored data, this may be a bad idea. For instance, when the
largest observation is a censoring time, you may badly underestimate the
mean. Your best hope is to be able to estimate a conditional mean of the
type E(T | T < x).

This is essentially a non-parametric situation, and therefore it is
better to stick to medians and quantiles.

Göran Broström

On 2014-07-06 06:17, David Winsemius wrote:


On Jul 5, 2014, at 9:12 PM, David Winsemius wrote:



On Jul 5, 2014, at 12:43 PM, Axel Urbiz wrote:


Thank you David. It is my understanding that using survfirsurvit
below I get the median predicted survival. I actually was looking
for the mean. I can't seem to find in the documentation how to get
that.

options(na.action=na.exclude) # retain NA in predictions
fit <- coxph(Surv(time, status) ~ age + ph.ecog, lung)
pred <- survfit(fit, newdata=lung)
head(pred)


There might be a way. I don't know it if so, so I would probably
just use the definition of the mean:

sum(summary(pred)$surv* summary(pred)$time)/sum(  summary(pred)$time)



Er, I think I meant to type:

fit <- coxph(Surv(time, status) ~ age + ph.ecog, lung)
pred <- survfit(fit)

sum(summary(pred)$surv* summary(pred)$time)/sum(  summary(pred)$surv)
[1] 211.0943



(I continue to take effort to keep my postings in plain text despite
my mail-clients's efforts to match your formatted postings. It adds
to the work of responders when you post formatted questions and
responses.)



Thanks again,
Axel.



On Sat, Jul 5, 2014 at 1:54 PM, David Winsemius 
wrote:


On Jul 5, 2014, at 5:28 AM, Axel Urbiz wrote:

Dear R users,

My apologies for the simple question, as I'm starting to learn the
concepts
behind the Cox PH model. I was just experimenting with the survival
and rms
packages for this.

I'm simply trying to obtain the expected survival time (as opposed
to the
probability of survival at a given time t).

What does "expected survival time" actually mean? Do you want the
median survival time?


I can't seem to find an option
from the "type" argument in the predict methods from
coxph{survival} or
cph{rms} that will give me expected survival times.

library(rms)
options(na.action=na.exclude) # retain NA in predictions
fit <- coxph(Surv(time, status) ~ age + ph.ecog, lung)
fit2 <-  cph(Surv(time, status) ~ age + ph.ecog, lung)
head(predict(fit,type="lp"))
head(predict(fit2,type="lp"))

`predict` will return the results of the regression, i.e. the log-
hazard ratios for each term in the RHS of the formula. What you
want (as described in the Index for the 

Re: [R] sort order of a character sequence is different on windose and linux (linux result)

2014-07-08 Thread Witold E Wolski
>From my reading of
http://r.789695.n4.nabble.com/internal-string-comparison-Scollate-td4687584.html
they have good arguments to ask for Scollate whatever it is in the R public API.


And from my point of view R would benefit from a tight integration of
data.table.
Without data.table R is very impractical to use, with data which is
avaiable today.

On 6 July 2014 14:15, Duncan Murdoch  wrote:
> On 06/07/2014, 7:56 AM, Witold E Wolski wrote:
>> This is the info I got from the data.table developers... Seems that
>> they did have tried to find a more elegant solution solution.:
>
> From my reading of the response below, data.table doesn't use R's sort()
> function to do their sorting.  You should use whatever sort function
> they use if you want to match their sort order.
>
> Duncan Murdoch
>
>>
>>
>> data.table used to support this until 1.8.6. But since Scollate became
>> not a part of authorised R-API (IIUC) anymore at some point,
>> data.table only supports sort/order under the C-locale.
>>
>> data.table's ordering/sorting is over 10-20x faster than base's and
>> the only way right now (IIUC) to sort by locale is to use base's
>> sort/order.
>>
>> This post may give some more insight.
>> http://r.789695.n4.nabble.com/internal-string-comparison-Scollate-td4687584.html
>>
>> In summary, we support only C-locale.
>>
>>
>> On 6 July 2014 13:33, Duncan Murdoch  wrote:
>>> On 06/07/2014, 7:19 AM, Witold E Wolski wrote:
 It seems that the package I am developing depends on the locale "C"
 because of interactions with other packages (data.table).

 So I would like to set the locale to "C" as soon as the package is loaded.
 Where can I do it .. I could of course set it in every function in my
 package but...

>>>
>>> As the help page says, you can't do it reliably on all platforms, and
>>> you really shouldn't even try:  that will affect other things that the
>>> user does.
>>>
>>> You will need to find another solution to your problem.
>>>
>>> Duncan Murdoch
>>
>>
>>
>



-- 
Witold Eryk Wolski

__
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] Fwd: Need some assistance in plotting distributions

2014-07-08 Thread Frede Aakmann Tøgersen
Well

plot(density(a$frequency), col = "blue")

lines(density(b$frequency), col = "green")

Where a is as Jim defined it and b similar from the other data file.


Yours sincerely / Med venlig hilsen


Frede Aakmann Tøgersen
Specialist, M.Sc., Ph.D.
Plant Performance & Modeling

Technology & Service Solutions
T +45 9730 5135
M +45 2547 6050
fr...@vestas.com
http://www.vestas.com

Company reg. name: Vestas Wind Systems A/S
This e-mail is subject to our e-mail disclaimer statement.
Please refer to www.vestas.com/legal/notice
If you have received this e-mail in error please contact the sender. 

> -Original Message-
> From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org]
> On Behalf Of Vivek Das
> Sent: 8. juli 2014 12:38
> To: jim holtman
> Cc: R help
> Subject: Re: [R] Fwd: Need some assistance in plotting distributions
> 
> Dear Jim,
> 
> Thank you for replying to my query. Both the files contains tumor
> mutational frequencies. The LG_freq contains the entire mutational
> landscape and the HIPS2_freq contains mutational frequency of one clone. I
> want to see how both the frequency curve are behaving in one plot. Is that
> possible to see in one plot with different colors to distinguish the
> frequency distribution of both files in one image where I can see both the
> plots. I have tried density plot but could not figure out how to add the
> next frequency distribution file to the same plot and see the difference in
> both the plots in one image with different colors. Can this be done?
> 
> --
> 
> Vivek Das
> 
> 
> 
> On Tue, Jul 8, 2014 at 12:19 PM, jim holtman  wrote:
> 
> > Have you tried the density function:
> >
> > > a <- read.table('/users/jim/downloads/LG_freq.txt',header = TRUE)
> > > str(a)
> > 'data.frame':   669 obs. of  2 variables:
> >  $ Position : Factor w/ 669 levels "chr1_103381212",..: 308 463 458 160
> > 393 457 165 464 3 467 ...
> >  $ frequency: num  75 62.5 50 48.9 47.1 ...
> > > plot(density(a$frequency))
> > >
> >
> >
> >
> > Jim Holtman
> > Data Munger Guru
> >
> > What is the problem that you are trying to solve?
> > Tell me what you want to do, not how you want to do it.
> >
> >
> > On Tue, Jul 8, 2014 at 4:30 AM, Vivek Das  wrote:
> >
> >> Dear Users,
> >>
> >> I need some assistance in plotting some distribution enrichments, like I
> >> have files with some frequency values, now I want to plot plot the
> >> distribution of those frequencies for one sample and then on the same
> plot
> >> I want to plot the next samples where the frequency comes from another
> >> file. Can you tell me which command to use? I would like to see the
> >> distribution both in curve and histrogram format. Even if the frequency
> >> are
> >> not normally distributed I would like to see to what extent they are
> >> distributed and how much they are deviated from the normal distribution.
> >> However I would expect a Gaussian curve but due to the low frequency in
> >> LG_freq it would be not evident. Can you share some snippets for that?
> Am
> >> attaching the two files, can you please guide me how to do it, I tried
> >> with
> >> the plot function but I was unable to do, I read somewhere it was possible
> >> to do with plot function with type 'L' but am unable to do that. I would
> >> need some assistance in this. Thanks
> >>
> >>
> >>
> >> --
> >>
> >> Das
> >>
> >> __
> >> 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.
> >>
> >>
> >
> 
>   [[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] [R-es] Consulta paquetización con versión R 3.1.0

2014-07-08 Thread Duncan Murdoch
On 08/07/2014, 12:56 AM, Eva Prieto Castro wrote:
> Duncan,
> 
> Yes, it has exactly that line.
> 
> I know it does not exists because of this:
> 
>> library("ChrL")
>> .ChrL.env
> Error: objeto '.ChrL.env' no encontrado

That says that you did not export it.  It is only visible from code
within the package.

Duncan Murdoch

> 
> 
> 
> However, it should be as follows:
> 
>> library("ChrL")
>> .ChrL.env
> 
> 
> 
> I'm desperate; I have to solve this urgently and I don't find the solution.
> 
> Thanks again.
> 
> Eva
> 
> 
> 2014-07-08 1:56 GMT+02:00 Duncan Murdoch  >:
> 
> On 07/07/2014, 7:13 PM, Eva Prieto Castro wrote:
> > Duncan,
> >
> > The ChrL folder has the following components:
> >
> > * Description file
> > * Namespace file
> > * R folder, including 3 files: CheckGloCreated.r, ChrL.Start.r and
> > ChrL-internal.r
> >
> 
> And does ChrL-internal.r contain just one line as you said before, i.e.
> 
> .ChrL.env <- new.env()
> 
> ?
> 
> If so, how have you determined that .ChrL.env does not exist?  Names
> that start with a "." don't show up in ls() listings by default. You
> can't use exists() to test for .ChrL.env in either of the other files,
> because they are probably sourced before it is (depending on the
> collation order).  It won't exist when you run them, but it will exist
> in the package namespace when you load the package.
> 
> Duncan Murdoch
> 
> > Obs.: Sometimes I remove man folder and another I adjust the rd files.
> > In all cases the result is the same:.ChrL.env does not exist!.
> >
> > Description file:
> >
> > Package: ChrL
> > Type: Package
> > Title: What the package does (short line)
> > Version: 1.0
> > Date: 2014-07-08
> > Author: Eva Prieto Castro
> > Maintainer: Eva Prieto Castro  
> > >>
> > Description: Test Pkg
> > License: Unlimited
> >
> > Namespace file:
> > exportPattern("^[[:alpha:]]+")
> >
> > I also test with this namespace file:
> > export(ChrL.Start)
> >
> > Thank you very much, again.
> >
> > Eva
> >
> >
> > 2014-07-08 0:55 GMT+02:00 Duncan Murdoch  
> > >>:
> >
> > On 07/07/2014, 6:39 PM, Eva Prieto Castro wrote:
> > > Hi again, Duncan
> > >
> > > I think I must tell you all the details of the method I use, in
> > order to
> > > make possible you notice my error.
> >
> > Your error is in calling package.skeleton.  As I said before,
> you should
> > have done this once, when you first thought of creating the ChrL
> > package, and *you should never call it again* for that package.
> >
> > The normal workflow after the single call to that function is
> to edit
> > the files in the ChrL directory.  Don't call package.skeleton
> again.
> >
> > If you want to describe the problems you are having, you should be
> > describing the contents of the ChrL directory, not how they were
> > created.  That is normally irrelevant, except that in your
> case, I think
> > that is the source of the problem.
> >
> > Duncan Murdoch
> >
> > However, you must know that this
> > > method run on 3.0.1 version (not in 3.0.2 and not in 3.1.0; this
> > is the
> > > problem!).
> > >
> > > 1) This is my code in "D:/probando.r" :
> > >
> > >
> > > .ChrL.env <- new.env()
> > > .ChrL.env$lGlo <- list()
> > > .ChrL.env$bStarted <- FALSE
> > >
> > > CheckGloCreated <- function() {
> > >   if (.ChrL.env$bStarted == TRUE) {
> > > stop("Data structures were already initialized.",
> call.=FALSE)
> > >   }
> > > }
> > > ChrL.Start <- function() {
> > >   CheckGloCreated()
> > >   cat("Tested.\n")
> > > }
> > >
> > > 2) I open RGUI and run the following:
> > >
> > > setwd("D:/")
> > > source("probando.r", encoding="utf-8")
> > > package.skeleton(name="ChrL", path="D:/")
> > >
> > > 3) At this point, ChrL folder has been created in D:/, so I
> adjust
> > > Description and Namespace files. In R folder,
> ChrL-internal.r file
> > is as
> > > I indicate below...
> > >
> > >>>
> > >>>
> > >>> My Namespace:
> > >>>
> > >>> export(ChrL.Start)
> > >>>
> > >>>
> > >>> My ChrL-internal.R:
> > >>>
> > >>> .ChrL.env <- new.env()
> > >
> > > 3) I go to bin f

Re: [R] Fwd: Need some assistance in plotting distributions

2014-07-08 Thread Vivek Das
Dear Jim,

Thank you for replying to my query. Both the files contains tumor
mutational frequencies. The LG_freq contains the entire mutational
landscape and the HIPS2_freq contains mutational frequency of one clone. I
want to see how both the frequency curve are behaving in one plot. Is that
possible to see in one plot with different colors to distinguish the
frequency distribution of both files in one image where I can see both the
plots. I have tried density plot but could not figure out how to add the
next frequency distribution file to the same plot and see the difference in
both the plots in one image with different colors. Can this be done?

--

Vivek Das



On Tue, Jul 8, 2014 at 12:19 PM, jim holtman  wrote:

> Have you tried the density function:
>
> > a <- read.table('/users/jim/downloads/LG_freq.txt',header = TRUE)
> > str(a)
> 'data.frame':   669 obs. of  2 variables:
>  $ Position : Factor w/ 669 levels "chr1_103381212",..: 308 463 458 160
> 393 457 165 464 3 467 ...
>  $ frequency: num  75 62.5 50 48.9 47.1 ...
> > plot(density(a$frequency))
> >
>
>
>
> Jim Holtman
> Data Munger Guru
>
> What is the problem that you are trying to solve?
> Tell me what you want to do, not how you want to do it.
>
>
> On Tue, Jul 8, 2014 at 4:30 AM, Vivek Das  wrote:
>
>> Dear Users,
>>
>> I need some assistance in plotting some distribution enrichments, like I
>> have files with some frequency values, now I want to plot plot the
>> distribution of those frequencies for one sample and then on the same plot
>> I want to plot the next samples where the frequency comes from another
>> file. Can you tell me which command to use? I would like to see the
>> distribution both in curve and histrogram format. Even if the frequency
>> are
>> not normally distributed I would like to see to what extent they are
>> distributed and how much they are deviated from the normal distribution.
>> However I would expect a Gaussian curve but due to the low frequency in
>> LG_freq it would be not evident. Can you share some snippets for that? Am
>> attaching the two files, can you please guide me how to do it, I tried
>> with
>> the plot function but I was unable to do, I read somewhere it was possible
>> to do with plot function with type 'L' but am unable to do that. I would
>> need some assistance in this. Thanks
>>
>>
>>
>> --
>>
>> Das
>>
>> __
>> 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.
>>
>>
>

[[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] Fwd: Need some assistance in plotting distributions

2014-07-08 Thread jim holtman
Have you tried the density function:

> a <- read.table('/users/jim/downloads/LG_freq.txt',header = TRUE)
> str(a)
'data.frame':   669 obs. of  2 variables:
 $ Position : Factor w/ 669 levels "chr1_103381212",..: 308 463 458 160 393
457 165 464 3 467 ...
 $ frequency: num  75 62.5 50 48.9 47.1 ...
> plot(density(a$frequency))
>



Jim Holtman
Data Munger Guru

What is the problem that you are trying to solve?
Tell me what you want to do, not how you want to do it.


On Tue, Jul 8, 2014 at 4:30 AM, Vivek Das  wrote:

> Dear Users,
>
> I need some assistance in plotting some distribution enrichments, like I
> have files with some frequency values, now I want to plot plot the
> distribution of those frequencies for one sample and then on the same plot
> I want to plot the next samples where the frequency comes from another
> file. Can you tell me which command to use? I would like to see the
> distribution both in curve and histrogram format. Even if the frequency are
> not normally distributed I would like to see to what extent they are
> distributed and how much they are deviated from the normal distribution.
> However I would expect a Gaussian curve but due to the low frequency in
> LG_freq it would be not evident. Can you share some snippets for that? Am
> attaching the two files, can you please guide me how to do it, I tried with
> the plot function but I was unable to do, I read somewhere it was possible
> to do with plot function with type 'L' but am unable to do that. I would
> need some assistance in this. Thanks
>
>
>
> --
>
> Das
>
> __
> 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.
>
>

[[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] Fwd: Need some assistance in plotting distributions

2014-07-08 Thread Vivek Das
Dear Users,

I need some assistance in plotting some distribution enrichments, like I
have files with some frequency values, now I want to plot plot the
distribution of those frequencies for one sample and then on the same plot
I want to plot the next samples where the frequency comes from another
file. Can you tell me which command to use? I would like to see the
distribution both in curve and histrogram format. Even if the frequency are
not normally distributed I would like to see to what extent they are
distributed and how much they are deviated from the normal distribution.
However I would expect a Gaussian curve but due to the low frequency in
LG_freq it would be not evident. Can you share some snippets for that? Am
attaching the two files, can you please guide me how to do it, I tried with
the plot function but I was unable to do, I read somewhere it was possible
to do with plot function with type 'L' but am unable to do that. I would
need some assistance in this. Thanks



--

Das
Positionfrequency
chr19_11942254  75
chr3_195511403  62.5
chr3_195508084  50
chr12_76424940  48.94
chr2_97268035   47.06
chr3_195507251  45.45
chr13_19751134  44.83
chr3_195511412  42.86
chr1_10689608   41.77
chr3_195515338  41.18
chr11_57958767  40.05
chr6_43308106   38.97
chr15_74427183  38.79
chr14_104643970 38.01
chr22_33670601  37.89
chr3_140277621  37.69
chr11_106680777 37.61
chrX_57146798   37.5
chrX_47086421   34.68
chr3_195511369  33.33
chr4_108732632.29
chr12_53069243  30.22
chr3_195511431  30
chr4_108732428.79
chr21_46012181  28.57
chr1_201179704  27.27
chr14_23371268  25.54
chr12_11506533  25
chr12_11506591  25
chr17_15457041  25
chr17_15457087  25
chr21_46012182  25
chr3_195511364  23.08
chr17_39305773  22.92
chr3_195507049  22.22
chr17_25973584  22.22
chr22_37964392  21.21
chr3_53263444   21.05
chr11_116719841 21.05
chr3_195507144  20
chr5_60628560   20
chr5_94991794   20
chr12_131359191 20
chr16_44726220
chr17_39305774  20
chr17_39305769  19.64
chrX_44386604   19.05
chr13_48542810  18.18
chr21_46057625  17.81
chr2_61147615   17.65
chr12_7045912   17.56
chr17_39305760  17.54
chr17_39305761  16.95
chr1_17263165   16.67
chr5_146030285  16.67
chr6_31323226   16.67
chr11_63732216.67
chrX_48675859   16.67
chr7_75028240   16.28
chr7_75028241   16.28
chr19_54973990  16.28
chr2_119604507  15.38
chr2_119604516  15.38
chr7_535261115.38
chr17_26089997  15.38
chr17_39305785  15.09
chr1_94495000   14.29
chr3_195512302  14.29
chr8_24811065   14.29
chr13_45008854  14.29
chrX_150349560  13.78
chr3_195509180  13.64
chr3_184039775  13.41
chr1_68960347   13.33
chr14_73978819  13.33
chr16_2228973   13.33
chr19_39401543  13.33
chr20_61460326  13.33
chr22_41721847  13.33
chr12_31250875  12.9
chr12_7045906   12.83
chr1_152082400  12.5
chr5_176886214  12.5
chr6_52664095   12.5
chr11_71276876  12.5
chr12_7045918   12.5
chr12_112037063 12.5
chr17_3805  12.5
chr19_47249635  12.5
chr19_51919865  12.5
chr6_375154212.24
chr1_55167775   12.12
chr3_108829608  11.94
chr4_154506754  11.9
chr4_15690513   11.76
chr5_121515260  11.76
chr6_30711937   11.76
chr6_137365780  11.76
chr19_7927910   11.76
chr22_37964391  11.63
chr1_120479954  11.54
chrX_38145683   11.54
chr11_6411941   11.22
chr3_197880219  11.11
chr9_21367597   11.11
chr9_135947040  11.11
chr12_9083164   11.11
chr12_5904  11.11
chr14_102550787 11.11
chr15_29418469  11.11
chr19_53770754  11.11
chrX_152967477  11.11
chr3_122284773  11.02
chr7_43679191   10.94
chr19_23159168  10.81
chr4_226347910.71
chr22_39358173  10.71
chr1_896173 10.53
chr1_152681679  10.53
chr1_196794685  10.53
chr1_206858647  10.53
chr2_119604501  10.53
chr4_194023510.53
chr4_110772956  10.53
chr6_44218787   10.53
chr11_18424472  10.53
chr14_64586208  10.53
chr19_16940257  10.53
chr1_152681695  10.48
chr21_46057634  10.47
chr6_151219997  10.34
chr6_107955970  10.08
chr1_248224586  10
chr1_248224587  10
chr2_119604688  10
chr9_135947042  10
chr19_40374025  10
chr20_3208503   10
chrX_150840056  10
chr22_37964389  9.78
chr6_112397545  9.76
chr19_40374023  9.76
chr17_73749982  9.68
chr12_53069229  9.66
chr19_36278848  9.62
chr1_35416689.52
chr2_241375390  9.52
chr8_38273487   9.52
chr11_73516094  9.52
chr16_1032172   9.52
chr16_28619615  9.52
chr17_80039228  9.52
chr22_38051445  9.52
chr22_37964408  9.45
chr3_197880204  9.38
chr9_124538672  9.38
chr18_32470282  9.3
chr13_19753704  9.23
chr1_203186947  9.09
chr4_13629164   9.09
chr4_17841298   9.09
chr4_101401073  9.09
chr4_170037774  9.09
chr5_76332530   9.09
chr9_32986009   9.09
chr14_55615321  9.09
chr16_30991325  9.09
chr17_78968823  9.09
chr19_14272414  9.09
chr1_152187437  9
chr6_166743049  8.93
chr1_91182180   8.89
chr9_130489354  8.82
chr17_47036073  8.82
chr17_6606350   8.75
chr8_133175742  8.74
chr4_57248712   8.7
chr6_34385300   8.7
chr7_22590028.7
chr8_145621579  8.7
chr9_131812242  8.7
chr10_50227779  8.7
chr10_118031512 8.7
chr10_135081469 8.7

Re: [R] A custom legend for three data frames in one plot

2014-07-08 Thread Artur Rataj
I have yet one problem, though -- with making the shapes solid.

Neither "solid circle" nor "filled circle" works:

points(sandwich3,cex=sandwich3$p*3,ph=19,col="gray")
points(sandwich3,cex=sandwich3$p*3,ph=21,col="gray",bg="gray")

​although "solid circle" works in the legend.

Cheers,
Artur

​

[[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] A custom legend for three data frames in one plot

2014-07-08 Thread Artur Rataj
Thanks Jim. It works almost exactly like I wanted, I only had to make shape
size variable:

points(sandwich1,cex=sandwich1$p)

Best regards,
Artur

[[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] Plot does not show in R

2014-07-08 Thread gktahon
Works like a charm, thank you very much for your help!

 

Logo_LM-UGent

Guillaume Tahon (PhD Student)

Ghent University, Faculty of Sciences

Laboratory of Microbiology, K.L. Ledeganckstraat 35 B-9000 Gent

T +32 (0)9 264 5134

F +32 (0)9 264 5092

E-mail:   guillaume.ta...@ugent.be

Web: www.lm.ugent.be

 

Van: Alfonso de Uña [via R] [mailto:ml-node+s789695n4693646...@n4.nabble.com] 
Verzonden: maandag 7 juli 2014 19:39
Aan: gktahon
Onderwerp: Re: Plot does not show in R

 

Hi, 

Try this, It works for me. 

venn.plot<-venn.diagram( 
  x = list( 
KP2 = c(2, 62, 22, 33, 11, 36, 26, 27, 28, 64, 5, 66, 10, 18, 68, 61, 6, 
29, 19, 65, 30, 35, 32, 20, 69, 8, 31, 13, 21, 7), 
KP15 = c(2, 22, 39, 1, 14, 65, 67, 68, 1, 12, 23, 37, 4, 24, 25, 64, 52, 
 34, 9, 15, 13, 8, 16, 63, 3, 17), 
KP43 = c(39, 2, 49, 43, 51, 38, 56, 58, 60, 44, 54, 40, 50, 45, 57, 59, 
 46, 41, 47, 48, 42, 55, 53) 
  ), 
  filename = NULL , 
  col = "transparent", 
  fill = c("red", "blue", "green"), 
  alpha = 0.5, 
  label.col = c("darkred", "white", "darkblue", "white", "white", "white", 
"darkgreen"), 
  cex = 2.5, 
  fontfamily = "serif", 
  fontface = "bold", 
  cat.default.pos = "text", 
  cat.col = c("darkred", "darkblue", "darkgreen"), 
  cat.cex = 2.5, 
  cat.fontfamily = "serif", 
  cat.dist = c(0.3, 0.4, 0.27), 
  cat.pos = 0 
) 
grid.draw(venn.plot); 


2014-07-07 17:42 GMT+02:00 gktahon <[hidden email]>: 


> I'm trying to get my figure to open with R, but it does not come up. 
> Here is my standard code: 
> 
> venn.diagram( 
> x = list( 
> KP2 = c(2, 62, 22, 33, 11, 36, 26, 27, 28, 64, 5, 66, 10, 
> 18, 68, 61, 6, 
> 29, 19, 65, 30, 35, 32, 20, 69, 8, 31, 13, 21, 7), 
> KP15 = c(2, 22, 39, 1, 14, 65, 67, 68, 1, 12, 23, 37, 4, 
> 24, 25, 64, 52, 
> 34, 9, 15, 13, 8, 16, 63, 3, 17), 
> KP43 = c(39, 2, 49, 43, 51, 38, 56, 58, 60, 44, 54, 40, 
> 50, 45, 57, 59, 
> 46, 41, 47, 48, 42, 55, 53) 
> ), 
> filename = "location\\nifH_AA_alles.jpg" , 
> col = "transparent", 
> fill = c("red", "blue", "green"), 
> alpha = 0.5, 
> label.col = c("darkred", "white", "darkblue", "white", "white", 
> "white", 
> "darkgreen"), 
> cex = 2.5, 
> fontfamily = "serif", 
> fontface = "bold", 
> cat.default.pos = "text", 
> cat.col = c("darkred", "darkblue", "darkgreen"), 
> cat.cex = 2.5, 
> cat.fontfamily = "serif", 
> cat.dist = c(0.3, 0.4, 0.27), 
> cat.pos = 0 
> ); 
> 
> This code saves the file to the desired location. However, I want the plot 
> to open in the R interface, so I changed that line of the code to 
> "filename=NULL". When I run the script afterwards, the plot does not open, 
> instead, I get the following outputline: 
> 
> (polygon[GRID.polygon.1], polygon[GRID.polygon.2], polygon[GRID.polygon.3], 
> polygon[GRID.polygon.4], polygon[GRID.polygon.5], polygon[GRID.polygon.6], 
> text[GRID.text.7], text[GRID.text.8], text[GRID.text.9], 
> text[GRID.text.10], 
> text[GRID.text.11], text[GRID.text.12], text[GRID.text.13], 
> text[GRID.text.14]) 
> 
> 
> Could anyone help me adapt the code so I get the plot opened in R? 
> 
> Many thanks in advance, 
> Guillaume 
> 
> 
> 
> -- 
> View this message in context: 
> http://r.789695.n4.nabble.com/Plot-does-not-show-in-R-tp4693637.html
> Sent from the R help mailing list archive at Nabble.com. 
> 
> __ 
> [hidden email] 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. 
> 



-- 
Un saludo 
Alfonso de Uña 
  www.farmerdev.com 

[[alternative HTML version deleted]] 


__ 
[hidden email] 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. 



  _  

If you reply to this email, your message will be added to the discussion below:

http://r.789695.n4.nabble.com/Plot-does-not-show-in-R-tp4693637p4693646.html 

To unsubscribe from Plot does not show in R, click here 

 .