[R] post hoc comparisons of the interaction of factors

2013-02-13 Thread Vasillis Papathanasiou
Hi everyone, I'm running the following analysis for two meadows and two periods. I need to get the post hoc comparisons for the combination of the two factors (meadowA*PeriodA, meadowA*PeriodB, meadowB*PeriodB, meadowB*PeriodA). I use the function glht glht(model, linfct=mcp(Meadow=Tukey) in

Re: [R] recovering from errors with lapply()

2013-02-13 Thread Milan Bouchet-Valat
Le mardi 12 février 2013 à 15:41 -0600, Andrew Barr a écrit : Hi all, I am searching for a way to recover results from lapply() when one or more values returns an error. I have a written a function that uses tryCatch() to recover from errors. Here is a very simple example of such a

[R] R CMD in batch mode/trycatch() keeps hold on resources

2013-02-13 Thread guillaume Le Ray
HI all, I am using R (version 2.13.1) in batch mode on a server and I use trycatch() to handle the exceptions. When the code run without any exceptions, everything goes fine, however as soon as trycatch handle an error, my code works fine but R keeps hold on the folder after quiting. Therefore

Re: [R] Is there a place to put executable R scripts in new packages?

2013-02-13 Thread Duncan Murdoch
On 13-02-12 11:09 PM, Asis Hallab wrote: Dear R users, writing an R package I wonder, if there is a place to put executable R scripts into. So that when the package is installed one can use the script from the command line. Say we have e new package called FunkyR and wanted to deliver with it

[R] Correlation with p value

