[R] dotplot legend

2014-12-17 Thread rl
Subscribers, For this example: library(lattice) testmatrix<-matrix(c(1,2,3,4,3,6,12,24),nrow=4,ncol=2) testylabels<-c('w1','x1','y1','z1') dotplot(testmatrix, scales=list(y=list(labels=testylabels), xlab=NULL)) legend('bottomright', 'legend', col=c('blue', 'pink')) Error in strwidth(legend, unit

[R] dotplot axes labelling

2014-12-15 Thread rl
Subscribers, What is my mistake with the following example: library(lattice) testmatrix<-matrix(c(1,2,3,4,3,6,12,24),nrow=4,ncol=2) testylabels<-c('w1','x1','y1','z1') dotplot(testmatrix, scales=list(y=list(testylabels)), xlab=NULL) #testylabels not shown, instead 'D' 'C' 'B' 'A' Thanks in adva

[R] create vector objects by recurrence equation function

2014-10-20 Thread rl
Subscribers, A spreadsheet contains (what appears to a low aptitude mathematician!) a recurrence equation: cellb1=2cellc1=0.1 celld1=5 cella2=1/(k1*cellb1)cellb2=cellb1+cellc1+celld1 cellc2=cella2*cellb2 celld2=cellb2*k2 where k are constants. Could someone p

Re: [R] package installation failure virtualisation environment

2014-10-16 Thread rl
On 2014-10-15 15:36, William Dunlap wrote: Have you looked at recent entries in the system log files in /var/log, especially /var/log/kern.log? No such log file exist and other files in the directory do not make reference to R and any general errors (e.g. internet access). __

Re: [R] package installation failure virtualisation environment

2014-10-16 Thread rl
On 2014-10-15 09:13, Sven E. Templer wrote: did you check the connection in R via for example: head(readLines("http://cran.r-project.org/web/licenses/GPL-3";)) which should yield: [1] "GNU GENERAL PUBLIC LICENSE" [2] " Version 3, 29 June 2007" [3] "" [

Re: [R] package installation failure virtualisation environment

2014-10-15 Thread rl
On 2014-10-14 15:40, Sven E. Templer wrote: Prevent graphic menues with: options(menu.graphics = FALSE) Same response after a pause: 'Killed' or and define repositories: options(repos = c(CRAN = "http://cran.r-project.org";)) Same response after a pause: 'Killed' _

[R] package installation failure virtualisation environment

2014-10-14 Thread rl
Subscribers, A version of R is installed in a virtual machine, which has complete internet access via the host. The following error occurs when a package is selected: install.packages([packagename], dependencies=TRUE) --- Please select a CRAN mirror for use in this session --- Killed The err

[R] apply if else statement to vector

2014-10-02 Thread rl
Subscribers, What is the correct syntax to apply the 'if else' conditional statement to vector objects? Example: vectorx<-c(50,50,20,70) vectory<-c(50,50,20,20) vectorz<-function () { if (vectorx>vectory) vectorx else vectorx<-0 } vectorz() Warning message: In if (vec

Re: [R] apply block of if statements with menu function

2014-09-18 Thread rl
On 2014-09-16 12:35, PIKAL Petr wrote: So if result of menu is 0 (you did not choose anything) you can either stay with 0, then switch does not return anything or add 1 and let evaluate something meaningful specified in second and following positions of switch command. Thanks for your explana

Re: [R] apply block of if statements with menu function

2014-09-16 Thread rl
On 2014-09-16 10:50, PIKAL Petr wrote: switch(menu(c("List letters", "List LETTERS")) + 1, cat("Nothing done\n"), letters, LETTERS) why is the result changed if ' + 1,' removed? Because +1 belongs to switch not to menu. You can translate above to: The help pages ?switch, ?menu do no

Re: [R] apply block of if statements with menu function

2014-09-16 Thread rl
On 2014-09-15 14:22, David L Carlson wrote: I think switch() should work for you here, but it is not clear how much flexibility you are trying to have (different tests based on the first response; different tests based on first, then second response; different tests based on each successive respo

Re: [R] apply block of if statements with menu function

2014-09-15 Thread rl
On 2014-09-15 14:22, David L Carlson wrote: I think switch() should work for you here, but it is not clear how much flexibility you are trying to have (different tests based on the first response; different tests based on first, then second response; different tests based on each successive respo

[R] apply block of if statements with menu function

2014-09-15 Thread rl
Subscribers, apply block of if statements with menu function Subscribers, For a menu: menu(c('a','b','c','d')) How to create a function that will apply to specific menu choice objects? For example: object1<-function (menuifchoices) { menu1<-menu(c('a','b','c','d')) if (menu1==1)

Re: [R] sequential input script dataframe process functionality

2014-09-11 Thread rl
On 2014-09-10 10:45, PIKAL Petr wrote: On 2014-09-08 15:47, William Dunlap wrote: > d <- data.frame(Choices=c("One","Two","One","Three"), X=1:4) > i <- 1 # possible output of menu(unique(d$Choices)) > d[ d$Choices[i] == d$Choices, ] > # Choices X > #1 One 1 > #3 One 3 > > testd <- data

Re: [R] sequential input script dataframe process functionality

2014-09-09 Thread rl
On 2014-09-08 15:47, William Dunlap wrote: d <- data.frame(Choices=c("One","Two","One","Three"), X=1:4) i <- 1 # possible output of menu(unique(d$Choices)) d[ d$Choices[i] == d$Choices, ] # Choices X #1 One 1 #3 One 3 testd <- data.frame(Choices=c("One","Two","One","Three"), X=1:4) t

Re: [R] sequential input script dataframe process functionality

2014-09-08 Thread rl
On Mon, 8 Sep 2014 07:55:23 -0700 William Dunlap wrote: Again, feed the output of menu() directly into "[". Do not use switch(). Bill Dunlap The function was changed to: testdataextract1<-function (testdata) { selectionresult<-menu(c(unique(levels(testdata[,1]))),graphics=FALSE,title='Selec

Re: [R] sequential input script dataframe process functionality

2014-09-08 Thread rl
On Sat, 6 Sep 2014 08:21:19 -0700 William Dunlap wrote: > testdataextract1<-switch(menu(c(unique(levels(testdata[,1]))),graphics=FALSE,title='Select > something')) The switch function does not work the way you are expecting it to. Read help("switch") and read the introduction to R that comes

Re: [R] sequential input script dataframe process functionality

2014-09-06 Thread rl
On 2014-09-05 09:40, r...@openmailbox.org wrote: Subscribers, Could someone please indicate correct terminology and relevant manual sections to achieve the following conceptual workflow, to create a script to select sequentially parts of a dataframe: "Welcome to this R script program" Select l

[R] sequential input script dataframe process functionality

2014-09-05 Thread rl
Subscribers, Could someone please indicate correct terminology and relevant manual sections to achieve the following conceptual workflow, to create a script to select sequentially parts of a dataframe: "Welcome to this R script program" Select level number below of variable 'X' [1] [2] [3]