Re: [R] a quick question about "rbinom"

2012-01-04 Thread Bert Gunter
David! ... > > It means the author either doesn't know the 'sample' function, or wants you > to understand how to use 'rbinom', or that's just the way she thinks. > >>> Could someone help? Thanks so much, >>> X1<-c("A","B")[rbinom(n,1,0.6)+1] X2<-c("C","D")[rbinom(n,1,0.1)+1] > > > C.f. >

Re: [R] a quick question about "rbinom"

2012-01-04 Thread David Winsemius
On Jan 4, 2012, at 8:46 PM, David Winsemius wrote: On Jan 4, 2012, at 7:43 PM, Robert Baer wrote: -Original Message- From: lynn.tsai Sent: Wednesday, January 04, 2012 3:38 PM To: r-help@r-project.org Subject: [R] a quick question about "rbinom" Hello, I have the following code using

Re: [R] problem in R

2012-01-04 Thread William Dunlap
> d <- data.frame(x=c(1,NA,3,4,5), y=c(2,4,6,8,9), row.names=paste("No.",1:5)) > predict(lm(y~x, data=d, na.action=na.omit)) No. 1 No. 3 No. 4 No. 5 2.2 5.8 7.6 9.4 > d$y - predict(lm(y~x, data=d, na.action=na.omit)) [1] -0.2 -1.8 -1.6 -1.4 6.8 Warning message: In d$y - pre

Re: [R] a quick question about "rbinom"

2012-01-04 Thread lynn.tsai
Hi, thank you all for replying. First, it's not a homework. I'm learning R and the CFA (configural frequency analysis). I am trying to understand this part of the code so that I can modify it and run a simulation for power analysis of CFA. Thanks again. -- View this message in context: http://

Re: [R] Allow HTML email on R-Help

2012-01-04 Thread Rich Shepard
On Wed, 4 Jan 2012, John wrote: It's also a storage hog using several times the space a simple ASCII or UTF-8 message does. HTML email also offers a convenient way to slip worms and trojans on systems. Also, since there are various "dialects" of HTML, documents in one dialect may not display t

Re: [R] Allow HTML email on R-Help

2012-01-04 Thread John
On Tue, 03 Jan 2012 21:29:57 -1000 Jeff Newmiller wrote: > It may be "mainstream" but it really isn't as easy to use or as > universally readable as plain text. > > There are other forums to meet this "need", such as > stackoverflow.com. It's also a storage hog using several times the space a

Re: [R] difference of the multinomial logistic regression results between multinom() function in R and SPSS

