Re: [R] Matching rows in a Data set? I'm Stuck!!

2010-03-03 Thread Albart

Hi,
 are your dataframes really called file1 and file2? Then, it will be
something like this:
 test 

Links:
--
[1]
http://n4.nabble.com/Matching-rows-in-a-Data-set-I-m-Stuck-tp1576432p1576523.html
[2]
 (link removed) =

-- 
View this message in context: 
http://n4.nabble.com/Matching-rows-in-a-Data-set-I-m-Stuck-tp1576432p1576573.html
Sent from the R help mailing list archive at Nabble.com.

[[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] Bulk editing of mySQL tables

2010-03-24 Thread Albart

Hello Daniel,

although I am not completely sure what you mean with 'batch changes to
data'. Assuming that you want to modify the data in your tables, I would
first try to do it in MySQL without exporting it to R and the importing it
back. If it is to difficult to do in MySQL, for example a complex
calculation, then I would get it into R, change it and place it back in the
database. In that case you would need to update your tables and not simply
use dbWriteTable.

Albart
-- 
View this message in context: 
http://n4.nabble.com/Bulk-editing-of-mySQL-tables-tp1680417p1680776.html
Sent from the R help mailing list archive at Nabble.com.

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


[R] Lattice: relation = 'free' in scales

2010-05-25 Thread Albart

Hello list,

I am making graphics for an article which I want to publish. The article is
about several methods (to calculate breeding values of individuals) applied
in several genetic scenarios (scen1 in the example) and using data from two
sources (scen 2 in my example). I want to specify the ylim of my plot and
have relation = 'free' for the yaxis but I would to avoid plotting the axis
for each subplot. I include an example to clarify my problem.

require(lattice)
nmethods <- 3
nscen1 <- 3
nscen2 <- 2
gens <- 1:10
tab <- expand.grid(method = 1:nmethods,
   scen1 = 1:nscen1,
   scen2 = 1:nscen2,
   gen = gens,
   rep = 1:3)
tab$value <- rnorm(nrow(tab),mean = with(tab,method*1000 + scen1*10 +
scen2*10 + gen*100),sd = 100)

tab$color <- factor(tab$scen2)
levels(tab$color) <- rainbow(length(levels(tab$color)))
tab$pch <- tab$color
levels(tab$pch) <- seq(21,21 + length(levels(tab$pch)))
tab$pch <- as.numeric(as.character(tab$pch))
tab$color <- as.character(tab$color)
  
ylim <- with(tab,tapply(value,method,range))
ylim <- ylim[rep(seq(1,length(ylim)),each = length(unique(tab$scen1)))]
tab$method <- factor(tab$method)
tab$scen1 <- factor(tab$scen1)
pplot <- with(tab,xyplot(value~gen|scen1*method,groups = scen2,as.table =
TRUE,
 color = color,pch = pch,
 scales = list(alternating = FALSE,y = list(relation
= 'free',limits = ylim)),
 panel = function(x,y,groups,...,subscripts){
  
tapply(1:length(y),list(x,groups[subscripts]),function(ii){
 color <- color[subscripts[ii]]
 pch <- pch[subscripts[ii]]
 panel.xyplot(mean(x[ii]),mean(y[ii]),fill =
color,col = color,pch = pch,cex= 0.5)
   })},
   key = list(columns = 2,
 space = "top",text =
list(unique(as.character(scen2)),col = unique(color)),
 points = list(pch = unique(pch),fill =
unique(color),col = unique(color)

As you can see, I use scales = list(y = list(relation = 'free', limit =
ylim)) because the range differs between the methods and otherwise I loose
all resolution. I like the result except that the yaxis is now displayed for
each plot and not only at the left side of the plot. Since I want the same
plotting range for each row of the plot, this represents an unnecessary use
of space and I would like to remove these axis from my plot, but I am not
able to do so. I would appreciate any help.

Thanks in advance,

Albart Coster
-- 
View this message in context: 
http://r.789695.n4.nabble.com/Lattice-relation-free-in-scales-tp2229644p2229644.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] Lattice: relation = 'free' in scales

2010-05-25 Thread Albart

Dear Peter,

thank you for your help. This helped.

Albart
-- 
View this message in context: 
http://r.789695.n4.nabble.com/Lattice-relation-free-in-scales-tp2229644p2230511.html
Sent from the R help mailing list archive at Nabble.com.

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


[R] Mathematical annotation axis in lattice

2009-07-07 Thread Coster, Albart
Dear list,

making mathematical expressions in plots is not difficult: expression(phi[1]) 
for example. At this moment I am stuck in creating a vector of expressions:

pos <- 1:10
lab <- letters[pos]

Now, I would like to create a vector of expressions which I could use for 
labeling the x-axis of a lattice plot. 

ll <- as.expression(paste(pos," phi[",lab,"]",sep = "")

xyplot(1:10~11:10,scales = list(x = list(labels = ll,at = 1:10)))

does not work. I read about the function substitute, but that did not solve it.

Could you recommend me how I should do this? 

Thanks in advance,

Albart Coster

Wageningen Universiteit
Netherlands

__
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] Thanks: Mathematical annotation axis in lattice

2009-07-08 Thread Coster, Albart

Hello,

thanks for the two replies. The following code worked as expected:

pos <- 1:10
lab <- letters[pos]

ll <- parse(text = paste(pos,"*phi[",lab,"]",sep = ""))

xyplot(1:10~1:10,scales = list(x = list(labels = ll,at = 1:10)))

Best regards,

Albart





-----Original Message-
From: Coster, Albart
Sent: Tue 7/7/2009 1:27 PM
To: r-help-requ...@r-project.org
Subject: Mathematical annotation axis in lattice
 
Dear list,

making mathematical expressions in plots is not difficult: expression(phi[1]) 
for example. At this moment I am stuck in creating a vector of expressions:

pos <- 1:10
lab <- letters[pos]

Now, I would like to create a vector of expressions which I could use for 
labeling the x-axis of a lattice plot. 

ll <- 

as.expression(paste(pos," phi[",lab,"]",sep = "")

xyplot(1:10~11:10,scales = list(x = list(labels = ll,at = 1:10)))

does not work. I read about the function substitute, but that did not solve it.

Could you recommend me how I should do this? 

Thanks in advance,

Albart Coster

Wageningen Universiteit
Netherlands

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