[R] Summary.Formula: prmsd and test statistic

2011-05-15 Thread Eli Kamara
Hello, I'm a new user to R so apologies if this is a basic question, but after scouring the web on information for summary.formula, I still am searching for an answer. I made a function to analyze my data - I have a categorical variable and three continuous variables. I am analyzing my

Re: [R] Unexpected behaviour as.data.frame

2011-05-15 Thread Jan van der Laan
Forget I asked. There was a typo in my example (stringsAsFactor instead of stringAsFactors) which explained the difference. My apologies. My second question however still stands: How does on create a data.frame with given column types and given dimensions? Thanks. Regards, Jan Quoting

[R] changing the day of the week in dates format

2011-05-15 Thread Dave Evens
Dear all, I have a question related to the POSIXlt function in R. I have a set of dates and times, for exmaple: startx - as.POSIXct(2011-01-01 00:00:00) finx - as.POSIXct(2011-12-31 00:00:00) daysx- seq(startx, finx, by=24 hours) I want to change the dates of all the days falling on a

Re: [R] help with mysql and R: partitioning by quintile

2011-05-15 Thread gj
Here's how I'm trying to solve the diversity problem inherent in the data (see below for a definition of the problem): if (interquintile ranges have =4 ranges at the same freq) then (use rating=3) else (use rating as described in jim's code) i'll have a go and post an update. in the mean time, if

Re: [R] L'abbe plot

2011-05-15 Thread Jim Lemon
On 05/14/2011 07:20 AM, whitney.mel...@colorado.edu wrote: I cannot seem to get a L'abbe plot to work on R. I do not understand what the X coordinates, or alternatively an object of class metabin, is supposed to mean. What is a class of metabin? Hi Whitney, The L'Abbe plot is a relatively

[R] Low Pain Unicode Characters in pdf graph?

2011-05-15 Thread ivo welch
Dear R-experts---is there a relatively low-pain way to get unicode characters into a plot to a pdf device? pdf(file=cardsymbols.pdf) plot( 0, xlim=c(0,5), ylim=c(0,5), type=n) text(1,1, spades;) text(2,2, hearts;) text(3,3, diams;) text(4,4, clubs;) dev.off() (these are the characters that I

Re: [R] Find String Between Characters

2011-05-15 Thread Sparks, John James
Hi Jim, Thanks for your note. Unfortunately, when I attempt your solution in my exact setting, I get a weird and slightly different answer. First, let me be more clear. What I am attempting to do is pull the CIK number out of the information from the web page itself after it has loaded to R

[R] Question on approximations of full logistic regression model

2011-05-15 Thread khosoda
Hi, I am trying to construct a logistic regression model from my data (104 patients and 25 events). I build a full model consisting of five predictors with the use of penalization by rms package (lrm, pentrace etc) because of events per variable issue. Then, I tried to approximate the full model

Re: [R] problem with makeSOCKcluster depending on R patch version

2011-05-15 Thread Uwe Ligges
On 15.05.2011 12:27, Søren Højsgaard wrote: That raises another question: Will that patched version (2011-05-13 r55886) be made available as a windows binary - and if so: when? Daily builds for WIndows of R-patched are available from CRAN. Best, uwe Regards Søren

[R] Unexpected behaviour as.data.frame

2011-05-15 Thread Jan van der Laan
I use the following code to create two data.frames d1 and d2 from a list: types - c(integer, character, double) nlines - 10 d1 - as.data.frame(lapply(types, do.call, list(nlines)), stringsAsFactor=FALSE) l2 - lapply(types, do.call, list(nlines)) d2 - as.data.frame(l2,

Re: [R] problem with makeSOCKcluster depending on R patch version

2011-05-15 Thread Søren Højsgaard
That raises another question: Will that patched version (2011-05-13 r55886) be made available as a windows binary - and if so: when? Regards Søren Fra: r-help-boun...@r-project.org [r-help-boun...@r-project.org] P#229; vegne af Uwe Ligges

[R] R function that returns an object's search path position XXXX

2011-05-15 Thread Dan Abner
Hello everyone, Is there an R function that returns an object's search path position? Thank you, Dan [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the

Re: [R] Summary.Formula: prmsd and test statistic

2011-05-15 Thread David Winsemius
On May 14, 2011, at 11:23 AM, Eli Kamara wrote: Hello, I'm a new user to R so apologies if this is a basic question, but after scouring the web on information for summary.formula, I still am searching for an answer. I made a function to analyze my data - I have a categorical variable

Re: [R] Low Pain Unicode Characters in pdf graph?

2011-05-15 Thread David Winsemius
On May 15, 2011, at 9:06 AM, ivo welch wrote: Dear R-experts---is there a relatively low-pain way to get unicode characters into a plot to a pdf device? pdf(file=cardsymbols.pdf) plot( 0, xlim=c(0,5), ylim=c(0,5), type=n) text(1,1, spades;) text(2,2, hearts;) text(3,3, diams;) text(4,4,

[R] DCC-GARCH model

2011-05-15 Thread Marcin P?�ciennik
Hello, I have a few questions concerning the DCC-GARCH model and its programming in R. So here is what I want to do: I take quotes of two indices - SP500 and DJ. And the aim is to estimate coefficients of the DCC-GARCH model for them. This is how I do it: library(tseries) p1 =

Re: [R] Low Pain Unicode Characters in pdf graph?

2011-05-15 Thread Dennis Murphy
Hi: For your specific problem, one way is: plot( 0, xlim=c(0,5), ylim=c(0,5), type=n, cex = 2) text(1, 1, expression(symbol('\252'))) text(2, 2, expression(symbol('\251'))) text(3, 3, expression(symbol('\250'))) text(4, 4, expression(symbol('\247'))) More generally, David's advice is sound; see

Re: [R] problem with makeSOCKcluster depending on R patch version

2011-05-15 Thread Søren Højsgaard
I just downloaded the patched version from the Danish mirror; http://mirrors.dotsrc.org/cran/ That gave me: R version 2.13.0 Patched (2011-05-10 r55826) - which is *not* the version you refer to. Where may one get the latest patch then? Regards Søren

Re: [R] changing the day of the week in dates format

2011-05-15 Thread Adrian Duffner
Hi Dave, your problem is that you are working with a S3 class, what is mainly a list with naming convention. Hence it is possible to change just one entry of the list, but it is nearly never recommendable. So a slight change to your code should provide you the required output:

[R] hotelling and confidence region

2011-05-15 Thread jm_jem
Good morning I've made an PCA and I'd like to plot a confidence region based on Hotelling T2? Does anyone know how to compute it? Thank you -- View this message in context: http://r.789695.n4.nabble.com/hotelling-and-confidence-region-tp3524204p3524204.html Sent from the R help mailing list

[R] integrate

2011-05-15 Thread meltem gölgeli
Dear R-users, I'am really new at R. That's why I probably have a basic quastion. I have a function like f(x,y)=\int^{0}_{y}(2*x)*exp(y-t)dt or f(x,y)=\int^{0}_{y}((2*x)*exp(\int^{0}_{t}(x*k)dk)dt and I can also define some basic loops for xy like x in 1:3 and y in 1:2. Could anybody please help

Re: [R] Unexpected behaviour as.data.frame

2011-05-15 Thread Bert Gunter
In your post, you're missing the final s on the stringsAsFactors argument in the d1 assignment. When I typed it correctly, it works as expected. -- Bert On Sun, May 15, 2011 at 4:25 AM, Jan van der Laan rh...@eoos.dds.nl wrote: I use the following code to create two data.frames d1 and d2 from a

Re: [R] Powerful PC to run R

2011-05-15 Thread Gabor Grothendieck
On Fri, May 13, 2011 at 6:38 AM, Michael Haenlein haenl...@escpeurope.eu wrote: I'm currently running R on my laptop -- a Lenovo Thinkpad X201 (Intel Core i7 CPU, M620, 2.67 Ghz, 8 GB RAM). The problem is that some of my calculations run for several days sometimes even weeks (mainly simulations

Re: [R] Powerful PC to run R

2011-05-15 Thread Spencer Graves
Also: A previous post in this tread suggested Rprof [sec. 3.2 in Writing R Extensions, available via help.start()]. This should identify the functions that consume the most time. The standard procedure to improve speed is as follows: 1. Experiment with different ways of computing

[R] Again on Data Mining

2011-05-15 Thread Lorenzo Isella
Dear All, I have already posted before on the list about data mining and it has proved very useful. I have now a training dataset consisting of N objects of MN different kinds (actually, M is usually 3 to 5, whereas N is of the order of 1000). Every object has its own label L_i, i=1...N, that

Re: [R] changing the day of the week in dates format

2011-05-15 Thread Adrian Duffner
Dear Dave, please always answer to the whole list. To answer your question: A quick check showed that your proposed code will not work as you expected it tt - as.POSIXlt(strptime(2011-01-01 00:00:00, %Y-%m-%d %H:%M:%S, tz=GMT)) tt [1] 2011-01-01 GMT tt+ 365.25*24*60*60 [1] 2012-01-01

Re: [R] R function that returns an object's search path position XXXX

2011-05-15 Thread Duncan Murdoch
On 14/05/2011 9:41 PM, Dan Abner wrote: Hello everyone, Is there an R function that returns an object's search path position? Does find() do what you want? It doesn't give the position in the search path, but you could get that from something like name - plot which( search() %in%

Re: [R] Unexpected behaviour as.data.frame

2011-05-15 Thread Jan van der Laan
Thanks. I also noticed myself minutes after sending my message to the list. My 'please ignore my question it was just a stupid typo' message was sent with the wrong account and is now awaiting moderation. However, my other question still stands: what is the preferred/fastest/simplest way to

Re: [R] Powerful PC to run R

2011-05-15 Thread Henrik Bengtsson
On Sun, May 15, 2011 at 9:31 AM, Spencer Graves spencer.gra...@structuremonitoring.com wrote: Also:  A previous post in this tread suggested Rprof [sec. 3.2 in Writing R Extensions, available via help.start()]. This should identify the functions that consume the most time.  The standard

Re: [R] integrate

2011-05-15 Thread David Winsemius
On May 15, 2011, at 6:51 AM, meltem gölgeli wrote: Dear R-users, I'am really new at R. That's why I probably have a basic quastion. I have a function like f(x,y)=\int^{0}_{y}(2*x)*exp(y-t)dt or f(x,y)=\int^{0}_{y}((2*x)*exp(\int^{0}_{t}(x*k)dk)dt and I can also define some basic loops for

Re: [R] Find String Between Characters

2011-05-15 Thread William Dunlap
It looks like you can get the text of the document with as(mmm[[1]], character) and you can use grep, strsplit, gsub, etc. on that text. Look at the functions in the XML pacakge for ways to use the XML structure of the data instead of pattern matching to extract meaningful parts of the

Re: [R] Summary.Formula: prmsd and test statistic

2011-05-15 Thread Eli Kamara
I tried the modification but no luck. Here is exactly what I'm seeing. The command works fine, but when I add prmsd=TRUE the numbers disappear. print(summary.formula(S~Kyph+Vert, data=radio, method=reverse, overall=T, continuous=5, add=TRUE, test=T)) Descriptive Statistics by S

Re: [R] changing the day of the week in dates format

2011-05-15 Thread Dave Evens
Hi Adrian, Many thanks for your reply. Suppose I wanted to increment the date by a year - how would I account for things like leap years? Would I just do mydaysx[select] - mydaysx[select] + 365.25*24*60*60 Regards,Dave From: Adrian Duffner

Re: [R] Row names and matrixs

2011-05-15 Thread nielsen4897
Thank you - it is refreshing to have a helpful answer. I am glad some people remember the days when they were first learning too. On Thu, May 12, 2011 at 4:58 PM, jlemaitre [via R] ml-node+3518836-766936252-236...@n4.nabble.com wrote: Nielsen, The numbers in the brackets reference a

[R] pls help: lattice graph with both negative and positive value, x and y cross at 0 and negative value bars are plotted just oppositive direction in contrast to positive

2011-05-15 Thread Ram H. Sharma
Dear R experts: Here is my problem: #Data 1 Y - c(0.5, 0.1, 0.5, 1.3, 1.4, 1.6, 1.65, 2.4, 2.6, 3.4, 3.6, 4.3, 4.42, 4.8, 4.7, 3.4, 3.3, 2.8, 2.8, 1.2, 1.1, 0.5, 0.2, 0.1, -0.2, -1.5, -2.5, -1.3, -0.5, -0.1) X - seq(1:30) X1 - c(rep(T1, 24), rep(T2, 6)) dat1 - data.frame(Y, X, X1)

[R] Adding dates to time series

2011-05-15 Thread Bazman76
Hi there, I have a spreadsheet in excel which consists of first column of dates and then subsequent columns that refer to prices of different securities on those dates. (the first row contains each series name) I saved the excel file as type csv and then imported to excel using

[R] Need help with text processing / string split

2011-05-15 Thread eric
I used screen scraping to extract some information and put it into a table called tbl. Now I want to modify the table a bit so the data can be more useful. Here's the code I used: library(XML) rm(list=ls()) url - http://webapp.montcopa.org/sherreal/salelist.asp?saledate=05/25/2011; tbl

Re: [R] Powerful PC to run R

2011-05-15 Thread Aram Fingal
On May 13, 2011, at 6:38 AM, Michael Haenlein wrote: Dear all, I'm currently running R on my laptop -- a Lenovo Thinkpad X201 (Intel Core i7 CPU, M620, 2.67 Ghz, 8 GB RAM). The problem is that some of my calculations run for several days sometimes even weeks (mainly simulations over a

Re: [R] Unexpected behaviour as.data.frame

2011-05-15 Thread Bert Gunter
Inline below. On Sun, May 15, 2011 at 11:11 AM, Jan van der Laan rh...@eoos.dds.nl wrote: Thanks. I also noticed myself minutes after sending my message to the list. My 'please ignore my question it was just a stupid typo' message was sent with the wrong account and is now awaiting moderation.

Re: [R] Powerful PC to run R

2011-05-15 Thread Duncan Murdoch
On 15/05/2011 3:02 PM, Aram Fingal wrote: On May 13, 2011, at 6:38 AM, Michael Haenlein wrote: Dear all, I'm currently running R on my laptop -- a Lenovo Thinkpad X201 (Intel Core i7 CPU, M620, 2.67 Ghz, 8 GB RAM). The problem is that some of my calculations run for several days sometimes

Re: [R] pls help: lattice graph with both negative and positive value, x and y cross at 0 and negative value bars are plotted just oppositive direction in contrast to positive

2011-05-15 Thread Dennis Murphy
Hi: Try this: barchart(Y ~ factor(X), group = X1, data = dat1, col = mcol, origin = 0, ylab= y var, xlab = x var, ylim = c(-3.0, 5.0), scales = list(x=list(rot= 90, font = 1, cex = 1) , y = list(rot= 90, font = 1, cex = 1) )) The origin = argument

Re: [R] Adding dates to time series

2011-05-15 Thread Dennis Murphy
Hi: I'd suggest using the zoo package; it allows you to use an index vector such as dates to map to the series. It is well documented and well maintained, with vignettes and an FAQ that can be found on its package help page (among other places). Here is a small example: dd - data.frame(time =

Re: [R] Need help with text processing / string split

2011-05-15 Thread jim holtman
try this: x - read.table('/temp/tbl.txt', sep = ',', header = TRUE, as.is = TRUE) # remove commas from the Cost column x$Cost - gsub(',', '', x$Cost) # split the Cost temp - strsplit(x$Cost, \\$) # $ is special, so it is escaped temp - do.call(rbind, temp) # create a matrix mode(temp) -

Re: [R] Find String Between Characters

2011-05-15 Thread jim holtman
I would assume that you have lines of text that do not include 'CIK=' and therefore the 'sub' fails and you get the original string. If you only want the lines with CIK, then use 'grepl' to just extract those lines before processing. On Sat, May 14, 2011 at 10:14 PM, Sparks, John James

Re: [R] how to merge within range?

2011-05-15 Thread Kenn Konstabel
I'd've first said it's simply sapply(df1$time, function(x) if(any(foo - (x=df2$from x=df2$to))0) df2$value[which(foo)] else NA ) but the following are much nicer (except that instead of NA you'll have 0 but that's easy to change if necessary): colSums(sapply(df1$time, function(x) (x=df2$from

Re: [R] changing the day of the week in dates format

2011-05-15 Thread jim holtman
What is it that you want to do? If you move the dates forward a year, then what does it mean to add one year to 2/29/2008? You did mention accounting for leap year. It goes the other way with 2/28/2007 and 3/1/2007; what is your expectation in these cases? You can always convert everything to

Re: [R] R function that returns an object's search path position XXXX

2011-05-15 Thread Rolf Turner
On 15/05/11 13:41, Dan Abner wrote: Hello everyone, Is there an R function that returns an object's search path position? ?find cheers, Rolf Turner __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help

Re: [R] problem converting character to dates

2011-05-15 Thread Assu
I have imported the data fram Excel and it comes like this: Calendar Year/Month 01.2008 01.2008 01.2008 01.2008 01.2008 02.2008 02.2008 Calendar year / week01.2008 02.2008 03.2008 04.2008 05.2008 05.2008 06.2008 There are repeats in the weeks both belonging to two months. It's the same

Re: [R] High standard error

2011-05-15 Thread superduperfly
Significant or not you should look at the p-value of your coefficient estimation. If your prob. is significantly diff. from zero, you start to interpret your coefficient from there. Might help to look up Std.Err definition, its is some what similar to the standard deviation. Good luck. -- View

Re: [R] Snow/Snowfall hangs on windows 7

2011-05-15 Thread David Anisman
Same problem as Anna here. Windows 7 64-bit. Running R 2.13.0. snow + snowfall installed. Testing: library(snow) library(snowfall) sfInit(parallel=TRUE, cpus=2, type=SOCK) Then R spins forever (yes, I disabled the Windows firewall). On the same box, tried the same on Ubuntu under Virtualbox.

Re: [R] Adding dates to time series

2011-05-15 Thread Bazman76
OK I got it to work thanks to your example plot(ser) however, ultiamtely a I need a stype ts object. So I used xts - as.ts(ser) xts Time Series: Start = 1 End = 732 Frequency = 1 which just gets me back to where I started with the correct raw data but no attached dates? It is possible

Re: [R] Adding dates to time series

2011-05-15 Thread Bazman76
additional!! I now realise that the time series created below is in the wrong order! clearly the column of dates are not being interpreted as dates by the R. Is is possible for R to read column one as dates? how can I do this? dd-data.frame(prices[,1],prices[,2]) head(dd,3) prices...1.

[R] rbind with partially overlapping column names

2011-05-15 Thread Jonathan Flowers
Hello, I would like to merge two data frames with partially overlapping column names with an rbind-like operation. For the follow data frames, df1 - data.frame(a=c(A,A),b=c(B,B)) df2 - data.frame(b=c(b,b),c=c(c,c)) I would like the output frame to be (with NAs where the frames don't overlap)

Re: [R] rbind with partially overlapping column names

2011-05-15 Thread Ian Gow
Hi: This is a bit of a kluge, but works for your test case: df2[,setdiff(names(df1),names(df2))] - NA df1[,setdiff(names(df2),names(df1))] - NA df3 - rbind(df1,df2) df3 a b c 1 A B NA 2 A B NA 3 NA b c 4 NA b c -Ian On 5/15/11 7:41 PM, Jonathan Flowers jonathanmflow...@gmail.com wrote:

Re: [R] Adding dates to time series

2011-05-15 Thread Gabor Grothendieck
On Sun, May 15, 2011 at 2:42 PM, Bazman76 h_a_patie...@hotmail.com wrote: Hi there, I have a spreadsheet in excel which consists of first column  of dates and then subsequent columns that refer to prices of different securities on those dates. (the first row contains each series name) I

Re: [R] rbind with partially overlapping column names

2011-05-15 Thread Dennis Murphy
Hi: Another way, with a little less typing but using the same principle, is df1$c - df2$a - NA rbind(df1, df2) Dennis On Sun, May 15, 2011 at 5:50 PM, Ian Gow iand...@gmail.com wrote: Hi: This is a bit of a kluge, but works for your test case: df2[,setdiff(names(df1),names(df2))] - NA

Re: [R] Snow/Snowfall hangs on windows 7

2011-05-15 Thread David Anisman
btw, I installed R.10.1 on the same box (Windows 7, 64bit, 4 cores). snow/snowfall work fine. here is my sessionInfo() R version 2.10.1 (2009-12-14) i386-pc-mingw32 locale: [1] LC_COLLATE=English_United States.1252 [2] LC_CTYPE=English_United States.1252 [3] LC_MONETARY=English_United

Re: [R] Question on approximations of full logistic regression model

2011-05-15 Thread Frank Harrell
I think you are doing this correctly except for one thing. The validation and other inferential calculations should be done on the full model. Use the approximate model to get a simpler nomogram but not to get standard errors. With only dropping one variable you might consider just running the

Re: [R] rbind with partially overlapping column names

2011-05-15 Thread William Dunlap
-Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of Jonathan Flowers Sent: Sunday, May 15, 2011 5:41 PM To: r-help@r-project.org Subject: [R] rbind with partially overlapping column names Hello, I would like to merge two

[R] Extracting the dimnames of an array with variable dimensions

2011-05-15 Thread Pierre Roudier
Hi list, In a function I am writing, I need to extract the dimension names of an array. I know this can be acheived easily using dimnames() but my problem is that I want my function to be robust when the number of dimensions varies. Consider the following case: foo - array(data = rnorm(32), dim

Re: [R] rbind with partially overlapping column names

2011-05-15 Thread Ian Gow
That approach relies on df1 and df2 not having overlapping values in b. Slight variation in df2 gives different results: df1 - data.frame(a=c(A,A),b=c(B,B)) df2 - data.frame(b=c(B,B),c=c(c,c)) merge(df1,df2,all=TRUE) b a c 1 B A c 2 B A c 3 B A c 4 B A c On 5/15/11 11:19 PM, William Dunlap

Re: [R] Question on approximations of full logistic regression model

2011-05-15 Thread khosoda
Thank you for your reply, Prof. Harrell. I agree with you. Dropping only one variable does not actually help a lot. I have one more question. During analysis of this model I found that the confidence intervals (CIs) of some coefficients provided by bootstrapping (bootcov function in rms

Re: [R] graphs of gamma, normal fit to a histogram are about half as large as they should be

2011-05-15 Thread Benjamin Caldwell
Hmm; still missing something - hist defaults to frequencies, not prob. densities; and, I thought I'd scaled the fitted lines to the values in the data frame. Just going with it, I specified freq=FALSE, and the prob density was of course at a different order of magnitude than the lines. What are

Re: [R] Extracting the dimnames of an array with variable dimensions

2011-05-15 Thread Dennis Murphy
Hi: Does it have to be an array? If all you're interested in is the dimnames, how about this? library(plyr) foo - array(data = rnorm(32), dim = c(4,4,2), dimnames=list(letters[1:4], LETTERS[1:4], letters[5:6])) foo , , e A B C D a

Re: [R] Powerful PC to run R

2011-05-15 Thread Prof Brian Ripley
On Sun, 15 May 2011, Duncan Murdoch wrote: On 15/05/2011 3:02 PM, Aram Fingal wrote: On May 13, 2011, at 6:38 AM, Michael Haenlein wrote: Dear all, I'm currently running R on my laptop -- a Lenovo Thinkpad X201 (Intel Core i7 CPU, M620, 2.67 Ghz, 8 GB RAM). The problem is that some of my

Re: [R] graphs of gamma, normal fit to a histogram are about half as large as they should be

2011-05-15 Thread Rolf Turner
In your example it appears that you are plotting a histogram (on the frequency scale) and then superimposing scalar multiples of gamma and Gaussian densities. You should just plot a histogram (with frequency=FALSE) and then superimpose the densities --- without any scalar multipliers. If

Re: [R] Extracting the dimnames of an array with variable dimensions

2011-05-15 Thread Pierre Roudier
Hi Dennis, Thanks for your answer, it works very well - clever way to sort the problem! Cheers, Pierre 2011/5/16 Dennis Murphy djmu...@gmail.com: Hi: Does it have to be an array?  If all you're interested in is the dimnames, how about this? library(plyr) foo - array(data = rnorm(32),