Re: [R] Find String Between Characters

2011-05-14 Thread jim holtman
Is this what you want: > mmm<-"http://www.sec.gov/cgi-bin/browse-edgar?action=getcompany&CIK=320193&owner=exclude&count=40"; > num <- sub("^.*CIK=([0-9]+).*", "\\1", mmm) > num [1] "320193" > On Sat, May 14, 2011 at 8:20 PM, Sparks, John James wrote: > Dear R Helpers, > > I am trying to

[R] Find String Between Characters

2011-05-14 Thread Sparks, John James
Dear R Helpers, I am trying to isolate a set of characters between two other characters in a long string file. I tried some of the examples on the R help pages and elsewhere, but I am not able to get it. Your help would be much appreciated. require(scrapeR) mmm<-scrape(url="http://www.sec.gov/c

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

2011-05-14 Thread gj
Jim's suggestion did the trick: tqm <- do.call(rbind, tq) + 0.001 head(x.new) userid freq track rating [1,] 11 1 1 [2,] 1 10 2 5 [3,] 11 3 1 [4,] 11 4 1 [5,] 1 15 5 5 [6,] 14 6 3 Dennis, w

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

2011-05-14 Thread jim holtman
An easy way is to just offset the quantiles by a small increment so that boundary condition is less likely. If you change the line tqm <- do.call(rbind, tq) + 0.001 in my example, that should do the trick. On Sat, May 14, 2011 at 6:09 PM, gj wrote: > Hi, > I think I haven't been able to explai

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

2011-05-14 Thread gj
Hi, I think I haven't been able to explain correctly what I want. Here another try: Given that I have the following input: userid,track,freq 1,1,1 1,2,10 1,3,1 1,4,1 1,5,15 1,6,4 1,7,16 1,8,6 1,9,1 1,10,1 1,11,2 1,12,2 1,13,1 1,14,6 1,15,7 1,16,13 1,17,3 1,18,2 1,19,5 1,20,2 1,21,2 1,22,6 1,23,4 1

Re: [R] Identify Objects that end with .f (and all caps)

2011-05-14 Thread David Winsemius
On May 14, 2011, at 3:57 PM, David Winsemius wrote: On May 14, 2011, at 3:38 PM, Sparks, John James wrote: Dear R Helpers, I am trying to find a way to identify all the objects in my environment that are all caps and then end with .f. I can do the all caps part pretty easily, but I hav

Re: [R] Identify Objects that end with .f (and all caps)

2011-05-14 Thread David Winsemius
On May 14, 2011, at 3:38 PM, Sparks, John James wrote: Dear R Helpers, I am trying to find a way to identify all the objects in my environment that are all caps and then end with .f. I can do the all caps part pretty easily, but I have tried a number of variations on the \ and can't get

[R] Identify Objects that end with .f (and all caps)

2011-05-14 Thread Sparks, John James
Dear R Helpers, I am trying to find a way to identify all the objects in my environment that are all caps and then end with .f. I can do the all caps part pretty easily, but I have tried a number of variations on the \ and can't get a recognition of that operator. As a simple example A.f<-"foo1

Re: [R] timezone specification on windows machine

2011-05-14 Thread David Winsemius
On May 14, 2011, at 2:51 PM, Robert A'gata wrote: Hi, I'm wondering what's the right value for specifying "America/New_York" time zone on a windows machine? I got my code which specify this time zone on as.POSIXct function work properly with this value on a linux machine. But it keeps giving m

Re: [R] R Audio Problems when using Vista/Windows 7

2011-05-14 Thread Uwe Ligges
I found this rather old but unanswered message in my archives. On 10.01.2011 00:07, d10sfan wrote: Ive been trying to help someone with using R scripts with audio on Windows Vista/7. The problem is that all the packages Ive tried fail to work properly when being used on Windows 7. I couldnt g

Re: [R] timezone specification on windows machine

2011-05-14 Thread Jeff Newmiller
On Sat, 14 May 2011, Robert A'gata wrote: Hi, I'm wondering what's the right value for specifying "America/New_York" time zone on a windows machine? I got my code which specify this time zone on as.POSIXct function work properly with this value on a linux machine. But it keeps giving me complai

Re: [R] how to merge within range?

2011-05-14 Thread René Mayer
sqldf is impressive - compiled it now; the trick with findInterval is nice, too. thanks guys!! Zitat von "David Winsemius" : On May 14, 2011, at 2:27 PM, William Dunlap wrote: You could use findInterval() along with a trick with c(rbind(...)): i <- findInterval(x=df.1$time, vec=c(rbind(

[R] timezone specification on windows machine

2011-05-14 Thread Robert A'gata
Hi, I'm wondering what's the right value for specifying "America/New_York" time zone on a windows machine? I got my code which specify this time zone on as.POSIXct function work properly with this value on a linux machine. But it keeps giving me complaint on windows. Thank you. Cheers, Robert _

Re: [R] how to merge within range?

2011-05-14 Thread David Winsemius
On May 14, 2011, at 2:27 PM, William Dunlap wrote: You could use findInterval() along with a trick with c(rbind(...)): i <- findInterval(x=df.1$time, vec=c(rbind(df.2$from, df.2$to))) i [1] 1 1 1 2 3 3 3 5 5 6 That's nice. I was working on a slightly different "trick" findInterval( df.1[,

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

2011-05-14 Thread Dennis Murphy
Hi: Is this what you're after? tq <- with(ds, quantile(freq, seq(0.2, 1, by = 0.2))) ds$int <- with(ds, cut(freq, c(0, tq))) with(ds, table(int)) int (0,1] (1,2] (2,4] (4,7] (7,16] 10 6 7 6 6 HTH, Dennis On Sat, May 14, 2011 at 9:42 AM, gj wrote: > Hi Jim, > Thanks

Re: [R] how to merge within range?

2011-05-14 Thread William Dunlap
You could use findInterval() along with a trick with c(rbind(...)): > i <- findInterval(x=df.1$time, vec=c(rbind(df.2$from, df.2$to))) > i [1] 1 1 1 2 3 3 3 5 5 6 The even-valued outputs would map to NA's, the odds to value[(i+1)/2], but you can use the c(rbind(...)) trick again: > c(rbind(df.2

Re: [R] how to merge within range?

2011-05-14 Thread Ian Gow
René: I don't see the "two merges" way either. Here's the sqldf way. (SQLite, like most SQL systems, doesn't like "." in table names and "from" is an SQL keyword, so I made changes accordingly. I also hard-coded df_1.) > install.packages("sqldf") # Output suppressed here > library(sqldf) > df_1 <

Re: [R] how to merge within range?

2011-05-14 Thread René Mayer
thanks David and Ian, let me make a better example as the first one was flawed df.1=data.frame(round((1:10)*100+rnorm(10)), value=NA) names(df.1) = c("time", "value") df.1 time value 1 101NA 2 199NA 3 301NA 4 401NA 5 501NA 6 601NA 7 700NA 8 800NA

Re: [R] how to merge within range?

2011-05-14 Thread David Winsemius
On May 14, 2011, at 9:16 AM, Ian Gow wrote: If I assume that the third column in data.frame.2 is named "val" then in SQL terms it _seems_ you want SELECT a.time, b.val FROM data.frame.1 AS a LEFT JOIN data.frame.2 AS b ON a.time BETWEEN b.start AND b.end; Not sure how to do that elegantl

Re: [R] Survival Rate Estimates

2011-05-14 Thread David Winsemius
On May 13, 2011, at 8:49 AM, Terry Therneau wrote: ---begin included message -- Is there an automated way to use the survival package to generate survival rate estimates and their standard errors? To be clear, *not *the survivorship estimates (which are cumulative), but the survival *rate *

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

2011-05-14 Thread gj
Hi Jim, Thanks very much for the code. I modified it a bit because I needed to allocate the track ratings by userid (eg if user 1 plays track x once, he gets rating 1, user 1 plays track y 100 times, he gets a rating 5) and not by track (sorry if this wasn't clear in my original post). This is alm

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

2011-05-14 Thread Uwe Ligges
On 13.05.2011 14:01, Ulrich Halekoh wrote: Dear, I encountered a problem using the makeSOCKcluster function depending the patched version of R-2.13.0 I used. library(snow) cl<- makeSOCKcluster(rep("localhost", 2)) this works fine for the R-13.0 patch (2011-04-28 r55678) but not for the pat

[R] Get access to my pictures and more

2011-05-14 Thread Robert Kopp
Hey, I have created a Netlog profile with my pictures, videos, blogs and events and I want to add you as a friend so you can see it. You first need to register on Netlog! When you log in, you can create your own profile. Take a look: http://en.netlog.com/go/mailurl/-bT0xNzc2NTAzODA4Jmw9MSZnbT0x

Re: [R] Adding same items together in data.frame

2011-05-14 Thread John Kane
And another approach: = library(reshape2) mydata <- data.frame(aa = sample(Cs(a,b,c,d,e),10,replace=TRUE), bb = sample(1:10, 10, replace=TRUE)) (m1 <- melt(mydata)) =

Re: [R] how to merge within range?

2011-05-14 Thread Ian Gow
If I assume that the third column in data.frame.2 is named "val" then in SQL terms it _seems_ you want SELECT a.time, b.val FROM data.frame.1 AS a LEFT JOIN data.frame.2 AS b ON a.time BETWEEN b.start AND b.end; Not sure how to do that elegantly using R subsetting/merge, but you might try a packa

[R] Using dates on axis with Grid plots

2011-05-14 Thread Larry White
Hi, I'm trying to use Grid plots and would like to have an X axis that represents dates. I have several years of data so I would like to be able to have labeled tick marks only intermittently (not one per date). I can transform the initial data from a date time string into POSIXlt or POSIXct, or

Re: [R] odfWeave 0.7.17 stutters on Debian testing 64-bit amd64 systems.

2011-05-14 Thread Emmanuel Charpentier
Dear Brian, Thank you very much for this answer. However ... Le samedi 14 mai 2011 à 11:52 +0100, Prof Brian Ripley a écrit : > Note the difference in XML versions. > > odfWeave does not work correctly with XML 3.4-x: this has been > reported to the maintainer (and can be seen on the CRAN packa

Re: [R] odfWeave 0.7.17 stutters on Debian testing 64-bit amd64 systems.

2011-05-14 Thread Emmanuel Charpentier
Dear Brian, You are right (as usual...) : downgrading XML to 3.2.0 (the next-to-most-recent version) enables me to compile my minimalistic example correctly. And yes, there is no other XML than XML. Silly me... Now, I have to understand why the i386 and Ubuntu machines were *not* "upgraded" to 3

Re: [R] RMySQL problem on Windows 7 32 bit

2011-05-14 Thread Gabor Grothendieck
On Fri, May 13, 2011 at 11:06 AM, byzin wrote: > I am attempting to analyze Affymetrix exonchip data using the exon map > package.  I have installed this package but have had problems installing the > associated programs, specifically RMySQL since no windows binary exists. > > I have followed the

Re: [R] create structs in R.

2011-05-14 Thread Uwe Ligges
On 14.05.2011 13:28, Alaios wrote: Dear all, so far when I want to create a struct with a substructs I create. Lists with sublists by using functions and replicate. This will end up in to a struct that is addressed like that for (i in c(1:100){ for (j in c(1:100){ Mystruct[[1]][[2

Re: [R] (no subject)

2011-05-14 Thread John Kane
--- On Sat, 5/14/11, Ramnath R wrote: > From: Ramnath R > Subject: [R] (no subject) > To: r-help@r-project.org > Received: Saturday, May 14, 2011, 9:45 AM > Can any one help me where i can find > small standalone R programs that do > things like > scatterplot, mean/median, kernel density estim

Re: [R] Error Subscript out of bounds in ca

2011-05-14 Thread Uwe Ligges
On 13.05.2011 13:44, annekatrin...@gmx.de wrote: Hello, I want to do a simple correspondence analysis in R, using the ca package. First, I create and define a 2-by-2-table (table=table(var1,var2)), which looks like this: Low(var1) high(var1) Low(var2) 35 28 High(var2) 26

Re: [R] Uploading CSV file into R

2011-05-14 Thread John Kane
--- On Fri, 5/13/11, Me wrote: > From: Me > Subject: Re: [R] Uploading CSV file into R > To: r-help@r-project.org > Received: Friday, May 13, 2011, 10:25 PM > OK, I have another question if you > guys don't mind helping again. I have all > of the information I need in a csv file, and I've read

Re: [R] PLSR error

2011-05-14 Thread Uwe Ligges
On 13.05.2011 11:38, romzero wrote: Hi, this is my R-Script library(pls) file<- "C:\\TXT\\brix.txt" d<- as.matrix(read.table(file, header=T, sep=",", row.names = NULL)) plsdata<- data.frame(NIR=c(1:nrow(X))) plsdata$NIR<- I(d[,3:603]) plsdata$Brix<- d[,2] results<- plsr(Brix ~ NIR, data=plsdat

Re: [R] L'abbe plot

2011-05-14 Thread Uwe Ligges
On 13.05.2011 23:20, 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? Institute of Behavioral Genetics University of Colo

Re: [R] RMySQL problem on Windows 7 32 bit

2011-05-14 Thread Uwe Ligges
On 13.05.2011 17:06, byzin wrote: I am attempting to analyze Affymetrix exonchip data using the exon map package. I have installed this package but have had problems installing the associated programs, specifically RMySQL since no windows binary exists. I have followed the directions for comp

Re: [R] problem converting character to dates

2011-05-14 Thread Uwe Ligges
You have to think about if week i in the database means week i-1 in R, perhaps? Uwe Ligges On 13.05.2011 10:47, Assu wrote: Thanks Uwe, it works! I just have a problem at week 53 which gives me an NA. I guess, this week 53 has to do with the data type set at the database design and collectio

[R] (no subject)

2011-05-14 Thread Ramnath R
Can any one help me where i can find small standalone R programs that do things like: scatterplot, mean/median, kernel density estimation etc. Ram [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/ma

[R] mlogit error message "Error in X[omitlines, ] <- NA : subscript out of bounds"

2011-05-14 Thread Andrew Miles
Yong, I saw your post from April 29th about the error message in the mlogit package, copied below. I had the same problem, but solved it by omitting all missing data from my data frame before running mlogit.data(). ex. mydata = na.omit(mydata) I am posting this to the R help list as well so

Re: [R] how to merge within range?

2011-05-14 Thread David Winsemius
On May 14, 2011, at 8:12 AM, René Mayer wrote: Hello, how can one merge And what happened when you typed: ?merge two data frames when in the second data frame one column defines the start values and another defines the end value of the to be merged range. data.frame.1 time ... 13 24 35 4

[R] how to merge within range?

2011-05-14 Thread René Mayer
Hello, how can one merge two data frames when in the second data frame one column defines the start values and another defines the end value of the to be merged range. data.frame.1 time ... 13 24 35 46 55 ... data.frame.2 start end 24 37 ?h? ? ... should result in this 13 NA 24 ?h? 35 ?h? 46 N

Re: [R] Survreg object

2011-05-14 Thread Prof Brian Ripley
There is however the generic vcov(), which has a method for class "survreg". One good reason for not having a simple means to extract standard errors is that considering coefficients in isolation is often unwise (and has come up on R-help more than once already this month). The summary() met

Re: [R] odfWeave 0.7.17 stutters on Debian testing 64-bit amd64 systems.

2011-05-14 Thread Prof Brian Ripley
On Sat, 14 May 2011, Emmanuel Charpentier wrote: Dear Brian, Thank you very much for this answer. However ... Le samedi 14 mai 2011 à 11:52 +0100, Prof Brian Ripley a écrit : Note the difference in XML versions. odfWeave does not work correctly with XML 3.4-x: this has been reported to the m

Re: [R] calling "exists" function inside another function is not working

2011-05-14 Thread utkarshsinghal
Thanks David. Big help, problem solved. Regards, Utkarsh Original Message Subject: Re: [R] calling "exists" function inside another function is not working From: David Winsemius To: utkarshsinghal Cc: r help , Utkarsh Singhal Date: Sat 14 May 2011 04:00:01 PM IST

[R] create structs in R.

2011-05-14 Thread Alaios
Dear all, so far when I want to create a struct with a substructs I create. Lists with sublists by using functions and replicate. This will end up in to a struct that is addressed like that for (i in c(1:100){ for (j in c(1:100){ Mystruct[[1]][[2]][[1]][[i]][[k]]<-dosomething() } } I

Re: [R] Survreg object

2011-05-14 Thread David Winsemius
On May 14, 2011, at 5:48 AM, andre bedon wrote: Hi,Just a quick one, does anyone know the command for accessing the standard errors from a survreg object? I can access the coefficients by model$coefficients, but I cant seem to find a command to access the errors. Any help would be greatl

Re: [R] odfWeave 0.7.17 stutters on Debian testing 64-bit amd64 systems.

2011-05-14 Thread Prof Brian Ripley
Note the difference in XML versions. odfWeave does not work correctly with XML 3.4-x: this has been reported to the maintainer (and can be seen on the CRAN package checks at http://cran.r-project.org/web/checks/check_results_odfWeave.html). I suggest you try downgrading to an earlier version o

Re: [R] Changing Attribute With Paste

2011-05-14 Thread Duncan Murdoch
On 11-05-14 4:14 AM, Sparks, John James wrote: Dear R Helpers, I am trying to adjust the attribute of an R object pulled from quantmod. Since I want to do this for many such objects, I was trying to make the adjustment programmatic. Unfortunately, I am having a huge amount of trouble using attr

Re: [R] Uploading CSV file into R

2011-05-14 Thread David Winsemius
On May 13, 2011, at 10:25 PM, Me wrote: OK, I have another question if you guys don't mind helping again. I have all of the information I need in a csv file, and I've read the csv file into R, but I'm having some trouble manipulating it. In the past, I've always manipulated data that was pr

Re: [R] calling "exists" function inside another function is not working

2011-05-14 Thread David Winsemius
On May 14, 2011, at 3:30 AM, utkarshsinghal wrote: Hi all, I want to define a function such that one of its argument if passed do one thing and if not passed do the second thing. ?missing So basically, I have to check whether the argument is passed or not inside the function. I

[R] DCC-GARCH model and AR(1)-GARCH(1,1) regression model

2011-05-14 Thread Marcin P?�ciennik
Hello, I have a rather complex problem... I will have to explain everything in detail because I cannot solve it by myself...i just ran out of ideas. So here is what I want to do: I take quotes of two indices - S&P500 and DJ. And my first aim is to estimate coefficients of the DCC-GARCH model for th

[R] odfWeave 0.7.17 stutters on Debian testing 64-bit amd64 systems.

2011-05-14 Thread Emmanuel Charpentier
Dear list, This is a copy of a mail sent to Max Kuhn, original author and maintainer of the odfWeave package, which seems not to have received it. It reports a problem that seems to be very implementation specific (reproductible on three Debian testing amd64 machine, does *not* happen on two i686

[R] Survreg object

2011-05-14 Thread andre bedon
Hi,Just a quick one, does anyone know the command for accessing the standard errors from a survreg object? I can access the coefficients by model$coefficients, but I cant seem to find a command to access the errors. Any help would be greatly appreciated.Regards,Andre

Re: [R] Maximization of a loglikelihood function with double sums

2011-05-14 Thread Ravi Varadhan
It should not be very hard to find information on optimization. Have you tried any of the search facilities in R? ?optim # comes with `base' library(optimx) # you need to install this first from CRAN Ravi. From: r-help-boun...@r-project.org [r-help-boun

[R] Changing Attribute With Paste

2011-05-14 Thread Sparks, John James
Dear R Helpers, I am trying to adjust the attribute of an R object pulled from quantmod. Since I want to do this for many such objects, I was trying to make the adjustment programmatic. Unfortunately, I am having a huge amount of trouble using attr in combination with paste (and perhaps get, and

Re: [R] Uploading CSV file into R

2011-05-14 Thread Me
OK, I have another question if you guys don't mind helping again. I have all of the information I need in a csv file, and I've read the csv file into R, but I'm having some trouble manipulating it. In the past, I've always manipulated data that was premade for me in the class I'm in, so I think I'm

[R] calling "exists" function inside another function is not working

2011-05-14 Thread utkarshsinghal
Hi all, I want to define a function such that one of its argument if passed do one thing and if not passed do the second thing. So basically, I have to check whether the argument is passed or not inside the function. I am trying to use 'exists' function to do this. > f = function