Re: [R] Adding legends on plots using Lattice package

2012-09-20 Thread Deepayan Sarkar
On Mon, Sep 17, 2012 at 2:34 PM, jpm miao wrote: > To dear Dr Sarkar and anyone that knows about Lattice package, > >I make 4 graphs by Lattice package. Each of the graphs has two time > series. All the series are plotted in plain lines by default, and I would > like one series to be in plain

[R] validate.lrm - confidence interval for boostrap-corrected AUC ?

2012-09-20 Thread Whee Sze Ong
Hi Does anyone know whether the rms package provides a confidence interval for the bootstrap-corrected Dxy or c-index? I have fitted a logistic model, and would like to obtain the 95% confidence interval of the bootstrap-corrected area under the ROC curve estimate. Thanks. [[alter

[R] invalid labels; length 2 should be 1 or 0

2012-09-20 Thread ya
hi list, I googled this invalid lables issue. It seems different people doing different analysis encountered this problem. So I guess this is not about the MICE package. However, in general, they have categorical variables, in my case, I double checked, the bulg_1, bulg_2, and bulg_3 are conti

[R] optim and "the function should not" advice

2012-09-20 Thread Gildas Mazo
Dear R users, I'm using optim to optimize a pretty complicated function. This function takes the parameter vector "theta" and within its body I use instructions like sigma<-theta[a:b]; computations with sigma... out<-c() for (i in 1:d){ a<-theta[(3*d+i):c] out[i]<-evaluation of an expressi

Re: [R] optim and "the function should not" advice

2012-09-20 Thread Prof Brian Ripley
On 20/09/2012 09:24, Gildas Mazo wrote: Dear R users, I'm using optim to optimize a pretty complicated function. This function takes the parameter vector "theta" and within its body I use instructions like sigma<-theta[a:b]; computations with sigma... out<-c() for (i in 1:d){ a<-theta[(3*d+i):

[R] R/C++ interfaces: crashes when using .c(), followed by correct results when R restarted

2012-09-20 Thread Franckx Laurent
Dear all I have written a function in C++ , equil_distC, that I am calling from an R script. In the last few days, R has repeatedly crashed when calling this function, or delivered obviously wrong outputs. However, when I restarted R after the crash, the results turned out to be OK most of t

Re: [R] R/C++ interfaces: crashes when using .c(), followed by correct results when R restarted

2012-09-20 Thread Prof Brian Ripley
First, the posting guide asks you to send questions about compiled code to the R-devel list. These are all classic symptoms of the use of uninitialized variables or writing out of bounds, but of which you can catch by using valgrind: see 'Writing R Extensions'. They are much harder to find on

[R] Solved!! ( Dummy Variable : Doubt )

2012-09-20 Thread Eva Prieto Castro
Hi, Finally I could resolve. I understood how you can use dummy variables in lm(). Thanks! Eva --- El jue, 20/9/12, Eva Prieto Castro escribió: De: Eva Prieto Castro Asunto: Re: Dummy Variable : Doubt Para: R-help@r-project.org Fecha: jueves, 20 de septiembre, 2012 11:27 Sorry, I could wri

[R] filtering out known instrumental error from time series

2012-09-20 Thread Arnaud Duranel
Hello all, I am working with high-frequency hydrological time series, from automatic loggers. These have a known instrumental error, determined from laboratory tests. Could anybody please advise on methods (an indeed R packages/functions) that I could use to remove part of this instrumental no

Re: [R] Dummy Variable : Doubt

2012-09-20 Thread Eva Prieto Castro
Sorry, I could write Dummy and not Gummy. Regards --- El jue, 20/9/12, Eva Prieto Castro escribió: De: Eva Prieto Castro Asunto: Gummy Variable : Doubt Para: R-help@r-project.org Fecha: jueves, 20 de septiembre, 2012 11:13 Hi,   I have a system in which I analyze 2 subjects and 1 vari

[R] Gummy Variable : Doubt

2012-09-20 Thread Eva Prieto Castro
Hi,   I have a system in which I analyze 2 subjects and 1 variable, so I have 2 models as follow:   y ~ x_1[, 1] + x_2[, 1] + x_1[, 2] + x_2[, 2]   Where   x_1[, i] = cos(2 * pi * t / T_i) x_2[, i] = sin(2 * pi * t / T_i)   i = 1, 2   Data have two columns: t and y.   As

[R] Problem with Newton_Raphson

2012-09-20 Thread Christopher Kelvin
Hello, I have being trying to estimate the parameters of the generalized exponential distribution. The random number generation for the GE distribution is x<-(-log(1-U^(1/p1))/b), where U stands for uniform dist. The data i have generated to estimate the parameters is right censored and the code

Re: [R] qplot: plotting precipitation data

2012-09-20 Thread Hadley Wickham
Hmmm, I'm not sure what the problem is, but I suspect it's related to the fact the xmin and xmax have different factors levels and there are some bugs in ggplot2 related to combining factors in some situations (it's basically impossible to always do it right). Explicitly ensuring the levels were t

[R] Sweave - if \Sexpr{} than \SweaveInput{"my.Rnw"}

2012-09-20 Thread Witold E Wolski
Depending on an R computation I would like to include an Sweave documents in the main Sweave document. How can I do it? So I was thinking to use Latex features : \newif\ifpaper \ifpaper \SweaveInput{"my1.Rnw"} \else \SweaveInput{"my2.Rnw"} \fi But how do I set paper to true or false give

Re: [R] Problem with Newton_Raphson

2012-09-20 Thread Berend Hasselman
On 20-09-2012, at 13:46, Christopher Kelvin wrote: > Hello, > I have being trying to estimate the parameters of the generalized exponential > distribution. The random number generation for the GE distribution is > x<-(-log(1-U^(1/p1))/b), where U stands for uniform dist. The data i have > gene

[R] multinomial MCMCglmm

2012-09-20 Thread Vaniscotte
Dear all, I would like to add mixed effects in a multinomial model and I am trying to use MCMCglmm for that. The main problem I face: my data set consits of a trapping data set, where the observation at eah trap (1 or 0 for each species) have been aggregated per traplines. Therefore we have

Re: [R] Wilcoxon Test and Mean Ratios

2012-09-20 Thread Ben Bolker
Mohamed Radhouane Aniba gmail.com> writes: > > > Thank you Thomas, > > So you think a t-test is more adequate to use in this case ? > > Rad No, because a t-test makes even stronger parametric assumptions. You were given more specific advice on stackoverflow http://stackoverflow.com/questi

Re: [R] Sweave - if \Sexpr{} than \SweaveInput{"my.Rnw"}

2012-09-20 Thread Duncan Murdoch
On 20/09/2012 8:47 AM, Witold E Wolski wrote: Depending on an R computation I would like to include an Sweave documents in the main Sweave document. How can I do it? So I was thinking to use Latex features : \newif\ifpaper \ifpaper \SweaveInput{"my1.Rnw"} \else \SweaveInput{"my2.Rnw"}

[R] Quantile regression with large number of fixed effects

2012-09-20 Thread C.Steinwender
Dear R users, I am trying to estimate a median regression with fixed effects. I have an unbalanced panel data set with 5,000 individuals and 10 years, resulting in a total of 20,000 observations. When I try to add individual (firmid) fixed effects to the quantile regression using the followin

[R] Variance Inflation Factor VIC() with a matrix

2012-09-20 Thread Martin H. Schmidt
Hi everyone, Running the vif() function from the car package like > reg2 <- lm(CARsPur~Delay_max10+LawChange+MarketTrend_20d+MultiTrade, data=data.frame(VarVecPur)) > vif(reg2) Delay_max10 LawChange MarketTrend_20d MultiTrade

Re: [R] validate.lrm - confidence interval for boostrap-corrected AUC ?

2012-09-20 Thread Frank Harrell
It does not offer that feature. That is an area of active research. If anyone knows of a paper that has solved this problem please let me know. Frank Whee Sze Ong wrote > Hi > > > > Does anyone know whether the rms package provides a confidence interval > for > the bootstrap-corrected Dxy or

[R] stats q: median regression and using ln(y+1)

2012-09-20 Thread knallgrau
Hi there, I hope you don't mind me asking a general stats rather than a R-specific question. I'm estimating a median regression model and would like to interpret my (mainly categorical) regression coefficients in terms of percentage changes in the dependent variable. There are about 10-15%(nat

Re: [R] Problem with Newton_Raphson

2012-09-20 Thread Berend Hasselman
On 20-09-2012, at 15:17, Christopher Kelvin wrote: > By your suggestion if i understand you, i have changed (p[1]) and (p[2]) and > have also corrected the error sum(t), but if i run it, the parameters > estimates are very large. > Can you please run it and help me out? The code is given below.

Re: [R] Problem with Newton_Raphson

2012-09-20 Thread Berend Hasselman
On 20-09-2012, at 16:06, Berend Hasselman wrote: > > On 20-09-2012, at 15:17, Christopher Kelvin wrote: > > . > A final remark on function z: > > - do not calculate things like n*sum(s) repeatedly: doing something like > A<-n*sum(s) and reusing A is more efficient. > - same thing for log(

Re: [R] R CMD check and browser 2.

2012-09-20 Thread R. Michael Weylandt
On Mon, Sep 17, 2012 at 3:49 PM, Christian Hoffmann wrote: > Hi, > > The browser opens, when the command > > * checking whether package 'cwhmisc' can be installed ... OK > > is executed. > >> sessionInfo() > R version 2.15.1 (2012-06-22) > Platform: x86_64-apple-darwin9.8.0/x86_64 (64-bit) > > loc

Re: [R] Problem with Newton_Raphson

2012-09-20 Thread Christopher Kelvin
By your suggestion if i understand you, i have changed (p[1]) and (p[2]) and have also corrected the error sum(t), but if i run it, the parameters estimates are very large. Can you please run it and help me out? The code is given below. p1<-0.6;b<-2 n=20;rr=5000 U<-runif(n,0,1) for (i in 1:rr){

[R] Applying glm coefficients (Beginner Question)

2012-09-20 Thread SirRon
Hello, I am working with a dataset with three variables and one binomial parameter. The glm function provides coefficients for these three variables, e.g. -1.5 | 27.2 | -2.9 If I'm not mistaken, $fitted.values gives me an estimate of how likely my parameter is to be true/1 . I would like to apply

[R] Line over Boxplot

2012-09-20 Thread gfishel
Very much a rookie at R, and have only recently started using it again so pardon the simple question. I am trying to produce a box plot from one data set and then overlay a line plot from another data set. The box plot data set is made up of 20 sets of 30 data points, or 600 total data points. The

[R] lattice dotplot reorder contiguous levels

2012-09-20 Thread maxbre
my reproducible example test<-structure(list(site = structure(c(1L, 1L, 1L, 1L, 1L, 1L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 3L, 3L, 3L, 3L, 3L, 3L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 5L), .Label = c("A", "B",

Re: [R] Problem with Newton_Raphson

2012-09-20 Thread Christopher Kelvin
Thank you very much for everything. Your suggestions were very helpful.  Chris - Original Message - From: Berend Hasselman To: Christopher Kelvin Cc: "r-help@r-project.org" Sent: Thursday, September 20, 2012 10:06 PM Subject: Re: [R] Problem with Newton_Raphson On 20-09-2012, at 15:

Re: [R] issue accessing help files

2012-09-20 Thread Basil Iannone
Hi Heramb, No "Help(anova)" does not work either. Thanks for the suggestions. I put the question out there in case anyone else was having similar problems. I think I will throw in the towel and install the latest version of R to see if that resolves the issue. Thanks On Thu, Sep 20, 2012 at 12:4

[R] puzzling script bug

2012-09-20 Thread Robert Douglas Kinley
Windows XP (SP3) , R 2.15.1 32bit Hi ... I have a script which fails and closes my R session. Unfortunately, it bombs out at a different point each time I run it. I'm guessing that it may be something to do with memory management, or perhaps it's to do with the various .C dll's the script

[R] fourier series for finding average values

2012-09-20 Thread eliza botto
Dear UseRs, i have a matrix of 365 rows and 444 columns. i drew each column of this matrix against the number of days in a year, which are obviously 365. now i have 444 curves and i want to Use Fourier analysis for the approximation of the average values. does anyone know how to do it? any help

Re: [R] effective way to return only the first argument of "which()"

2012-09-20 Thread Mike Spam
Thank you very much, especially Milan and Bert! I will do some speedtests and fit the function to my needs. I think the best way would be a modified function in C... But i am not familiar enough with C. Perhaps this would be a simple but useful extension. If someone has a solution, i would appreci

Re: [R] Variance Inflation Factor VIC() with a matrix

2012-09-20 Thread John Fox
Dear Martin, > -Original Message- > From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] > On Behalf Of Martin H. Schmidt > Sent: Thursday, September 20, 2012 8:52 AM > To: r-help@r-project.org > Subject: [R] Variance Inflation Factor VIC() with a matrix > > Hi everyon

Re: [R] Sweave - if \Sexpr{} than \SweaveInput{"my.Rnw"}

2012-09-20 Thread Yihui Xie
If you want to program Sweave documents, you can try the knitr package. This case will be something like: <<>>= paper <- TRUE # or change it to FALSE @ <>= @ i.e. you use the logical variable 'paper' to control which child document to include in the parent document. See http://yihui.name/knitr/

Re: [R] Applying glm coefficients (Beginner Question)

2012-09-20 Thread David Winsemius
On Sep 20, 2012, at 6:55 AM, SirRon wrote: > Hello, > I am working with a dataset with three variables and one binomial parameter. > The glm function provides coefficients for these three variables, e.g. > -1.5 | 27.2 | -2.9 > > If I'm not mistaken, $fitted.values gives me an estimate of how lik

[R] Fortune nomination

2012-09-20 Thread Bert Gunter
On Thu, Sep 20, 2012 at 9:01 AM, David Winsemius wrote: (In response to an OP's aplogy for an "awkwardly worded question"): > Awkwardly worded questions will get much better answers if they are > accompanied by some test data. Fortune nomination! Cheers, Bert > -- > David Winsemius, MD > Ala

Re: [R] (no subject)

2012-09-20 Thread Rui Barradas
Maybe it is longer, but it's also more general, it issues an error if the tables are not 1-dim. That's where most of the function's extra lines are. Otherwise it's the same as your first solution. The second one has the problem you've mentioned. Rui Barradas Em 20-09-2012 16:46, Stefan Th. Gri

Re: [R] (no subject)

2012-09-20 Thread Gabor Grothendieck
On Thu, Sep 20, 2012 at 10:57 AM, Stefan Th. Gries wrote: > >From my book on corpus linguistics with R: > > # (10) Imagine you have two vectors a and b such that > a<-c("d", "d", "j", "f", "e", "g", "f", "f", "i", "g") > b<-c("a", "g", "d", "f", "g", "a", "f", "a", "b", "g") > > # Of these vecto

Re: [R] issue accessing help files

2012-09-20 Thread R. Michael Weylandt
On Thu, Sep 20, 2012 at 4:20 PM, Basil Iannone wrote: > Hi Heramb, > > No "Help(anova)" does not work either. Thanks for the suggestions. I put > the question out there in case anyone else was having similar problems. I > think I will throw in the towel and install the latest version of R to see >

Re: [R] Wilcoxon Test and Mean Ratios

2012-09-20 Thread avinash barnwal
Hi, In Wilcoxon test , we look for medians rather than the means. Ratio of medians should be more coherent with P value. On Thu, Sep 20, 2012 at 6:30 PM, Ben Bolker wrote: > Mohamed Radhouane Aniba gmail.com> writes: > > > > > > > Thank you Thomas, > > > > So you think a t-test is more adequat

Re: [R] puzzling script bug

2012-09-20 Thread R. Michael Weylandt
On Thu, Sep 20, 2012 at 4:34 PM, Robert Douglas Kinley wrote: > Windows XP (SP3) , R 2.15.1 32bit > > Hi ... > > I have a script which fails and closes my R session. > > Unfortunately, it bombs out at a different point each time I run it. > > I'm guessing that it may be something to do with m

Re: [R] fourier series for finding average values

2012-09-20 Thread Jeff Newmiller
If you want help understanding the theory of what you want to do, that is of topic here. If you understand what you want to do, or just want to see what resources you can leverage in R, may I recommend the RSiteSearch function. I do think you should be wary of applying a tool you don't understan

[R] Plot to tiff, font size problem in multiple plot figures

2012-09-20 Thread Claudia Penaloza
I am creating graphs for a publication and would like them to have the same font size... but when I create a figure with multiple plots, the font size decreases even though I haven't changed the tiff() resolution or pointsize specifications, I have increased the figure size according to how many pl

[R] aggregate help

2012-09-20 Thread Sam Steingold
I want to count attributes of IDs: --8<---cut here---start->8--- z <- data.frame(id=c(10,20,10,30,10,20), a1=c("a","b","a","c","b","b"), a2=c("x","y","x","z","z","y"), stringsAsFactors=FALSE) > z id a1 a2 1 10 a

Re: [R] lattice dotplot reorder contiguous levels

2012-09-20 Thread Bert Gunter
I don't entirely understand what you want as an alternative. What is wrong with relation ="same", the default? In any case, it sounds like you'll need to write your own panel function. If you look at panel.dotplot(), you'll see it's fairly straightforward, so modification should not be difficult.

Re: [R] (no subject)

2012-09-20 Thread arun
HI Stefan, Thanks for the solutions. Just to add 1 more: f.a<-table(a); f.b<-table(b) c(f.a[!names(f.a)%in%names(f.b)],f.b[!names(f.b)%in%names(f.a)],xtabs(f.a[names(f.a)%in%names(f.b)]+f.b[names(f.b)%in%names(f.a)]~ names(f.a[names(f.a)%in%names(f.b)]))) #e i j a b d f g #1 1 1 3 1 3 5 5 A.K.

Re: [R] Line over Boxplot

2012-09-20 Thread Rui Barradas
Hello, Works with me after correcting your lines() instruction. Your code doesn't say what columns to use as coordinates, just where to look for them. Also, (1) allways explicitly close the device using dev.off(). (2) The grid lines were over the boxes. A way to avoid this is to plot the boxes

Re: [R] Line over Boxplot

2012-09-20 Thread Greg Snow
I expect that the coordinate system being set up and used by boxplot is different from what you are expecting. See the ?boxplot and ?bxp help pages for details. You may be able to have the boxplots drawn where you expect by using the "at" argument (you may want to specify "xlim" as well). On Thu

Re: [R] Applying glm coefficients (Beginner Question)

2012-09-20 Thread SirRon
Thanks for the reply! Using predict() on new data works just fine. What I'm interested in is, if I can use the coefficients or other data, to develop my own formula which does the same as predict(). -- View this message in context: http://r.789695.n4.nabble.com/Applying-glm-coefficients-Beginne

Re: [R] issue accessing help files

2012-09-20 Thread Basil Iannone
I apologize. I meant to type "help(anova)" and not "Help(anova)". I am installing the newest version later today after I complete some analyses. I will let everyone know if doing so solves my problem. Thanks, On Thu, Sep 20, 2012 at 11:46 AM, R. Michael Weylandt < michael.weyla...@gmail.com> wrot

[R] SQL query with Multicore option on R -linux

2012-09-20 Thread Madana_Babu
Hi all, I have the following sql query that I am executing on a machine with single core. I want to know how can I execute the same sqery on a maching that is running with 4 cores. Please provide me the code. NEW_TABLE <- rhive.query("SELECT A, B, COUNT(C) FROM TABLE_A WHERE A>='01-01-2012'")

Re: [R] Wilcoxon Test and Mean Ratios

2012-09-20 Thread peter dalgaard
On Sep 20, 2012, at 02:43 , Thomas Lumley wrote: > On Thu, Sep 20, 2012 at 5:46 AM, Mohamed Radhouane Aniba > wrote: >> Hello All, >> >> I am writing to ask your opinion on how to interpret this case. I have two >> vectors "a" and "b" that I am trying to compare. >> >> The wilcoxon test is gi

Re: [R] Applying glm coefficients (Beginner Question)

2012-09-20 Thread David Winsemius
On Sep 20, 2012, at 10:58 AM, SirRon wrote: > Thanks for the reply! Using predict() on new data works just fine. What I'm > interested in is, if I can use the coefficients or other data, to develop my > own formula which does the same as predict(). Of course you can. Extract the coefficients, ap

Re: [R] Wilcoxon Test and Mean Ratios

2012-09-20 Thread avinash barnwal
Hi, http://en.wikipedia.org/wiki/Wilcoxon_signed-rank_test We can clearly see that null hypothesis is median different or not. One way of proving non difference is P(X>Y) = P(X wrote: > > On Sep 20, 2012, at 02:43 , Thomas Lumley wrote: > >> On Thu, Sep 20, 2012 at 5:46 AM, Mohamed Radhouane Anib

[R] ES with time varying (GARCH model) under nonnormal (using cornish fisher expansion)

2012-09-20 Thread Eko andryanto Prakasa
Hiii   I have tried to measure ES with cornish fisher expansion using PerformanceAnalytics package, but i still confuse because to measure volatility i use GARCH model and i don't know how to consolidate it with ES in PerformanceAnalytics package..   i have measured ES under normality using

Re: [R] issue accessing help files

2012-09-20 Thread Basil Iannone
Okay. I installed the newest version of R and I still cannot link to help files. Is anyone else having this problem? Again, I am using Window's XP. Thanks for the help. On Thu, Sep 20, 2012 at 12:23 PM, Basil Iannone wrote: > I apologize. I meant to type "help(anova)" and not "Help(anova)". I a

Re: [R] Sweave - if \Sexpr{} than \SweaveInput{"my.Rnw"}

2012-09-20 Thread Duncan Murdoch
On 20/09/2012 9:05 AM, Duncan Murdoch wrote: On 20/09/2012 8:47 AM, Witold E Wolski wrote: > Depending on an R computation I would like to include an Sweave documents > in the main Sweave document. > How can I do it? > > So I was thinking to use Latex features : > > \newif\ifpaper > > \ifpap

Re: [R] Wilcoxon Test and Mean Ratios

2012-09-20 Thread Thomas Lumley
On Fri, Sep 21, 2012 at 6:43 AM, avinash barnwal wrote: > Hi, > > http://en.wikipedia.org/wiki/Wilcoxon_signed-rank_test > > We can clearly see that null hypothesis is median different or not. > One way of proving non difference is P(X>Y) = P(X ordered. Avinash. No. Firstly, the Wikipedia link

Re: [R] lattice dotplot reorder contiguous levels

2012-09-20 Thread Richard M. Heiberger
Is result3 what you are looking for? test<-structure(list(site = structure(c(1L, 1L, 1L, 1L, 1L, 1L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 3L, 3L, 3L, 3L, 3L, 3L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 5L), .Label = c

Re: [R] issue accessing help files

2012-09-20 Thread Duncan Murdoch
On 20/09/2012 2:14 PM, Basil Iannone wrote: Okay. I installed the newest version of R and I still cannot link to help files. Is anyone else having this problem? Again, I am using Window's XP. I don't think you've told us what output you get when you ask for help. Here's what I see from ?mean:

[R] VarBrul in R

2012-09-20 Thread Trevor Jenkins
Several years ago there were R implementations of a socio-linguistics analysis method called Variable Rule Analysis namely rbrul and r-varb. Both neither of the sites listed (in the method's WikiPedia page http://en.wikipedia.org/wiki/Variable_rules_analysis ) appear to be online any more (one was

Re: [R] Variance Inflation Factor VIC() with a matrix

2012-09-20 Thread Michael Friendly
You've stumbled across the answer to your question -- while lm() supports y~X formulas without a data=argument and y~ X1+X2+X3 formulas with one, you can't depend on all contributed functions to do the same. As John pointed out, the advantage of car::vif over other implementations is that it cor

Re: [R] Fortune nomination

2012-09-20 Thread Achim Zeileis
On Thu, 20 Sep 2012, Bert Gunter wrote: On Thu, Sep 20, 2012 at 9:01 AM, David Winsemius wrote: (In response to an OP's aplogy for an "awkwardly worded question"): Awkwardly worded questions will get much better answers if they are accompanied by some test data. Fortune nomination! Yes,

Re: [R] effective way to return only the first argument of "which()"

2012-09-20 Thread R. Michael Weylandt
On Thu, Sep 20, 2012 at 4:39 PM, Mike Spam wrote: > Thank you very much, especially Milan and Bert! > I will do some speedtests and fit the function to my needs. > > I think the best way would be a modified function in C... > But i am not familiar enough with C. Perhaps this would be a simple > bu

Re: [R] Line over Boxplot

2012-09-20 Thread gfishel
Thanks for your help! Unfortunately, I am now getting this: > pdf(file="boxplot_tmax_2012091912.pdf", height=10, width=12) > > soton.df = read.table ( tmax.final.text, header=TRUE ) Error in read.table(tmax.final.text, header = TRUE) : object 'tmax.final.text' not found Execution halted The

Re: [R] aggregate help

2012-09-20 Thread arun
Hi, Try this: z1<-aggregate(z,list(id=z$id),FUN=paste,sep=",") dat1<-data.frame(id=z1[,1],a1.total=unlist(lapply(z1[,3],length)),a1.val1=unique(z$a1),a1.num=unlist(lapply(lapply(z1[,3],table),`[`,1)),a1.val2=unlist(lapply(z1[,3],`[`,3)),a1.num2=unlist(lapply(lapply(z1[,3],table),`[`,2)),a2.total=u

[R] question on assigning an argument in a function that is create by the function itself

2012-09-20 Thread Benjamin Caldwell
Hi, I need some help with making a function a bit more elegant. How would you all suggest avoiding the problem I've made myself below - I've written a function that creates a temporary matrix by subseting a larger one I assign it. I then call vectors from that matrix, add each item in the vector t

Re: [R] qplot: plotting precipitation data

2012-09-20 Thread Winston Chang
It was a bit hard for me to follow the thread and figure out exactly what the problem is that you're having, but I think it has something to do with the ticks on the x axis not appearing in the correct order? It's probably related to this issue: https://github.com/hadley/ggplot2/issues/577 I belie

Re: [R] Line over Boxplot

2012-09-20 Thread Peter Langfelder
Enclose the file name tmax.final.text in quotes. Otherwise R is looking for a variable named tmax.final.text, not the file name named "tmax.final.text". HTH Peter On Thu, Sep 20, 2012 at 1:02 PM, gfishel wrote: > Thanks for your help! Unfortunately, I am now getting this: > >> pdf(file="boxplot

Re: [R] question on assigning an argument in a function that is create by the function itself

2012-09-20 Thread Rui Barradas
Hello, Inline. Em 20-09-2012 22:48, Benjamin Caldwell escreveu: Hi, I need some help with making a function a bit more elegant. Yes you do! Below, your first function, for instance, becomes a one liner. Trick: R is vectorized. Use functions that act on whole vectors, avoiding loops. How

Re: [R] issue accessing help files

2012-09-20 Thread Duncan Murdoch
On 12-09-20 6:58 PM, Basil Iannone wrote: Hi Duncan, The output I see after typing ?mean is starting httpd help server ... done Then the browser opens but goes nowhere. I just see a black IE page with no address in the address bar. OK. I tried what you suggested. I typed the following tools:

Re: [R] issue accessing help files

2012-09-20 Thread Basil Iannone
Hi Duncan, The output I see after typing ?mean is starting httpd help server ... done Then the browser opens but goes nowhere. I just see a black IE page with no address in the address bar. OK. I tried what you suggested. I typed the following tools:::httpdPort [1] 17081 I then pasted the fol

[R] Decision Tree: Am I Missing Anything?

2012-09-20 Thread Vik Rubenfeld
I'm working with some data from which a client would like to make a decision tree predicting brand preference based on inputs such as price, speed, etc. After running the decision tree analysis using rpart, it appears that this data is not capable of predicting brand preference. Here's the d

Re: [R] Decision Tree: Am I Missing Anything?

2012-09-20 Thread Bhupendrasinh Thakre
Not very sure what the problem is as I was not able to take your data for run. You might want to use dput() command to present the data. Now on the programming side. As we can see that we have more than 2 levels for the brands and hence method = class is not able to able to understand what you

[R] Axis annotation using lattice spplot

2012-09-20 Thread V Zintzen
Hi there, I am having difficulties with what seems like a very simple thing. My objective is to plot a distribution map for a species. I have produced a plot with spplot which uses a raster, a few shapefiles and xy points which are the species coordinates. It all works fine until I want to add co

Re: [R] Decision Tree: Am I Missing Anything?

2012-09-20 Thread Vik Rubenfeld
Thanks! Here's the dput output: > dput(test.df) structure(list(BRND = structure(c(1L, 12L, 16L, 17L, 18L, 19L, 20L, 21L, 22L, 2L, 3L, 4L, 5L, 6L, 7L, 8L, 9L, 10L, 11L, 13L, 14L, 15L), .Label = c("Brand 1", "Brand 10", "Brand 11", "Brand 12", "Brand 13", "Brand 14", "Brand 15", "Brand 16", "Bran

[R] Parallel Programming

2012-09-20 Thread Tjun Kiat Teo
I am trying to do parallel programming and I tried this library(doSNOW) library(foreach) testfunc<-function(x){ x<-x+1 x } noc<-2 cl <- makeCluster(do.call(rbind,rep(list("localhost"),noc)), type = "SOCK") registerDoSNOW(cl) clusterExport(cl=cl,c("testfunc.r")) testl<-foreach(pp=1:2) %dopar%

Re: [R] Parallel Programming

2012-09-20 Thread Jeff Newmiller
Then don't do that. Use your script file to define functions. Source that file before the loop to load them into memory. Call those functions from within your loop. --- Jeff NewmillerThe .

Re: [R] Decision Tree: Am I Missing Anything?

2012-09-20 Thread Vik Rubenfeld
Bhupendrashinh, thanks very much! I ran J48 on a respondent-level data set and got a 61.75% correct classification rate! Correctly Classified Instances 988 61.75 % Incorrectly Classified Instances 612 38.25 % Kappa statistic

Re: [R] Decision Tree: Am I Missing Anything?

2012-09-20 Thread Bhupendrasinh Thakre
One possible way to think of it is using " variable reduction" before going for J48. You may want to use several methods available for that. Again prediction for brands is more of a business question to me. Two solution which I can think of. 1. Variable reduction before decision tree. 2. Let th

Re: [R] Decision Tree: Am I Missing Anything?

2012-09-20 Thread Vik Rubenfeld
Very good. Could you point me in a couple of potential directions for variable reduction? E.g. correlation analysis? On Sep 20, 2012, at 10:36 PM, Bhupendrasinh Thakre wrote: > One possible way to think of it is using " variable reduction" before going > for J48. You may want to use several m

Re: [R] Decision Tree: Am I Missing Anything?

2012-09-20 Thread Achim Zeileis
Hi, just to add a few points to the discussion: - rpart() is able to deal with responses with more than two classes. Setting method="class" explicitly is not necessary if the response is a factor (as in this case). - If your tree on this data is so huge that it can't even be plotted, I woul

Re: [R] lattice dotplot reorder contiguous levels

2012-09-20 Thread Deepayan Sarkar
On Thu, Sep 20, 2012 at 7:48 PM, maxbre wrote: > my reproducible example > > test<-structure(list(site = structure(c(1L, 1L, 1L, 1L, 1L, 1L, 2L, > 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 3L, > 3L, 3L, 3L, 3L, 3L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, > 4L, 4L, 4L, 4L, 4L,