2013-02-13 Thread Nico Met
Dear all, I have a data (bellow) and I want to make a correlation test with p-value structure(list(Name = structure(c(3L, 3L, 3L, 3L, 3L, 3L, 3L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 2L, 2L, 2L, 2L, 2L, 2L, 2L), .Label = c(CTJ, PKR, TTK), class = factor), score = c(86.4371428571428, 89.7028571428572,

Re: [R] Correlation with p value

2013-02-13 Thread Jorge I Velez
Nico, Check https://stat.ethz.ch/pipermail/r-help/2008-May/161725.html for some alternatives. You might have to change the structure of your data, though. HTH, Jorge.- On Wed, Feb 13, 2013 at 10:13 PM, Nico Met wrote: Dear all, I have a data (bellow) and I want to make a correlation test

Re: [R] plot rtf in landscape orintation

2013-02-13 Thread Adams, Jean
You can control the width and height of a plot in addPlot(), but you must use addPageBreak() to control the width and the height of the page. Here is a modification of the example provided in the help for rtf, ?RTF library(rtf) myplot - function() { par(mar=c(4, 4, 1, 1), cex=2) plot(rnorm(25),

[R] CARET: Any way to access other tuning parameters?

2013-02-13 Thread James Jong
The documentation for caret::train shows a list of parameters that one can tune for each method classification/regression method. For example, for the method randomForest one can tune mtry in the call to train. But the function call to train random forests in the original package has many other

Re: [R] Correlation with p value

2013-02-13 Thread David L Carlson
You can use package Hmisc. Assuming your data.frame is called dta: library(Hmisc) dta2 - do.call(cbind, split(dta[,2], dta$Name)) dta2 CTJ PKR TTK [1,] 83.99429 88.54571 86.43714 [2,] 86.43714 85.71714 89.70286 [3,] 84.59600 84.90200 87.72800 [4,] 84.74000 89.88286 89.99000

[R] spearman correlation and p-value as a matrix

2013-02-13 Thread Ozgul Inceoglu
I have two data matrices that I want to make the correlation between each column from data1 and each column from data 2 and also calculate the p-value Matrices dont have the same size and I tried such a script. bg - read.table (file.choose(), header=T, row.names) bg Otu00022 Otu00029

[R] match in dependence of 2 columns

2013-02-13 Thread Mat
Hello, i want to match a column of one data.frame to another, my problem is, that i only want to match the data, if 2 columns are equal. i have a example: data.frame1 cu.nr. name value A 1 Evo 100 B

Re: [R] recovering from errors with lapply()

2013-02-13 Thread Andrew Barr
Thanks very much Milan. Your answer makes perfect sense. Best, Andrew On Wed, Feb 13, 2013 at 3:51 AM, Milan Bouchet-Valat nalimi...@club.frwrote: Le mardi 12 février 2013 à 15:41 -0600, Andrew Barr a écrit : Hi all, I am searching for a way to recover results from lapply() when one

[R] MIMIC latent variable with PLS Path Modelling with R ?

2013-02-13 Thread Hervé Guyon
I want estimate MIMIC latent variable with R in a Monte Carlo simulation. The packages plspm and semPLS don't permit to introduce MIMIC variable but only reflexives or formatives variables. The only one program which permits to use MIMIC latent variable with PLSPM seems to be XLSTAT, which can

[R] densityplot(~x+y) for vectors of different lengths does what?

2013-02-13 Thread Michael Stob
densityplot(~x+y) does what I expect it to do if x and y have equal length. I know how to get what I want if x and y have different lengths. But what is this actually doing if x and y have different lengths?The relevant example is x=rnorm(10) y=rnorm(50,1) densityplot(~x+y)

Re: [R] Correlation with p value

2013-02-13 Thread arun
Hi, #data: dat1 mat1-matrix(dat1[,2],ncol=3,nrow=7) colnames(mat1)-unique(dat1[,1]) library(Hmisc) rcorr(mat1)$P  #     TTK   CTJ   PKR #TTK    NA 0.0151874 0.6277163 #CTJ 0.0151874    NA 0.5214368 #PKR 0.6277163 0.5214368    NA A.K. - Original Message - From:

Re: [R] date and matrices

2013-02-13 Thread arun
Hi Elisa, Try this: date1-format(seq.Date(as.Date(1991.1.1,format=%Y.%m.%d),as.Date(1996.12.31,format=%Y.%m.%d),by=day),%Y.%m.%d)  length(date1) #[1] 2192 mat1-matrix(c(.314,.314,.273,.273,.236,.236,.236,.236,.273,.314,.403,.314),ncol=1) res1-

Re: [R] date and matrices

2013-02-13 Thread arun
Hi, Just forgot about one thing: With more matrices with one column: One way would be to combine them as a single matrix: date1-format(seq.Date(as.Date(1991.1.1,format=%Y.%m.%d),as.Date(1996.12.31,format=%Y.%m.%d),by=day),%Y.%m.%d)

[R] R question

2013-02-13 Thread Pedro Carvalho
Hello, I have submitted a R question to stackoverflow and have not received an answer. Could anyone help me out? http://stackoverflow.com/questions/14825443/backtesting-accuracy-of-regression-model-through-rolling-window-regression-with Best regards, Pedro

[R] NA/NaN/Inf in foreign function call (arg 6) error from coxph function

2013-02-13 Thread Cindy Yao
Dear R-helpers: I am trying to fit a multivariate Cox proportional hazards model, modelling survival outcome as a function of treatment and receptor status. The data look like below: # structure of the data str(sample.data) List of 4 $ survobj : Surv [1:129, 1:2] 0.8925+ 1.8836+ 2.1191+

Re: [R] Correlation with p value

2013-02-13 Thread David L Carlson
Minor edit dta2 - unstack(dta, score~Name) is simpler. --- David C -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-bounces@r- project.org] On Behalf Of David L Carlson Sent: Wednesday, February 13, 2013 9:40 AM To: 'Jorge I Velez'; 'Nico Met' Cc: 'R

Re: [R] match in dependence of 2 columns

2013-02-13 Thread John Kane
?merge If I have not reversed the data sets this should work With data sets called dat1 and dat2 merge(dat1,dat2, all.y = TRUE) John Kane Kingston ON Canada -Original Message- From: matthias.we...@fnt.de Sent: Wed, 13 Feb 2013 06:39:57 -0800 (PST) To: r-help@r-project.org

[R] analogs of prompt(), promptData() for roxygen?

2013-02-13 Thread Michael Friendly
roxygen2::roxygenize() process an entire package and rd2roxygen can convert existing Rd documentation to roxygen format. But are there equivalents/analogs of prompt() or SoDA::promptAll() for one or more .R/.RData files that would create skeleton roxygen documentation of functions or data?

Re: [R] match in dependence of 2 columns

2013-02-13 Thread Rui Barradas
Hello, Try the following. data.frame1 - read.table(text = cu.nr. name value A 1 Evo 100 B 1 Mer 80 C 2 Ford50

[R] e1071::skewness and psych::skew return NaN

2013-02-13 Thread Stephen Politzer-Ahles
Hello everyone, Does anyone know what would cause the skewness() function (from e1071), as well as skew() from psych, to return a value of NaN? I have a vector of positively-skewed data (https://docs.google.com/file/d/0B6-m45Jvl3ZmYzlHRVRHRURzbVk/edit?usp=sharing) which these functions return a

Re: [R] Max value of each 2 rows in dataframe

2013-02-13 Thread zuzana zajkova
Hi, thank you for your response. I tried the A[-1,]-do.call(rbind,lapply(split(A[-1,],((1:nrow(A[-1,])-1)%/%2)+1),function(x){x[4]-max(x[4]);x})) but somehow my computer got stuck... I tried the other option using rollapply and that works pretty well, doing exactly what I wanted to get. This is

Re: [R] e1071::skewness and psych::skew return NaN

2013-02-13 Thread Stephen Politzer-Ahles
Hi everyone, Please disregard my last message, I found a 0 in the vector, which is what was causing problems with the log and reciprocal data. Best, Steve On Wed, Feb 13, 2013 at 10:55 AM, Stephen Politzer-Ahles politzerahl...@gmail.com wrote: Hello everyone, Does anyone know what would

Re: [R] CARET: Any way to access other tuning parameters?

2013-02-13 Thread David Winsemius
On Feb 13, 2013, at 6:58 AM, James Jong wrote: The documentation for caret::train shows a list of parameters that one can tune for each method classification/regression method. For example, for the method randomForest one can tune mtry in the call to train. But the function call to train

Re: [R] e1071::skewness and psych::skew return NaN

2013-02-13 Thread Rui Barradas
Hello, That value means that some values of your data are negative or zero. A simple inspection shows that any(dat 0) # FALSE any(dat == 0) # TRUE Solution: don't log your data Hope this helps, Rui Barradas Em 13-02-2013 16:55, Stephen Politzer-Ahles escreveu: Hello everyone, Does

Re: [R] e1071::skewness and psych::skew return NaN

2013-02-13 Thread Rui Barradas
Hello, Just remembered, you can see how many values are zero, and since it's only one value, remove it and log the rest. sum(dat == 0) # 1 d2 - dat[dat != 0] library(psych) skew(log(d2)) [1] 0.6089985 Hope this helps, Rui Barradas Em 13-02-2013 17:59, Rui Barradas escreveu: Hello,

Re: [R] NA/NaN/Inf in foreign function call (arg 6) error from coxph function

2013-02-13 Thread David Winsemius
On Feb 13, 2013, at 7:46 AM, Cindy Yao wrote: Dear R-helpers: I am trying to fit a multivariate Cox proportional hazards model, modelling survival outcome as a function of treatment and receptor status. The data look like below: # structure of the data str(sample.data) List of 4 $

[R] Kernel Density estimation at specific points

2013-02-13 Thread Robert Duval
Dear All, I was wondering whether someone has created a kernel density evaluator that estimates the density at given specified points. The regular density() function evaluates the kernel at equidistant points, but I am interested in doing such evaluation along a list of values existing in a

[R] How to install .tar.gz source package in Windows XP 32-bit operational system

2013-02-13 Thread Marino David
Dear all mailing listers, I failed in install source packages in Windows system. I have installed Rtools in order to install the source package based on the discussion available on the following link: http://r.789695.n4.nabble.com/Installing-a-Package-tar-gz-in-windows-td3411393.html. By the way,

Re: [R] date and matrices

2013-02-13 Thread arun
HI Elisa, You also mentioned about more than 100 matrices with 1 column each. Suppose, if the matrices are named from mat1:mat4 (In your case mat1:mat124) mat1-matrix(c(.314,.314,.273,.273,.236,.236,.236,.236,.273,.314,.403,.314),ncol=1)

Re: [R] date and matrices

2013-02-13 Thread arun
Dear Elisa, When you save it as matrix, if there is atleast one column with character class, others will be converted to that class.  It would be better to store it as data.frame  res2-lapply(seq_len(ncol(mat3)),function(i)

Re: [R] CARET: Any way to access other tuning parameters?

2013-02-13 Thread Max Kuhn
James, You really need to read the documentation. Almost every question that you have has been addressed in the existing material. For this one, there is a section on custom models here: http://caret.r-forge.r-project.org/training.html Max On Wed, Feb 13, 2013 at 9:58 AM, James Jong

[R] WriteXLS: 'object not found' error within function

2013-02-13 Thread Scott Robinson
Dear All, I am using WriteXLS to write tables with multiple sheets with the command: WriteXLS(tables, ExcelFileName = fileName, SheetNames = tableList, perl = perl, verbose = FALSE, Encoding = c(UTF-8, latin1), row.names = TRUE, col.names = TRUE, AdjWidth =

[R] context of runif()

2013-02-13 Thread Charles Determan Jr
Greetings, I am exploring some random forest analysis methods and have come upon one aspect I don't fully understand from any manual. The code of interest is as follows from the randomForest package: myiris=cbind(iris[1:4], matrix(runif(508*nrow(iris)),nrow(iris),508)) This would be following

Re: [R] CARET: Any way to access other tuning parameters?

2013-02-13 Thread James Jong
Thank you David and Max, @David - Thanks, I am already aware that I cannot *directly* pass arguments to train to specify parameters controlling the method, and that one has to pass those parameters via the tuneGrid argument to caret::train. My question is about the method parameters that are

Re: [R] CARET: Any way to access other tuning parameters?

2013-02-13 Thread Max Kuhn
@Max - Thanks a lot for your help. I have already been using that website as a reference, and it's incredibly helpful. I have also been experimenting with tuneGrid already. My question was specifically if tuneGrid (or caret in general) supports passing method parameters to the method functions

Re: [R] WriteXLS: 'object not found' error within function

2013-02-13 Thread Marc Schwartz
On Feb 13, 2013, at 12:07 PM, Scott Robinson scott.robin...@glasgow.ac.uk wrote: Dear All, I am using WriteXLS to write tables with multiple sheets with the command: WriteXLS(tables, ExcelFileName = fileName, SheetNames = tableList, perl = perl, verbose = FALSE, Encoding =

Re: [R] densityplot(~x+y) for vectors of different lengths does what?

2013-02-13 Thread ilai
Hmmm... is this a (unknown or even a) bug ? Not sure this is what OP was getting at and I haven't gone through the lattice docs to see if this is mentioned, but, with unequal sizes the extended formula is not producing what one (or at least I) might expect: require(latticeExtra) set.seed(4321) ;

Re: [R] seasonal sum and mean and combine multiple, different data frames in .csv

2013-02-13 Thread arun
Hi Irucka, No problem. I guess this could be done using: Sample data: Dailydo- structure(list(Date = structure(c(11231, 11232, 11233, 11234, 11235, 11236, 11207, 11208, 11209, 11179, 11180, 11181, 11151, 11152, 11123, 11093, 11064, 11065, 11035, 11036, 11008, 11009, 10979, 10980, 11347,

Re: [R] How to install .tar.gz source package in Windows XP 32-bit operational system

2013-02-13 Thread David Winsemius
On Feb 13, 2013, at 9:25 AM, Marino David wrote: Dear all mailing listers, I failed in install source packages in Windows system. I have installed Rtools in order to install the source package based on the discussion available on the following link:

Re: [R] context of runif()

2013-02-13 Thread Duncan Murdoch
On 13/02/2013 1:26 PM, Charles Determan Jr wrote: Greetings, I am exploring some random forest analysis methods and have come upon one aspect I don't fully understand from any manual. The code of interest is as follows from the randomForest package: myiris=cbind(iris[1:4],

Re: [R] How to install .tar.gz source package in Windows XP 32-bit operational system

2013-02-13 Thread David Winsemius
On Feb 13, 2013, at 12:09 PM, David Winsemius wrote: On Feb 13, 2013, at 9:25 AM, Marino David wrote: Dear all mailing listers, I failed in install source packages in Windows system. I have installed Rtools in order to install the source package based on the discussion available on

Re: [R] How to install .tar.gz source package in Windows XP 32-bit operational system

2013-02-13 Thread Ista Zahn
On Wed, Feb 13, 2013 at 3:09 PM, David Winsemius dwinsem...@comcast.net wrote: On Feb 13, 2013, at 9:25 AM, Marino David wrote: Dear all mailing listers, I failed in install source packages in Windows system. I have installed Rtools in order to install the source package based on the

Re: [R] R2OpenBUGS quesion

2013-02-13 Thread Paul J Ossenbruggen
I recently installed OpenBUGS322 and obtained the same error using the schools example. I suspect that I will run into difficulties with other examples. I want to download the older version but the BUGS website does not seem to have OpenBUGS321 available any longer. Are there patches for

Re: [R] R2OpenBUGS quesion

2013-02-13 Thread Dan Polhamus
There is an archive link at the bottom of the downloads page from which you can grab 321. Dan On Wed, Feb 13, 2013 at 3:53 PM, Paul J Ossenbruggen [via R] ml-node+s789695n4658464...@n4.nabble.com wrote: I recently installed OpenBUGS322 and obtained the same error using the schools example. I

Re: [R] Kernel Density estimation at specific points

2013-02-13 Thread Bert Gunter
Please learn to search! A google search on R density estimation brought up the akj() function in the quantreg package, which would seem to do what you requested. However, I didn't look very hard and there are probably still others in other packages. -- Bert On Wed, Feb 13, 2013 at 8:35 AM,

[R] An extended Hodgkin-Huxley model that doesn't want to work.

2013-02-13 Thread Jannetta Steyn
Hi All I have been struggling with this model for some time now and I just can't get it to work correctly. The messages I get when running the code is: DLSODA- Warning..Internal T (=R1) and H (=R2) are such that in the machine, T + H = T on the next step (H = step size). Solver will

[R] [lattice] display a projected map on a layerplot

2013-02-13 Thread Tom Roche
summary: I can display a lon-lat map on a lattice::layerplot, and I can display a Lambert conformal conic (LCC) map on a spam::image, but I can't display an LCC map on a lattice::layerplot. Example follows. What am I doing wrong? details: I've been using `lattice` (via `rasterVis`) successfully

Re: [R] improving/speeding up a very large, slow simulation

2013-02-13 Thread Benjamin Caldwell
Joshua, Thanks for the example, and the explanation. Nice article that you wrote - the figures alone deserve a deeper dive, I think. As side note, I found out about profiling on another post and did it - it appears that my ignorance about how slow dataframes can be was the main problem. After

[R] Online Beginner's Guide to R course with video/audio files

2013-02-13 Thread Highland Statistics Ltd
Following our successful book: 'A Beginner's Guide to R', we are please to announce an online R course based on this book. Video/audio files Discussion board Video footage of instructors Nearly every section of ‘A Beginner’s Guide to R’ is covered. Each chapter is presented as a powerpoint

[R] Need Help Plotting Line for multiple linear regression

2013-02-13 Thread Craig O'Connell
Hello, My name is Craig and I need help plotting a line for a multiple linear regression in R. Here is my sample data (filename: convis.txt) Output of convis.txt is (vis and density being predictors of either avoidance or entrance): vis den avoid entrance 1 10 1 0. 0. 2 10

Re: [R] sweave question

2013-02-13 Thread Nordlund, Dan (DSHS/RDA)
-Original Message- From: r-help-boun...@r-project.org [mailto:r-help-bounces@r- project.org] On Behalf Of Mark Leeds Sent: Wednesday, February 13, 2013 2:59 PM To: r-help@r-project.org Subject: [R] sweave question Hi Everyone: I was having trouble getting the plot size correct

[R] Plotting multiple xyplots in same page

2013-02-13 Thread Lisa Daniel
Dear Rhelp, I would like to have 6 xyplots in the same page.  Similar to (par(mfrow=c(3,3)) Found this example on the R archives. library(lattice) trellis.par.set(theme = col.whitebg()) xy - xyplot(decrease ~ treatment, OrchardSprays,   groups = rowpos, type = a,  

Re: [R] spearman correlation and p-value as a matrix

2013-02-13 Thread Jim Lemon
On 02/13/2013 08:48 PM, Ozgul Inceoglu wrote: I have two data matrices that I want to make the correlation between each column from data1 and each column from data 2 and also calculate the p-value Matrices dont have the same size and I tried such a script. bg- read.table (file.choose(),

Re: [R] Plotting multiple xyplots in same page

2013-02-13 Thread Lisa Daniel
Dear Rhelp, I was able to plot 6 figures in one page.  I do need help in reducing the space between the title and the plot and assigning A,B,C,D,E,F to each figure library(lattice) trellis.par.set(theme = col.whitebg()) xy - xyplot(decrease ~ treatment, OrchardSprays,         main=Some plot,

Re: [R] sweave question

2013-02-13 Thread Mark Leeds
thanks dan. I'll try the double slash on both sides when I get back later tonight. In the solution on the net, he only had the backslash on the end quotes ( well there was a backslash at the beginning but that's a real backslash needed for latex commands ). I'll let you know how it works out.

Re: [R] Error Message During ANOVA

2013-02-13 Thread Pascal Oettli
Hello, The first error message says: Error in model.frame.default(formula = r ~ tm, drop.unused.levels = TRUE) : variable lengths differ (found for 'tm') Please compare the size of 'r' and 'tm'. Regards, Pascal Le 14/02/2013 07:14, Craig O'Connell a écrit : Dear R-Help, I'm using an

Re: [R] improving/speeding up a very large, slow simulation

2013-02-13 Thread David Winsemius
On Feb 13, 2013, at 3:33 PM, Benjamin Caldwell wrote: Joshua, Thanks for the example, and the explanation. Nice article that you wrote - the figures alone deserve a deeper dive, I think. As side note, I found out about profiling on another post and did it - it appears that my ignorance

Re: [R] character strings with embedded commands: perl /gee ?

2013-02-13 Thread Greg Snow
Look at the gsubfn package, it has functionality to do this. Here is an example from the vignette: fn$cat(pi = $pi, exp = `exp(1)`\n) pi = 3.14159265358979, exp = 2.71828182845905 The formula syntax to function conversion in the package may help with the last part. On Fri, Feb 8, 2013 at

Re: [R] Plotting multiple xyplots in same page

2013-02-13 Thread Duncan Mackay
Hi Lisa You can use the page function of xyplot to do this xy - xyplot(decrease ~ treatment, OrchardSprays, groups = rowpos, type = a, page = function(n){ grid.text(LETTERS[j], y = 0.95, x = 0.01,

Re: [R] improving/speeding up a very large, slow simulation

2013-02-13 Thread Benjamin Caldwell
That makes sense David; thanks again everyone for your help. *Ben Caldwell* Graduate Fellow University of California, Berkeley 130 Mulford Hall #3114 Berkeley, CA 94720 Office 223 Mulford Hall (510)859-3358 On Wed, Feb 13, 2013 at 4:25 PM, David Winsemius dwinsem...@comcast.netwrote: On Feb

Re: [R] sweave question

2013-02-13 Thread Duncan Mackay
Hi Dan is correct The alternative is to use a chunk to create the plot eg reg3print, results=hide, echo=FALSE= pdf(reg_tree-fig3.pdf, width = wid, height = hei) plot(cal.tree,uniform=TRUE,compress=TRUE,margin=0.0) text(cal.tree, all=TRUE,fheight=1.0,fwidth=1.0) dev.off() @ an call the file in

Re: [R] sweave question

2013-02-13 Thread Daniel Nordlund
Mark, just to be clear, since R uses the backslash character as an escape character inside strings, then any backslash that you want to appear in your latex code must be escaped, i.e. it must be doubled. But any backslash character that is being used as an escape character should remain as a

Re: [R] Plotting multiple xyplots in same page

2013-02-13 Thread Duncan Mackay
Hi Lisa have a look at par.settings in ?xyplot trellis.par.get() shows the settings trellis.par.get()[[27]] $left $left$tck [1] 1 $left$pad1 [1] 1 $left$pad2 [1] 1 $top $top$tck [1] 1 $top$pad1 [1] 1 $top$pad2 [1] 1 $right $right$tck [1] 1 $right$pad1 [1] 1 $right$pad2 [1] 1

[R] FW: standard error very high in maximum liklihood fitting

2013-02-13 Thread Abu Naser
I thought it was going to the r-list. Date: Wed, 13 Feb 2013 11:33:13 -0500 From: bbol...@gmail.com To: likhonna...@hotmail.com Subject: Re: [R] standard error very high in maximum liklihood fitting I can't respond to e-mails off-list. Please follow up on r-help. cheers

[R] fill colour in grid

2013-02-13 Thread Roslina Zakaria
Dear all r-users,   I have this code below to draw two squares, small and big square.  I would like to colour the small square with red and the big square with blue for example.  I tried using polygon but fail.  Thank you so much for your help.     par(mar=c(4,4,2,1.2),oma=c(0,0,0,0),xaxs=i,

Re: [R] sweave question

2013-02-13 Thread Yihui Xie
Other people in this thread have explained the rule of double backslashes. I just want to add one more comment: That clever solution was in 2009 when knitr has not come out, and I have used this picture several times to show how much I dislike it:

Re: [R] fill colour in grid

2013-02-13 Thread Pascal Oettli
Hi, ?rect par(mar=c(4,4,2,1.2),oma=c(0,0,0,0),xaxs=i, yaxs=i) plot.new() plot.window(xlim= c(0,8), ylim=c(0,8),col=blue,lwd=3, bg=5) axis(1) axis(2) title(main=The Overall Title) title(xlab=An x-axis label) title(ylab=A y-axis label) box() rect(0,0,4,4,col='blue',border=NA)

Re: [R] Running a R file at a specific time each day

2013-02-13 Thread Greg Snow
If you are on windows then there is a task scheduler for windows. Generally the best solutions are to use the OS tools to schedule your task, chron or task scheduler. If you need a solution inside of R then you can use the tclTaskSchedule function in the tcltk2 package. On Mon, Feb 11, 2013 at

Re: [R] Data sets online for student use

2013-02-13 Thread Greg Snow
The thread starting with this post: https://stat.ethz.ch/pipermail/r-sig-teaching/2013q1/000534.html answers a similar question and many of the answers there should apply here as well. On Tue, Feb 12, 2013 at 11:51 AM, David Arnold dwarnol...@suddenlink.netwrote: All, If you have any good

Re: [R] Is there a place to put executable R scripts in new packages?

2013-02-13 Thread Greg Snow
See ?commandArgs for a way to access the arguments on the command line. With that you can write the FunkyCold.R script to grab the command line arguments and run the proper function (after loading your package). If you give more detail on what you want to accomplish we may be able to give more

Re: [R] Plotting multiple xyplots in same page

2013-02-13 Thread Pascal Oettli
Hello, Herewith is one approach: grid1 - rbind(OrchardSprays, OrchardSprays, OrchardSprays, OrchardSprays, OrchardSprays, OrchardSprays) grid1$category - rep(c('A','B','C','D','E','F'), each=nrow(OrchardSprays)) trellis.par.set(theme = col.whitebg()) xy - xyplot(decrease ~ treatment |

[R] list of matrices -- array

2013-02-13 Thread Murat Tasan
i'm somehow embarrassed to even ask this, but is there any built-in method for doing this: my_list - list() my_list[[1]] - matrix(1:20, ncol = 5) my_list[[2]] - matrix(20:1, ncol = 5) now, knowing that these matrices are identical in dimension, i'd like to unfold the list to a 2x4x5 (or some

Re: [R] list of matrices -- array

2013-02-13 Thread Murat Tasan
FYI - this is my current method, but somehow i just don't like it ;-) foo - array(NA, dim = c(4,5,length(my_list))) for(k in 1:length(my_list)) { foo[,,k] - my_list[[k]] } -m On Thu, Feb 14, 2013 at 1:03 AM, Murat Tasan mmu...@gmail.com wrote: i'm somehow embarrassed to even ask this, but is

Re: [R] list of matrices -- array

2013-02-13 Thread arun
Hi, May be this helps: library(plyr) res-aaply(laply(my_list, as.matrix),c(2,3),function(x) x) attr(res,dimnames)- NULL  identical(res,foo) #[1] TRUE A.K. - Original Message - From: Murat Tasan mmu...@gmail.com To: r-help@r-project.org Cc: Sent: Thursday, February 14, 2013 1:13 AM

Re: [R] spearman correlation and p-value as a matrix

2013-02-13 Thread arun
HI, #ag data was created bg- as.matrix(read.table(text= Otu00022 Otu00029 Otu00039 Otu00042 Otu00101 Otu00105 Otu00125 Otu00131 Otu00137 Otu00155 Otu00158 Otu00172 Otu00181 Otu00185 Otu00190 Otu00209 Otu00218 Gi20Jun11  0.001217    0 0.001217    0 0.00    0    0   

Re: [R] match in dependence of 2 columns

2013-02-13 Thread Mat
thank you, this code works: library(plyr) join(dat1,dat2,by=c(cu.nr.,name),type=right) but my dat2 frame has a lot of columns, which i don't want to match. How can i say, that only the column value should be match to dat1 ? Thank you. Mat -- View this message in context:

Re: [R] Plotting multiple xyplots in same page

2013-02-13 Thread Lisa Daniel
Dear Duncan, Thank you.  It helped a lot. I was able to get it correct though I couldn't get it working under simpleTheme() (for publication purpose). #this gave me the correct format. library(grid) library(lattice) xy -xyplot(decrease ~ treatment, OrchardSprays,     main= Some plot,    

Re: [R] spearman correlation and p-value as a matrix

2013-02-13 Thread Ozgul Inceoglu
Thank you all for the answers. I really need to learn a lot. Bu I also discover cor2m(x, y, trim = TRUE, alpha = 0.05) in ecodist package, which gives an output file with significant correlations. Özgül YjHI, #ag data was created bg- as.matrix(read.table(text= Otu00022 Otu00029 Otu00039

Re: [R] Plotting multiple xyplots in same page

2013-02-13 Thread Lisa Daniel
Dear Duncan and Pascal, Thank you for the response. Duncan: I was able to fix the space between title and figure.  I would also like to  have separate main titles for each row of figures in addition to the individual titles. xy -xyplot(decrease ~ treatment, OrchardSprays,     main= Some