Re: [R] Problem Creating Partial Dependence Plot

2014-05-28 Thread Jane Shevtsov
Hi Jean, I did use a formula and a data frame in creating the rpart model, and the variable names are quite simple. And rpart is definitely supported. Best, Jane On Tue, May 27, 2014 at 5:44 AM, Adams, Jean jvad...@usgs.gov wrote: Jane, Page 9 of the reference manual,

[R] LInes with types

2014-05-28 Thread ioanna ioannou
Hello all, I want to plot the legend for the following two lines: I have two lines: X1-c(0,1,2,3,4) Y1-c(0,1,2,3,4) Y2-c(5,6,7,8,9) Y3-(32,33,34,35,36) plot(X1,Y3,pch=20) lines(X1,Y1,lty=1,type='o') lines(X1,Y2,lty=1,type='b') lines(X1,Y3,lty=2) Any ideas how?

Re: [R] LInes with types

2014-05-28 Thread Jim Lemon
On Wed, 28 May 2014 01:20:33 AM ioanna ioannou wrote: X1-c(0,1,2,3,4) Y1-c(0,1,2,3,4) Y2-c(5,6,7,8,9) Y3-(32,33,34,35,36) plot(X1,Y3,pch=20) lines(X1,Y1,lty=1,type='o') lines(X1,Y2,lty=1,type='b') lines(X1,Y3,lty=2) Hi Ioanna, You actually have three lines,

Re: [R] I Need Help with AMMI

2014-05-28 Thread arun
HI, data6$Gen=paste(G,data6$Gen,sep=) #Error in paste(G, data6$Gen, sep = ) : object 'data6' not found Please check this link: http://stackoverflow.com/questions/7027288/error-could-not-find-function-in-r A.K. R-Community, I am new to r. I have used SAS all my life. SO, here I am trying to

Re: [R] Plot regression results with various predictors.

2014-05-28 Thread PIKAL Petr
Hi What is plm? What is plot=(POLS), how do you expect this to be working? Many modelling methods have some kind of plotting functions. Does plm, regardless what it is, have some? Regards Petr -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-bounces@r-

[R] mle together with pnorm

2014-05-28 Thread Alexander Ketonen
Hi, The problem I have is that the standard errors for the estimates doesn't make any sense. Here is the background: The values in vector a are seen as the true values and I want to estimate them using mle. I make 100 disturbed vectors from a by adding noise, N(0,sigma^2). For every disturbed

Re: [R] Zoo: How to match secondary Y-axis ticks to primary ones

2014-05-28 Thread Bastian Pöschl
Thank you for the quick reply, your advice wasn't exactly what I was looking for. The plot 1 of the example was ment to show my problem: the secondary axis has it's first tick at the intersection with the x-axis whereas the primary y-axis shows a nice little offset. Using your advice i copied

[R] Legend having lines with different types

2014-05-28 Thread IOANNA
Hello all, I want to plot the legend for the following two lines: I have two lines: X1-c(0,1,2,3,4) Y1-c(0,1,2,3,4) Y2-c(5,6,7,8,9) Y3-(32,33,34,35,36) plot(X1,Y3,pch=20) lines(X1,Y1,lty=1,type='o') lines(X1,Y2,lty=1,type='b') lines(X1,Y3,lty=2) Any ideas how?

Re: [R] row mean

2014-05-28 Thread arun
Hi Eliza, No problem. You can also do: lst1 - vector(list,12) for(i in seq_along(lst1)) lst1[[i]] - colMeans(AAA[seq(i,nrow(AAA), by=12),]) A.K. On Wednesday, May 28, 2014 4:17 AM, eliza botto eliza_bo...@hotmail.com wrote: Thankyou very much dennis and arun, The codes worked as ever.

Re: [R] Plot regression results with various predictors.

2014-05-28 Thread phil
Sorry for not explaining it further. plm() is the regression command for panel data, i.e., similar to lm() for simple linear regressions. I run the plm() and get an output which I call here POLS. Next I simply use plot(POLS) which looks like

Re: [R] Plot regression results with various predictors.

2014-05-28 Thread PIKAL Petr
Hi -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-bounces@r- project.org] On Behalf Of phil Sent: Wednesday, May 28, 2014 10:41 AM To: r-help@r-project.org Subject: Re: [R] Plot regression results with various predictors. Sorry for not explaining it further.

Re: [R] Zoo: How to match secondary Y-axis ticks to primary ones

2014-05-28 Thread Gabor Grothendieck
On Wed, May 28, 2014 at 4:28 AM, Bastian Pöschl bstan0...@gmail.com wrote: Thank you for the quick reply, your advice wasn't exactly what I was looking for. The plot 1 of the example was ment to show my problem: the secondary axis has it's first tick at the intersection with the x-axis

Re: [R] Zoo: How to match secondary Y-axis ticks to primary ones

2014-05-28 Thread Bastian Pöschl
Thank you, this is the solution. I just replaced at4/20 by seq(0, max.yl, length.out=par(yaxp)[3]+1) so it should work with any scale. here is the final code that worked for me: ## R-Help 2014-05-28 asked by Bastian Pöschl solved by Gabor Grothendieck library(zoo) ## generate some smooth