2012-01-04 Thread David Winsemius
On Jan 4, 2012, at 8:10 PM, Yoo Jinho wrote: Dear all, I have found some difference of the results between multinom() function in R and multinomial logistic regression in SPSS software. The input data, model and parameters are below: choles <- c(94, 158, 133, 164, 162, 182, 140, 157, 146,

Re: [R] a quick question about "rbinom"

2012-01-04 Thread David Winsemius
On Jan 4, 2012, at 7:43 PM, Robert Baer wrote: -Original Message- From: lynn.tsai Sent: Wednesday, January 04, 2012 3:38 PM To: r-help@r-project.org Subject: [R] a quick question about "rbinom" Hello, I have the following code using rbinom, but I don't understand what *"+1"* means i

Re: [R] using var from bash in R script

2012-01-04 Thread dood
Marc Schwartz-3 wrote > > See ?as.formula and ?paste > > Something along the lines of the following should work: > > Args <- c("one", "two", "three") > >> Args > [1] "one" "two" "three" > >> paste(Args[1], "~", Args[2]) > [1] "one ~ two" > >> as.formula(paste(Args[1], "~", Args[2])) > o

[R] difference of the multinomial logistic regression results between multinom() function in R and SPSS

2012-01-04 Thread Yoo Jinho
Dear all, I have found some difference of the results between multinom() function in R and multinomial logistic regression in SPSS software. The input data, model and parameters are below: choles <- c(94, 158, 133, 164, 162, 182, 140, 157, 146, 182); sbp <- c(105, 121, 128, 149, 132, 103, 97, 12

Re: [R] problem in R

2012-01-04 Thread iliketurtles
Michael, thank you for your post, I learned a lot. Why is it that people prefer na.exclude to na.omit? - Isaac Research Assistant Quantitative Finance Faculty, UTS -- View this message in context: http://r.789695.n4.nabble.com/problem-in-R-tp4260254p4263119.html Sent from the R help ma

Re: [R] a quick question about "rbinom"

2012-01-04 Thread Robert Baer
-Original Message- From: lynn.tsai Sent: Wednesday, January 04, 2012 3:38 PM To: r-help@r-project.org Subject: [R] a quick question about "rbinom" Hello, I have the following code using rbinom, but I don't understand what *"+1"* means in the code. Could someone help? Thanks so much, X1

Re: [R] a quick question about "rbinom"

2012-01-04 Thread David Winsemius
On Jan 4, 2012, at 5:31 PM, Justin Haynes wrote: homework or not, ?rbinom should be plenty. I didn't think so. I thought that the answer was: ?"[" -- David. On Wed, Jan 4, 2012 at 1:38 PM, lynn.tsai wrote: Hello, I have the following code using rbinom, but I don't understand

Re: [R] Is there a way to update a method on an existing Reference Class object?

2012-01-04 Thread Martin Morgan
On 01/04/2012 06:09 AM, Peder Bacher wrote: Hi Being able to do object oriented programming in R is really good. I now started using the Reference Classes and really like it. Though, I have one problem: I cannot find a way to update a method on an existing object. The flexibility that scriptin

Re: [R] a quick question about "rbinom"

2012-01-04 Thread Steve Lianoglou
A direct answer to your question: On Wed, Jan 4, 2012 at 4:38 PM, lynn.tsai wrote: > Hello, I have the following code using rbinom, but I don't understand what > *"+1"* means in the code. Could someone help? Thanks so much, > >> X1<-c("A","B")[rbinom(n,1,0.6)+1] >> X2<-c("C","D")[rbinom(n,1,0.1)+

Re: [R] calculate quantiles of a custom function

2012-01-04 Thread Albyn Jones
FWIW, the integral of a mixture density is the same mixture of the CDFs, so you can use the pbeta functions: pcustom <- function(x) (pbeta(x,2,6) + pbeta(x,6,2))/2 albyn Quoting Gerhard : Am Dienstag, 3. Januar 2012, 19:51:36 schrieb Prof. Dr. Matthias Kohl: D <- AbscontDistribution(d = f

Re: [R] [newbie] stack operations, or functions with side effects (or both)

2012-01-04 Thread William Dunlap
R functions should not alter their arguments, except for 'replacement' functions that are called on the left side of an assignment operators (e.g., x[1]<-10 calls the replacement function `[<-`). R functions cam use their enclosing environments to save state. E.g., the following makeStack functio

Re: [R] using var from bash in R script

2012-01-04 Thread David Winsemius
On Jan 4, 2012, at 4:08 PM, dood wrote: Dear R users, This probably a really noob question, but I'm stuck. I'd like to pass some variables from bash to R as strings. I can successfully pass variables using commandArgs(), the problem is that I end up with an array. Huh? You should be get

Re: [R] About source()

2012-01-04 Thread Li SUN
Thanks, guys! I am using Rscript at the moment and will definitely try littler. Li Sun 2012/1/4 Rainer M Krug : > -BEGIN PGP SIGNED MESSAGE- > Hash: SHA1 > > On 04/01/12 10:39, Uwe Ligges wrote: >> >> >> On 03.01.2012 21:22, Li SUN wrote: >>> Thanks, Rolf, Justin and Uwe! >>> >>> Actua

Re: [R] subscript with comma

2012-01-04 Thread Duncan Murdoch
On 12-01-04 11:41 AM, suse wrote: Thank you! It works now. But I still don't understand, how all these expressions, "", paste, group, eval... have to be used together. (For example, I first tried expression(sm[w,grass]) but it didn't work, and I couldn't find, why (and when) commas are interpret

Re: [R] a quick question about "rbinom"

2012-01-04 Thread Justin Haynes
homework or not, ?rbinom should be plenty. On Wed, Jan 4, 2012 at 1:38 PM, lynn.tsai wrote: > Hello, I have the following code using rbinom, but I don't understand what > *"+1"* means in the code. Could someone help? Thanks so much, > > > X1<-c("A","B")[rbinom(n,1,0.6)+1] > > X2<-c("C","D")

Re: [R] a quick question about "rbinom"

2012-01-04 Thread Bert Gunter
Homework? If not, context? -- Bert On Wed, Jan 4, 2012 at 1:38 PM, lynn.tsai wrote: > Hello, I have the following code using rbinom, but I don't understand what > *"+1"* means in the code. Could someone help? Thanks so much, > >> X1<-c("A","B")[rbinom(n,1,0.6)+1] >> X2<-c("C","D")[rbinom(n,1,0.

[R] a quick question about "rbinom"

2012-01-04 Thread lynn.tsai
Hello, I have the following code using rbinom, but I don't understand what *"+1"* means in the code. Could someone help? Thanks so much, > X1<-c("A","B")[rbinom(n,1,0.6)+1] > X2<-c("C","D")[rbinom(n,1,0.1)+1] -- View this message in context: http://r.789695.n4.nabble.com/a-quick-question-about-r

Re: [R] Symbols in graph

2012-01-04 Thread Jim Lemon
> Hi, > > Is there an easy way to add symbols to a line in a scatter plot, so that > only a few symbols are added per line (a line drawn based on a large set > of > data points) , in order to distinguish several lines in one graph (not a > symbol for each data point as is the default in plot()). >

Re: [R] using var from bash in R script

2012-01-04 Thread Marc Schwartz
On Jan 4, 2012, at 3:08 PM, dood wrote: > Dear R users, > > This probably a really noob question, but I'm stuck. I'd like to pass some > variables from bash to R as strings. I can successfully pass variables using > commandArgs(), the problem is that I end up with an array. So, for example: > >

Re: [R] Combining characters

2012-01-04 Thread Justin Haynes
apply(expand.grid(x, y, z, stringsAsFactors=F), 1, paste, collapse=' ') On Wed, Jan 4, 2012 at 8:32 AM, jeremy wrote: > Hi all, > > I'm trying to combine exhaustively several character arrays in R like: > x=c("one","two","three") > y=c("yellow","blue","green") > z=c("apple","cheese") > > in or

Re: [R] Combining characters

2012-01-04 Thread Joshua Wiley
Try expand.grid() to create all the combinations. Then just collapse them with paste(): apply(expand.grid(x, y, z), 1, paste, collapse = " ") Cheers, Josh On Wed, Jan 4, 2012 at 8:32 AM, jeremy wrote: > Hi all, > > I'm trying to combine exhaustively several character arrays in R like: > x=c("

Re: [R] Combining characters

2012-01-04 Thread Marc Schwartz
On Jan 4, 2012, at 10:32 AM, jeremy wrote: > Hi all, > > I'm trying to combine exhaustively several character arrays in R like: > x=c("one","two","three") > y=c("yellow","blue","green") > z=c("apple","cheese") > > in order to get concatenation of > > x[1] y[1] z[1] ("one yellow apple") > x[1

Re: [R] Combining characters

2012-01-04 Thread R. Michael Weylandt
? expand.grid Michael On Wed, Jan 4, 2012 at 10:32 AM, jeremy wrote: > Hi all, > > I'm trying to combine exhaustively several character arrays in R like: > x=c("one","two","three") > y=c("yellow","blue","green") > z=c("apple","cheese") > > in order to get concatenation of > > x[1] y[1] z[1]  ("o

Re: [R] Combining characters

2012-01-04 Thread andrija djurovic
Hi. You can use expand.grid here expand.grid(x,y,z) Andrija On Wed, Jan 4, 2012 at 5:32 PM, jeremy wrote: > Hi all, > > I'm trying to combine exhaustively several character arrays in R like: > x=c("one","two","three") > y=c("yellow","blue","green") > z=c("apple","cheese") > > in order to get co

Re: [R] RODBC installation: error message

2012-01-04 Thread gregory benison
> > One thing R could do better is to provide a standard way to view README and > similar files before installing a package.  That might have helped here. > Agreed... right now, the R documentation points to a straightforward, one-line way to download and install packages from the R command line,

[R] using var from bash in R script

2012-01-04 Thread dood
Dear R users, This probably a really noob question, but I'm stuck. I'd like to pass some variables from bash to R as strings. I can successfully pass variables using commandArgs(), the problem is that I end up with an array. So, for example: > Args <- commandArgs(TRUE) > Args [1] "one" "two"

Re: [R] Combining characters

2012-01-04 Thread Rui Barradas
Hello, If you want to apply the same procedure to all elements of an object, check out the '*apply' functions. In this case, x=c("one","two","three") y=c("yellow","blue","green") z=c("apple","cheese") lapply(x, function(x) paste(x, y)) gives a good picture of what you want to do, just transfo

Re: [R] Options for generating editable figures?

2012-01-04 Thread Allen McBride
Thank you for the advice; this is very helpful. I will see how they feel about installing Inkscape. I'll also work on getting R installed in a Windows environment so I can produce .emf and .wmf files. I found one old message on this list from someone who had luck doing this by running R with Wi

[R] plot rq lm

2012-01-04 Thread agent dunham
Dear Community, I'd like to plot an rq object the same way I do with a lm one, is it possible? Something like this plot(rqmodel , 1:4, id.labels=rownames(pga1)); where rqmodel <- rq(log(vd) ~ v1 + log(v2) +log(v3) + v4 + v5 ,data =dat) Thanks in advance and apologies, I'm pretty newbie with t

Re: [R] function in R for my exercise

2012-01-04 Thread Thomthom
Hi Michael, Thanks for your answer! sorry I didn't see this rule... No problem, I'll try to figure it out by myself. Thanks for your indication though! Thomas 2012/1/4, Michael Weylandt [via R] : > > > Unfortunately, there's a general no-homework rule because we never > know what your instructo

Re: [R] problem on plotting ts data

2012-01-04 Thread Rui Barradas
Hello, Try 'as.vector' or 'as.numeric' x <- as.ts(rnorm(20)) y <- as.ts(rnorm(20)) plot(x) plot(as.vector(lag(x,-9)),as.vector(y),type="p") # works plot(as.numeric(lag(x,-9)),as.numeric(y),type="p") # also works Rui Barradas -- View this message in context: http://r.789695.

Re: [R] problem on plotting ts data

2012-01-04 Thread lornyi
thanks, it works! -- View this message in context: http://r.789695.n4.nabble.com/problem-on-plotting-ts-data-tp4261865p4262179.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailm

Re: [R] subscript with comma

2012-01-04 Thread suse
Thank you! It works now. But I still don't understand, how all these expressions, "", paste, group, eval... have to be used together. (For example, I first tried expression(sm[w,grass]) but it didn't work, and I couldn't find, why (and when) commas are interpreted here differently). So: Is there

[R] Symbols in graph

2012-01-04 Thread Y Nygård
Hi, Is there an easy way to add symbols to a line in a scatter plot, so that only a few symbols are added per line (a line drawn based on a large set of data points) , in order to distinguish several lines in one graph (not a symbol for each data point as is the default in plot()). Thanks a lot!

[R] Combining characters

2012-01-04 Thread jeremy
Hi all, I'm trying to combine exhaustively several character arrays in R like: x=c("one","two","three") y=c("yellow","blue","green") z=c("apple","cheese") in order to get concatenation of x[1] y[1] z[1] ("one yellow apple") x[1] y[1] z[2] ("one yellow cheese") x[1] y[2] z[1]("one blue apple")

[R] problem on plotting ts data

2012-01-04 Thread lornyi
Hi, i try to plot ts data on x-y coordiante I want my data to be points, but somehow it always comes out with lines and # linked bwtween data, i used plot(lag(x,-9),y,type="p"), x and y are time series data is there anyway to remove those lines? Thanks a lot -- View this message in context: http

Re: [R] calculate quantiles of a custom function

2012-01-04 Thread Gerhard
Am Dienstag, 3. Januar 2012, 19:51:36 schrieb Prof. Dr. Matthias Kohl: > D <- AbscontDistribution(d = function(x) dbeta(x, 2, 6) + dbeta(x,6,2), > low = 0, up = 1, withStand = TRUE) Dear all, thank you all again for your help. So, summing up, (in case this might be useful to other beginners -

Re: [R] tcltk on linux/rhel6

2012-01-04 Thread Carl Baribault
Brian, FYI, I had previously installed tcl-devel but had overlooked tk-devel on the OS. Now that I've installed tk-devel on the OS, the following sequence of commands has succeeded: sudo ./configure --with-tcltk sudo make sudo make check sudo make install R ... > library("tcltk") Loading Tcl/Tk

Re: [R] [newbie] stack operations, or functions with side effects (or both)

2012-01-04 Thread Justin Haynes
do s[1] and s[-1] do what you're looking for? those are just to display... if you want to change s, you need to reassign it or fiddle with namespacing. however, I'd say it is better to write R code as though data structures are immutable until you explicitly re-assign them rather than trying to de

[R] [newbie] stack operations, or functions with side effects (or both)

2012-01-04 Thread Tom Roche
summary: Specifically, how does one do stack/FIFO operations in R? Generally, how does one code functions with side effects in R? details: I have been a coder for years, mostly using C-like semantics (e.g., Java). I am now trying to become a scientist, and to use R, but I don't yet have the sens

Re: [R] Warning message about closing a connection XXXX

2012-01-04 Thread Martin Morgan
On 01/04/2012 09:25 AM, Prof Brian Ripley wrote: On 04/01/2012 17:12, William Dunlap wrote: Re > How can I avoid the warning message altogether? ?closeAllConnections I think of calls to closeAllConnections() in the same way that I think of calls to rm(list=objects()): they both can remove thin

Re: [R] putting regression output right on a plot

2012-01-04 Thread David Winsemius
On Jan 4, 2012, at 11:30 AM, Mark Leeds wrote: hi: does anyone know if it's possible and, if so, where there's an example, of putting the output of summary(lm) right on the plot of the data itself. If the answer is to use capture.output and then text, I'll try that but I was thinking the

Re: [R] Passing multiple arguments to a function through sapply() XXXX

2012-01-04 Thread David Winsemius
On Jan 4, 2012, at 3:47 PM, Dan Abner wrote: Hello everyone, How does one pass multiple arguments of a user defined function to that function when called within sapply()? I have the following: myna<-function(x,miss.val) {x[x %in% miss.val]<-NA;x} mydataNA3<-sapply(mydataNA,c(x=myna,miss.

[R] Passing multiple arguments to a function through sapply() XXXX

2012-01-04 Thread Dan Abner
Hello everyone, How does one pass multiple arguments of a user defined function to that function when called within sapply()? I have the following: > myna<-function(x,miss.val) {x[x %in% miss.val]<-NA;x} > mydataNA3<-sapply(mydataNA,c(x=myna,miss.val=c(9,99))) Error in match.fun(FUN) : 'c(x =

Re: [R] Finding Source of Error Message of 'Non-Unique Index Entries' [FIXED]

2012-01-04 Thread David Winsemius
On Jan 4, 2012, at 3:21 PM, Rich Shepard wrote: On Wed, 4 Jan 2012, David Winsemius wrote: Nothing attached. I don't know what you entitled teh "compressed dput output" but it did not pass the filters of the mailserver and you did not copy me. David, It must have been stripped off as t

Re: [R] Finding Source of Error Message of 'Non-Unique Index Entries' [FIXED]

2012-01-04 Thread Rich Shepard
On Wed, 4 Jan 2012, David Winsemius wrote: Nothing attached. I don't know what you entitled teh "compressed dput output" but it did not pass the filters of the mailserver and you did not copy me. David, It must have been stripped off as too large (14K). Regardless, I solved the problem:

Re: [R] Using a mathematical expression in sapply() XXXX

2012-01-04 Thread peter dalgaard
On Jan 4, 2012, at 16:32 , David Winsemius wrote: > > On Jan 4, 2012, at 9:17 AM, peter dalgaard wrote: > >> >> On Jan 4, 2012, at 14:57 , Milan Bouchet-Valat wrote: >> >>> Le mercredi 04 janvier 2012 à 08:41 -0500, Dan Abner a écrit : Hello everyone, I have the following call

Re: [R] Finding Source of Error Message of 'Non-Unique Index Entries'

2012-01-04 Thread David Winsemius
Nothing attached. I don't know what you entitled teh "compressed dput output" but it did not pass the filters of the mailserver and you did not copy me. If chemdata is available as a text file, hten make sure its extension is .txt and then attach it. -- David. On Jan 4, 2012, at 1:31 PM, R

Re: [R] Warning message about closing a connection XXXX

2012-01-04 Thread peter dalgaard
On Jan 4, 2012, at 19:21 , Duncan Murdoch wrote: > On 12-01-04 12:25 PM, Prof Brian Ripley wrote: >> >> >> Rather than using a sledgehammer, use showConnections(all=TRUE) to see >> all connections, and close the ones you want to (and its help page shows >> you how). > > In older versions that

Re: [R] Adding a vertical line to plot with two overlapping density plots

2012-01-04 Thread David L Carlson
That works, but if all you want is one vertical line at 0, this will work densityplot(~value, thedata.m, groups=variable,auto.key=list(columns=2), panel = function(x, y, ...) { panel.densityplot(x, ...) panel.abline(v=0) } )

Re: [R] Finding Source of Error Message of 'Non-Unique Index Entries'

2012-01-04 Thread Rich Shepard
On Wed, 4 Jan 2012, David Winsemius wrote: You didn't ask for what was duplicated, but rather what was NOT duplicated with that code. In the case of a dataframe it is the entire row that is tested. My original question was what was duplicated, but ... I changed the function by dropping the '

Re: [R] Is using glht with "Tukey" for lme post-hoc comparisons an appropriate substitute to TukeyHSD?

2012-01-04 Thread Richard M. Heiberger
Anne, Thank you for writing back, and for including your data. I have two things here. First, I ran an a analysis of your data and have my observations on interpretation. Second, I answer your general question about glht and TukeyHSD when there are interactions. I illustrate how to get the same

Re: [R] Warning message about closing a connection XXXX

2012-01-04 Thread Prof Brian Ripley
On 04/01/2012 18:21, Duncan Murdoch wrote: On 12-01-04 12:25 PM, Prof Brian Ripley wrote: On 04/01/2012 17:12, William Dunlap wrote: Re > How can I avoid the warning message altogether? ?closeAllConnections I think of calls to closeAllConnections() in the same way that I think of calls to rm(

Re: [R] subscript with comma

2012-01-04 Thread Nordlund, Dan (DSHS/RDA)
> -Original Message- > From: r-help-boun...@r-project.org [mailto:r-help-bounces@r- > project.org] On Behalf Of David Winsemius > Sent: Wednesday, January 04, 2012 9:53 AM > To: Uwe Ligges > Cc: r-help@r-project.org; suse > Subject: Re: [R] subscript with comma > > > On Jan 4, 2012, at 10

Re: [R] Warning message about closing a connection XXXX

2012-01-04 Thread Duncan Murdoch
On 12-01-04 12:25 PM, Prof Brian Ripley wrote: On 04/01/2012 17:12, William Dunlap wrote: Re > How can I avoid the warning message altogether? ?closeAllConnections I think of calls to closeAllConnections() in the same way that I think of calls to rm(list=objects()): they both can rem

Re: [R] Finding Source of Error Message of 'Non-Unique Index Entries'

2012-01-04 Thread David Winsemius
On Jan 4, 2012, at 12:21 PM, Rich Shepard wrote: On Tue, 3 Jan 2012, David Winsemius wrote: burns.tds[ !duplicated(burns.tds) , ] Apparently it does not matter if the site column in the data frame is a factor or a character, read.zoo() generates the same error. Applying the above pro

Re: [R] subscript with comma

2012-01-04 Thread David Winsemius
On Jan 4, 2012, at 10:51 AM, Uwe Ligges wrote: On 04.01.2012 16:12, suse wrote: Hi, I want to write a word with subscript in a graph. Unfortunately, the subscript contains a comma, so all my trials didn't work and I didn't find how to do it. I want to write "sm" as normal text and "w,gra

Re: [R] Warning message about closing a connection XXXX

2012-01-04 Thread Prof Brian Ripley
On 04/01/2012 17:12, William Dunlap wrote: Re > How can I avoid the warning message altogether? ?closeAllConnections I think of calls to closeAllConnections() in the same way that I think of calls to rm(list=objects()): they both can remove things that are not theirs to remove. Calling

Re: [R] Finding Source of Error Message of 'Non-Unique Index Entries'

2012-01-04 Thread Rich Shepard
On Tue, 3 Jan 2012, David Winsemius wrote: burns.tds[ !duplicated(burns.tds) , ] Apparently it does not matter if the site column in the data frame is a factor or a character, read.zoo() generates the same error. Applying the above produces a long list starting with: burns.tds[!duplicated(

Re: [R] Warning message about closing a connection XXXX

2012-01-04 Thread William Dunlap
Re > How can I avoid the warning message altogether? ?closeAllConnections I think of calls to closeAllConnections() in the same way that I think of calls to rm(list=objects()): they both can remove things that are not theirs to remove. Calling gc() will close all unused connections, so no

Re: [R] KS and AD test for Generalized PAreto and Generalized Extreme value

2012-01-04 Thread R. Michael Weylandt
fExtremes::pgpd & pgev have always worked for me. Though, if I remember right, the physical sciences and finance tend to use reciprocal definitions for one of the parameters (can't remember which -- xi in gpd perhaps?) so tread lightly. Michael On Wed, Jan 4, 2012 at 8:21 AM, David Winsemius wro

[R] interaction plot and x axis

2012-01-04 Thread Lathouri, Maria
Dear all I am trying to make an interaction plot among 6 variables; e.g. PH to be in the x axis and the rest 5 variables in the y axis. The code that I am using is the below: The name of my file is e.g. spec so > spec<-read.csv("spec.csv") >head (spec) >str(spec) >names<-names(spec)[

[R] putting regression output right on a plot

2012-01-04 Thread Mark Leeds
hi: does anyone know if it's possible and, if so, where there's an example, of putting the output of summary(lm) right on the plot of the data itself. If the answer is to use capture.output and then text, I'll try that but I was thinking there might be an example somewhere ? thanks. [[alt

Re: [R] function in R for my exercise

2012-01-04 Thread R. Michael Weylandt
Unfortunately, there's a general no-homework rule because we never know what your instructor wants you to figure out on your own (though, a sincere thanks for admitting this was hw rather than trying to trick us like so many). That said, I think your second function, while a little clumsy, does wor

Re: [R] Adding a vertical line to plot with two overlapping density plots

2012-01-04 Thread Petr PIKAL
> > thank you very much Petr. Yes, I meant densityplot form lattice. > > The code I gave plots the densities of both x1 and x2 in one panel. > Could you show me how to integrate the function addline into the code so > that a vertical line v=0 is added? The function is used after you make a

Re: [R] problem in R

2012-01-04 Thread R. Michael Weylandt
I'm not a huge fan of this sort of solution because it doesn't make sense for non-vector-shaped (i.e., matrix or data.frame) data. It only works here because the matrix produced is a special 1xN case. E.g., # Set up some data (and yes, I realize I'm using the trick I'm speaking out against, but c

Re: [R] Adding a vertical line to plot with two overlapping density plots

2012-01-04 Thread josh rosen
thank you very much Petr. Yes, I meant densityplot form lattice. The code I gave plots the densities of both x1 and x2 in one panel. Could you show me how to integrate the function addline into the code so that a vertical line v=0 is added? On 4 January 2012 15:55, Petr PIKAL wrote: > Hi > >

[R] function in R for my exercise

2012-01-04 Thread Thomthom
Hi R helpers! I have a question. I'm trying to create a function for an exercise. Here are the arguments I should include: x and y are numeric z is a name ("plus","minus","multiply","divide") and swap is logical. Here is what the function should do: When z="plus", then x+y is performed and so o

Re: [R] Merging and subsetting with row names XXXX

2012-01-04 Thread Petr PIKAL
Hi As you did not provide any data you probably can not get canned solution > Hello everyone, > > I have two questions: > > 1) > > I want to create a subset of a data frame column-wise and simultaneously > extract the row names into a "proper" variable. I tried this, but received > an error:

Re: [R] Adding a vertical line to plot with two overlapping density plots

2012-01-04 Thread Petr PIKAL
Hi > > Hi, > A simple question I hope. I wish to add a single vertical line to a plot > with several density plots. > Here is a simplified example. > > > thedata <- data.frame(x1=rnorm(100,1,1),x2=rnorm(100,3,1)) #create data > thedata.m<-melt(thedata) > densityplot(~value, thedata.

[R] Merging and subsetting with row names XXXX

2012-01-04 Thread Dan Abner
Hello everyone, I have two questions: 1) I want to create a subset of a data frame column-wise and simultaneously extract the row names into a "proper" variable. I tried this, but received an error: > myleft<-mydata[c(id=row.names(mydata),"workshop","gender","q1","q2")] Error in `[.data.frame`(

Re: [R] subscript with comma

2012-01-04 Thread Uwe Ligges
On 04.01.2012 16:12, suse wrote: Hi, I want to write a word with subscript in a graph. Unfortunately, the subscript contains a comma, so all my trials didn't work and I didn't find how to do it. I want to write "sm" as normal text and "w,grass" in the subscript. Can anybody help me? And a mor

Re: [R] quadratic programming-maximization instead of

2012-01-04 Thread Ravi Varadhan
Maximizing f(x) = x'Ax makes sense only when A is negative-definite. Therefore, this is the same as minimizing x'Bx, where B = -A, and B is positive-definite. In other words, you should be able to simply flip the sign of the original matrix . This should yield a positive-definite matrix sinc

Re: [R] Using a mathematical expression in sapply() XXXX

2012-01-04 Thread David Winsemius
On Jan 4, 2012, at 9:17 AM, peter dalgaard wrote: On Jan 4, 2012, at 14:57 , Milan Bouchet-Valat wrote: Le mercredi 04 janvier 2012 à 08:41 -0500, Dan Abner a écrit : Hello everyone, I have the following call to sapply() and error message. Is the most efficient way to deal with this to mak

Re: [R] [Matlab] Need help on ARIMA and Matlab

2012-01-04 Thread R. Michael Weylandt
Perhaps you are confusedthis is R-help that said, it's very easy with forecast:::forecast.Arima in R Michael On Wed, Jan 4, 2012 at 8:38 AM, Antonio Tirri wrote: > Hi, I have to forecast some value of a time series using an ARIMA(5,1,3) > model. > > I saw in Matlab there isn't a funct

[R] Adding a vertical line to plot with two overlapping density plots

2012-01-04 Thread josh rosen
Hi, A simple question I hope. I wish to add a single vertical line to a plot with several density plots. Here is a simplified example. thedata <- data.frame(x1=rnorm(100,1,1),x2=rnorm(100,3,1)) #create data thedata.m<-melt(thedata) densityplot(~value, thedata.m, groups=variable,auto.k

[R] subscript with comma

2012-01-04 Thread suse
Hi, I want to write a word with subscript in a graph. Unfortunately, the subscript contains a comma, so all my trials didn't work and I didn't find how to do it. I want to write "sm" as normal text and "w,grass" in the subscript. Can anybody help me? And a more general question: I read the help t

[R] [Matlab] Need help on ARIMA and Matlab

2012-01-04 Thread Antonio Tirri
Hi, I have to forecast some value of a time series using an ARIMA(5,1,3) model. I saw in Matlab there isn't a function for ARIMA models because ARIMA models are a type of Box-Jenkins models. But how to set parameters? In the Box-Jenkins models m = bj(data,[nb nc nd nf nk]) How to set nb, nc, n

[R] Is there a way to update a method on an existing Reference Class object?

2012-01-04 Thread Peder Bacher
Hi Being able to do object oriented programming in R is really good. I now started using the Reference Classes and really like it. Though, I have one problem: I cannot find a way to update a method on an existing object. The flexibility that scripting gives (really needed for interactive data an

Re: [R] Getting Sphericity Tests for Within Subject Repeated Measure Anova (using "car" package)

2012-01-04 Thread John Fox
Dear Max, I'm having a little trouble following what you did and am also confused by the subject of your posting. Is this a response to another message? Is it really about getting sphericity tests? In addition: (1) Why are you adding together the response matrices cbind(umsatz_t1, umsatz_t2,

Re: [R] Warning message about closing a connection XXXX

2012-01-04 Thread David Winsemius
On Jan 4, 2012, at 9:53 AM, Dan Abner wrote: Hello everyone, After running the following code, I obtain this error message. mydata <- read.table(textConnection(mystring), +header=TRUE, sep=",", +row.names="id", na.strings=" ") mydata Warning message: closing unused connection 3 (

[R] Warning message about closing a connection XXXX

2012-01-04 Thread Dan Abner
Hello everyone, After running the following code, I obtain this error message. > mydata <- read.table(textConnection(mystring), +header=TRUE, sep=",", +row.names="id", na.strings=" ") > mydata Warning message: closing unused connection 3 (mystring) = However, when I attempt to run

Re: [R] RODBC installation: error message

2012-01-04 Thread Marc Schwartz
On Jan 4, 2012, at 8:02 AM, Milan Bouchet-Valat wrote: > Le mardi 03 janvier 2012 à 11:39 -0800, gregory benison a écrit : >> If one attempts to install RODBC (via install.packages('RODBC')) >> without having an ODBC driver installed, this error message results: >> >> checking sqlext.h presence..

Re: [R] KS and AD test for Generalized PAreto and Generalized Extreme value

2012-01-04 Thread David Winsemius
On Jan 4, 2012, at 5:49 AM, Vincy Pyne wrote: Dear R helpers, I need to use KS and AD test for Generalized Pareto and Generalized extreme value. When I searched on these names "Generalized Pareto" and "Generalized extreme value" I got plenty of hits (over 90 in one case and over 100 i

Re: [R] Using a mathematical expression in sapply() XXXX

2012-01-04 Thread peter dalgaard
On Jan 4, 2012, at 14:57 , Milan Bouchet-Valat wrote: > Le mercredi 04 janvier 2012 à 08:41 -0500, Dan Abner a écrit : >> Hello everyone, >> >> I have the following call to sapply() and error message. Is the most >> efficient way to deal with this to make sum(!is.na(x)) a function in a >> separa

Re: [R] Getting Sphericity Tests for Within Subject Repeated Measure Anova (using "car" package)

2012-01-04 Thread Michael Friendly
On 1/3/2012 9:36 PM, maximilian.mueller wrote: Here is the syntax: options(contrasts=c("contr.sum", "contr.poly")) read.csv2("test21.csv") -> dat3 mod3 <- lm(cbind(umsatz_t1, umsatz_t2, umsatz_t3, umsatz_t4) + cbind(ebitda_t1, ebitda_t2, ebitda_t3, ebitda_t4) + ~ 1, data=dat3) idata3 <

Re: [R] Linear regression using matrices

2012-01-04 Thread Mark Sanderson
OK thanks. In my case I think it might be possible to work around this by reshaping my data and then using lmlist() to run separate regressions for each data group. lmlist() is new to me but it looks like it will do the job. -- View this message in context: http://r.789695.n4.nabble.com/Linear-

Re: [R] Using a mathematical expression in sapply() XXXX

2012-01-04 Thread Meyners, Michael
Dan, It depends on what you want to achieve. I suspect you just want to remove missing values before summing; if so, consider sapply(x, sum, na.rm=TRUE) instead. To make your code running, try sapply(x, function(x) sum(!is.na(x))) However, this would just count the number of non-missing value

[R] Update method on existing reference class object

2012-01-04 Thread Peder Bacher
Hi Being able to do object oriented programming in R is really good. I now started using the Reference Classes and really like it. Though, I have one problem: I cannot find a way to update a method on an existing object. The flexibility that scripting gives (really needed for interactive data an

Re: [R] RODBC installation: error message

2012-01-04 Thread Milan Bouchet-Valat
Le mardi 03 janvier 2012 à 11:39 -0800, gregory benison a écrit : > If one attempts to install RODBC (via install.packages('RODBC')) > without having an ODBC driver installed, this error message results: > > checking sqlext.h presence... no > checking for sqlext.h... no > configure: error: "ODBC h

Re: [R] Using a mathematical expression in sapply() XXXX

2012-01-04 Thread R. Michael Weylandt
On Jan 4, 2012, at 7:41 AM, Dan Abner wrote: > Hello everyone, > > I have the following call to sapply() and error message. Is the most > efficient way to deal with this to make sum(!is.na(x)) a function in a > separate line prior to this call? Yes or inline using an anonymous/lambda function

Re: [R] simulating stable VAR process

2012-01-04 Thread statquant2
More specifically. I know that a condition for a VAR(p) process to be stable (weakly stationary) is that the companion form of the equation (see AWESOME Pfaff book analysis of integrated and cointegrated time series in R) as eigenvalues of modulus <1. My problem is that I want to generate such pr

[R] simulating stable VAR process

2012-01-04 Thread statquant2
Hello all, I looking at package dse or vars or mAr I know how to simulate a VAR(p) process, my problem is that most of those processes are unstable (not weakly stationary). Do anybody know how to generate a random VAR (or VARMA even better) process that is weakly stationary? Thanks -- View this m

Re: [R] Using a mathematical expression in sapply() XXXX

2012-01-04 Thread Milan Bouchet-Valat
Le mercredi 04 janvier 2012 à 08:41 -0500, Dan Abner a écrit : > Hello everyone, > > I have the following call to sapply() and error message. Is the most > efficient way to deal with this to make sum(!is.na(x)) a function in a > separate line prior to this call? If not, please advise. > > N.Valid

  1   2   >