Re: [R] Dataframe: Average cells of two rows and replace them with one row

2014-05-28 Thread Verena Weinbir
Hey guys, thank you very much for your help. Since I am a R-newbie I am still checking out how your code works and how I could adapt it to my dataframe, which has 124 rows and 41 columns/variables. The first column would be name, the last ones, 40 and 41, contain the cells I want to average for

Re: [R] Zoo: How to match secondary Y-axis ticks to primary ones

2014-05-28 Thread Bastian Pöschl
Sorry the last post has got a mistake, here is the corrected version: ## R-Help 2014-05-28 asked by Bastian Pöschl solved by Gabor Grothendieck library(zoo) ## generate some smooth timeseries x1 - c(38.2, 18.1, 83.2, 42.7, 22.8, 48.1, 81.8, 129.6, 52.0, 110.3) x2 - c(2.2, 0.8, 0.7, 1.6, 0.9,

Re: [R] Legend having lines with different types

2014-05-28 Thread S Ellison
I want to plot the legend for the following two lines: ... Any ideas how? Try ?legend S Ellison *** This email and any attachments are confidential. Any use...{{dropped:8}} __

Re: [R] Zoo: How to match secondary Y-axis ticks to primary ones

2014-05-28 Thread Bastian Pöschl
To get 0.5 Ticks the script was corrected another time ;) ## R-Help 2014-05-28 asked by Bastian Pöschl solved by Gabor Grothendieck library(zoo) ## generate some smooth timeseries x1 - c(38.2, 18.1, 83.2, 42.7, 22.8, 48.1, 81.8, 129.6, 52.0, 110.3) x2 - c(2.2, 0.8, 0.7, 1.6, 0.9, 0.9, 1.1, 2.8,

Re: [R] Legend having lines with different types

2014-05-28 Thread Adams, Jean
IOanna, If you are trying to distinguish between the type=b and the type=o in the legend, there does not appear to be a way to do this with the legend() function in base. I found a similar question posted on stackoverflow, and they suggested a work around for something similar (but not quite the

Re: [R] Dataframe: Average cells of two rows and replace them with one row

2014-05-28 Thread PIKAL Petr
Hi AFAIK you can not average values only in 2 columns leaving others intact. The exact code depends on what are in columns 2-39 in your data frame. If numbers, you can averege them as well. Something like dat.ag - aggregate(dat[,-1], list(dat$Name), mean, na.rm=TRUE) if your data frame is

Re: [R] How to unstack three columns into rows?

2014-05-28 Thread John Kane
Hi Petr I think cast() has been dropped from the most recent reshape2 and you need dcast(data, siteS~species) instead John Kane Kingston ON Canada -Original Message- From: petr.pi...@precheza.cz Sent: Tue, 27 May 2014 11:46:13 + To: kristi.glo...@hotmail.com,

[R] remove duplicated row according to NA condition

2014-05-28 Thread jeff6868
Hi everybody, I have a little problem in my R-code which seems be easy to solve, but I wasn't able to find the solution by myself for the moment. Here's an example of the form of my data: data - data.frame(col1=c(a,a,b,b),col2=c(1,1,2,2),col3=c(NA,ST001,ST002,NA)) I would like to remove

Re: [R] remove duplicated row according to NA condition

2014-05-28 Thread K. Elo
Hi! How about trying this: data[ data$col1!=data$col2 !is.na(data$col3), ] col1 col2 col3 2a1 ST001 3b2 ST002 HTH, Kimmo 28.05.2014 15:35, jeff6868 wrote: Hi everybody, I have a little problem in my R-code which seems be easy to solve, but I wasn't able to find the

Re: [R] remove duplicated row according to NA condition

2014-05-28 Thread William Dunlap
It would help if you said what you want done when none or all or some of the col1-col2 duplicates have NA's in the col3. E.g., what do you want the function to do for the following input? data2 - data.frame(col1=c(a,a,a,b,b,c,c,d,d,e), col2=c(1,1,1,2,2,3,3,4,4,5),

Re: [R] remove duplicated row according to NA condition

2014-05-28 Thread arun
Hi, May be this helps: data1 - data[with(data, order(col1, col2,1*is.na(col3))),]  data1[!duplicated(data1[,1:2]),] A.K. On Wednesday, May 28, 2014 11:28 AM, jeff6868 geoffrey_kl...@etu.u-bourgogne.fr wrote: Hi everybody, I have a little problem in my R-code which seems be easy to solve, but

Re: [R] Second axis on bottom of graph

2014-05-28 Thread Hurr
Thank you Jeff for your good orientation. You are an educator. I looked at the documentation for more than an hour. Yes, there is a big learning curve. My R-coding friend doesn't know it either. Here is runnable code for a graph I would like to redo in the better code. The staxlab function was

Re: [R] Second axis on bottom of graph

2014-05-28 Thread Frede Aakmann Tøgersen
Hi Hurr I'm getting curious! You have now spent several weeks on this plot. One reason to do this if the journal request it. Is that the case? Or is it your own hard minded way to have your plot made the way you like. In my mind a very good plot support ones data. Is that what you want? Does

[R] tk2listbox

2014-05-28 Thread Fowler, Mark
Hello, I'm migrating an old S application to R, and having trouble passing tk2listbox selections to a function. Could not find a listbox example with tcltk2, just tcltk. The snippet below shows a few of the lines creating the gui, including a tk2entry box that works fine for passing content,

[R] Creating a new column with the number of the observation

2014-05-28 Thread Marcos Santos
I have a data frame like this: Category Observed_value A 100 A 130 A 140 B 90 C 80 D 120 D 130 I need to create an index column that show the number of the observation for each category. I have three observations in the category A, one in category B, one in category C and two in

[R] partykit ctree: minbucket and case weights

2014-05-28 Thread Amber Dawn Nolder
Hello, I am an R novice, and I am using the partykit package to create regression trees. I used the following to generate the trees: ctree(y~x1+x2+x3+x4,data=my_data,control=ctree_control(testtype = Bonferroni, mincriterion = 0.90, minsplit = 12, minbucket = 4, majority = TRUE)

Re: [R] Creating a new column with the number of the observation

2014-05-28 Thread Andrija Djurovic
Hi. Here is one approach: x - rep(c(A, B, C), c(3,1,2)) DF - data.frame(x, stringsAsFactors=FALSE) cbind(DF, new_c=c(lapply(rle(DF$x)[[1]], function(x) 1:x), recursive=T)) Andrija On Wed, May 28, 2014 at 10:46 PM, Marcos Santos mmsantos...@gmail.comwrote: I have a data frame like this:

Re: [R] Creating a new column with the number of the observation

2014-05-28 Thread Andrija Djurovic
Here is another approach: x - rep(c(A, B, C), c(3,1,2)) DF1 - data.frame(x) cbind(DF1, new_c=ave(as.numeric(DF1$x), DF1$x, FUN=function(x) 1:length(x))) Note the difference between DF (in previous solution) and DF1 str(DF) str(DF1) Andrija On Thu, May 29, 2014 at 12:03 AM, Andrija Djurovic

Re: [R] Creating a new column with the number of the observation

2014-05-28 Thread Marcos Santos
Absolutely fantastic! Thank you for the TWO approachs. 2014-05-28 19:13 GMT-03:00 Andrija Djurovic djandr...@gmail.com: Here is another approach: x - rep(c(A, B, C), c(3,1,2)) DF1 - data.frame(x) cbind(DF1, new_c=ave(as.numeric(DF1$x), DF1$x, FUN=function(x) 1:length(x))) Note the

Re: [R] Second axis on bottom of graph

2014-05-28 Thread Hurr
Thank you Frede Aakmann Tøgersen-2 for your criticism. Yes the data is only similar to the data it is being made for. Our Lab been looking for years for a good way to make our graphs without buying expensive software. We have used mostly MS Excel, but the two axes are difficult. Good graphing

[R] how to access an executing environment?

2014-05-28 Thread Spencer Graves
Hello: I'm writing code to modify a function, and I want to know how to access the executing environment of the function. The example below extracts the body of a function and executes a single line but can't find x1 in the function's executing environment. How would you suggest

Re: [R] Creating a new column with the number of the observation

2014-05-28 Thread arun
Hi, If it ordered by the variable x, you could also try:  within(DF1, new_c-sequence(table(x))) A.K. On Wednesday, May 28, 2014 6:14 PM, Andrija Djurovic djandr...@gmail.com wrote: Here is another approach: x - rep(c(A, B, C), c(3,1,2)) DF1 - data.frame(x) cbind(DF1,

Re: [R] Creating a new column with the number of the observation

2014-05-28 Thread Marcos Santos
Perfect! Thank you a lot! 2014-05-28 21:57 GMT-03:00 arun smartpink...@yahoo.com: Hi, If it ordered by the variable x, you could also try: within(DF1, new_c-sequence(table(x))) A.K. On Wednesday, May 28, 2014 6:14 PM, Andrija Djurovic djandr...@gmail.com wrote: Here is another

[R] Confusing behavior when using gsub to insert unicode character (minimal working example provided)

2014-05-28 Thread Thomas Stewart
Can anyone help me understand the following behavior? I want to replace the letter 'X' in ​the string ​ 'text X' with '≥' (\u226 ​5 ). The output from gsub is not what I expect. It gives: text ≥. Now, suppose I want to replace the character '≤' in ​ the string​ 'text ≤'

Re: [R] Confusing behavior when using gsub to insert unicode character (minimal working example provided)

2014-05-28 Thread David Winsemius
On May 28, 2014, at 7:25 PM, Thomas Stewart wrote: Can anyone help me understand the following behavior? I want to replace the letter 'X' in ​the string ​ 'text X' with '≥' (\u226 ​5 ). The output from gsub is not what I expect. It gives: text ≥. Now, suppose I want to replace the