Re: [R] replacing ugly for loops

2012-10-11 Thread Bert Gunter
I am not sure you have expressed what you wanjt to do correctly. See inline: On Wed, Oct 10, 2012 at 9:10 PM, andrewH ahoer...@rprogress.org wrote: I have a couple of hundred American Community Survey Summary Files files containing rectangular arrays of data, mainly though not exclusively

Re: [R] Connect R and Lyx in UBUNTU

2012-10-11 Thread ATANU
By Connect I meant to say that I was able to write code chunks in LYX and compile them within LYX( using R) to produce results along with other stuffs. There are many tutorials available for doing this under Windows but I could not solve the problem for linux (UBUNTU). -Atanu -- View this

Re: [R] Connect R and Lyx in UBUNTU

2012-10-11 Thread Yihui Xie
It is actually much easier to do it under Ubuntu; see a video here: http://yihui.name/knitr/demo/lyx/ If you want to use Sweave instead of knitr, there is also a module for it. The official documentation is here: - https://github.com/downloads/yihui/lyx/sweave.pdf -

Re: [R] Exporting summary plm results to latex

2012-10-11 Thread Duncan Mackay
Hi Sebastian I think I found the package by accident when I did a search of the Cran package page forlatex but did not use it as it could not do a very particular problem. If there was no other alternative use the add.to.row argument of xtable A while ago I needed to add some info from the

Re: [R] Connect R and Lyx in UBUNTU

2012-10-11 Thread Rainer M Krug
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 I have pointed out already: This is a LyX question - please ask on their mailing list (http://www.lyx.org/MailingLists#toc2 and http://dir.gmane.org/gmane.editors.lyx.general) There are many users who use LyX / sweave or knitr / R under Ubuntu!

Re: [R] How to replicate SAS by group processing in R

2012-10-11 Thread Barry Rowlingson
On Wed, Oct 10, 2012 at 7:09 PM, ramoss ramine.mossad...@finra.org wrote: In SAS I use the following code: proc sort data=upper; by tdate stock_symbol expire strike; run; data upper1; set upper; by tdate stock_symbol expire strike; if first.expire then output; rename

[R] Ptak and Candpara

2012-10-11 Thread Peppe Ricci
Hi, I am using the package PTAK and in particular the command Candpara to perform the Parafac factorizationor of a tensor. The results are not encouraging as I expected, I'm starting a phase of analysis to see if there are errors. I pose a question and I hope you can help me. The command to run

[R] Case study in forensic computing domain

2012-10-11 Thread Ambikesh Jayal
Hi, I am looking for case studies, possibly real world, in forensic domain that will entice forensic computing students and demonstrate the usefulness of machine learning in forensics. Does anyone know of any such case studies? Students should be able to replicate the case study, so it should

Re: [R] GAM without intercept

2012-10-11 Thread anna freni sterrantino
Hi Sergio,  based on my understanding ( see Wood Generalized Additive Model) smoothing basis incorporates the intercept already, due to identifiable issues. Therefore the intercept is always specified and you don't need  to specify. I guess that your m2 to model is simply not correct. Hope it

[R] Options to extend memory limit

2012-10-11 Thread jennifer.moeller-gulland
Dear All, at the moment I am using R for calculations of large databases. Unfortunately, R only manages to complete certain operations at some times, and not at others. I usually get the error message cannot allocate vector of size XX I am using the 64-bit version with Windows 7. While my

Re: [R] multiple t-tests across similar variable names

2012-10-11 Thread Rui Barradas
Hello, I have a problem, with your data example my results are different. I have changed the names of two of the variables, to allow for 'pre' and 'post' to be first in the names. # auxiliary functions ifswap - function(x) if(x[1] %in% c(pre, post)) x[2:1] else x getpair - function(i,

Re: [R] practical to loop over 2million rows?

2012-10-11 Thread S Ellison
If I use a nested ifelse statement in a loop it takes me 13 minutes to get an answer on just 50,000 rows. ... ifelse(strataID[i+1]==strataID[i], y-x[i+1], y-x[i-1])) maybe take a closer look at the ifelse help page and the examples? First, ifelse is intended to be vectorized. If you nest

Re: [R] lm on matrix data

2012-10-11 Thread Jean V Adams
Baoqiang, Here's an approach that should work: (1) Make sure that the column names of trainx and testx are the same. (2) Combine trainy and trainx into a data frame for fitting the model. (2) Use the newdata= argument in the predict() function. (3) Convert testx from matrix to data frame. # some

Re: [R] Contacting Delphi ??

2012-10-11 Thread S Ellison
What does the sudden appearance of Contacting Delphi ..the oracle is unavailable. We apologize for any inconvenience. mean? A bug? It appears at plotting. If you have an ordinary plot command, that is very strange indeed. It's a help message ... of sorts*. It should be no more likely

[R] performance analytics- package

2012-10-11 Thread sheenmaria
In performance analytics - performance summary session , i cant run the code of - charts.PerformanceSummary(datafrom_table, rf = 0, main = NULL, method = ModifiedVaR, width = 0,event.labels = NULL, ylog = FALSE, wealth.index = FALSE, gap = 12) it just return blank chart. datafrom_table -

[R] R(BCA Package)

2012-10-11 Thread kokila
Hifor all... I have tried jack.jill dataset in BCA package.This Dataset actually contains 557 observations and 8 variables.but i have got only 2 obsevations.anybody tried this same function.You people got same answers like me or getting as usual values? Please reply me by Kokila.k

Re: [R] nlmnib Package + Hessian Output

2012-10-11 Thread nserdar
Sorry but I don't modified my function with mle2 :( :( Can you give example how to obtain Hessian with numDeriv ? Serdar # Function Linn=function(param){ phi1=((param[1]^2/(1+param[1]^2))) phi2=((param[2]^2/(1+param[2]^2))) phi3=((param[3]^2/(1+param[3]^2)))

Re: [R] reading in a (very simple) list from a file

2012-10-11 Thread VA Smith
Brilliant! Thank you both, this works! Combined with the other suggestion of setting stringsAsFactors to FALSE when reading in the data frame, I now have the behaviour I wanted. I had been beginning to get the sense that one of the apply functions was the solution. I will now do some reading

Re: [R] column width in .dbf files using write.dbf ... to be continued

2012-10-11 Thread Luiz Max Carvalho
Old topic... An answer may be useful for someone else, though... Just do : environment(write.dbfMODIF)-environment(foreign::write.dbf ) and it should be good to go. Cheers, -- View this message in context:

[R] Exporting each row in the table as new table

2012-10-11 Thread kallu
Dear all, I am new to R and I am familiar with very basic stuff. I am trying to create tables in text format from each row of my table and export these tables with specific attribute in the table. I tried after reading some forums but nothing worked. Can you please help me. ex: dataGT ID

Re: [R] Exporting summary plm results to latex

2012-10-11 Thread arun
Hi, I tried this function on an example dataset and it seems to be working. extract.plm - function(model) { if (!class(model)[1] == plm) { stop(Internal error: Incorrect model type! Should be a plm object!) } zz1-summary(model)$coef[,1:2]  zz2-as.data.frame(apply(zz1,2,function(x)

Re: [R] performance analytics- package

2012-10-11 Thread R. Michael Weylandt
On Thu, Oct 11, 2012 at 11:04 AM, sheenmaria sheenmar...@gmail.com wrote: In performance analytics - performance summary session , i cant run the code of - charts.PerformanceSummary(datafrom_table, rf = 0, main = NULL, method = ModifiedVaR, width = 0,event.labels = NULL, ylog = FALSE,

Re: [R] Exporting each row in the table as new table

2012-10-11 Thread R. Michael Weylandt
On Thu, Oct 11, 2012 at 2:04 PM, kallu kallu...@gmail.com wrote: Dear all, I am new to R and I am familiar with very basic stuff. I am trying to create tables in text format from each row of my table and export these tables with specific attribute in the table. I tried after reading some

Re: [R] multiple t-tests across similar variable names

2012-10-11 Thread arun
HI Rui, By running your code, I got the results as: result #   MeanDiff   CIlower    CIupper  p.value #apple -12.6 -16.68052  -8.519476 0.0010166626 #banana    -15.0 -17.91196 -12.088040 0.0001388506 #orange    -18.2 -22.79583 -13.604166 0.0003888560 From my code: res3 #  

Re: [R] Options to extend memory limit

2012-10-11 Thread Ben Bolker
jennifer.moeller-gulland at de.pwc.com writes: at the moment I am using R for calculations of large databases. Unfortunately, R only manages to complete certain operations at some times, and not at others. I usually get the error message cannot allocate vector of size XX I am using

[R] dotplot in .R with lattice latticeExtra: proper visualization

2012-10-11 Thread Andres LaCortadora
Dear everyone, I'm trying to do a dotplot with the libraries lattice and latticeExtra. However, no proper representation of the values on the vertical y-axis is done by .R. Instead of choosing the actual values of the numeric variable, .R plots the rank of the value. That is, there are values

Re: [R] own function: computing time

2012-10-11 Thread Tonja Krueger
That's perfect, thanks a lot! Tonja Gesendet: Mittwoch, 10. Oktober 2012 um 21:37 Uhr Von: William Dunlap wdun...@tibco.com An: tonja.krue...@web.de tonja.krue...@web.de, r-help@r-project.org r-help@r-project.org Betreff: RE: [R] own function: computing time Your original

Re: [R] multiple t-tests across similar variable names

2012-10-11 Thread Rui Barradas
Hello, If that is the problem now, then change the variables' names. In what follows, the first line is just the example you gave. In the actual runnunig code uncomment the commented out lines. vars - c(red_apple_pre, post_banana_organic) #vars - names(dat) vars - gsub(_pre, =pre, vars) vars

Re: [R] Options to extend memory limit

2012-10-11 Thread Sebastian P. Luque
On Thu, 11 Oct 2012 14:45:16 +0200, jennifer.moeller-gull...@de.pwc.com wrote: Dear All, at the moment I am using R for calculations of large databases. Unfortunately, R only manages to complete certain operations at some times, and not at others. I usually get the error message cannot

Re: [R] multiple t-tests across similar variable names

2012-10-11 Thread Rui Barradas
Hello, Em 11-10-2012 15:14, arun escreveu: HI Rui, By running your code, I got the results as: result # MeanDiff CIlowerCIupper p.value #apple -12.6 -16.68052 -8.519476 0.0010166626 #banana-15.0 -17.91196 -12.088040 0.0001388506 #orange-18.2 -22.79583 -13.604166

Re: [R] Options to extend memory limit

2012-10-11 Thread Marc Schwartz
On Oct 11, 2012, at 9:55 AM, Sebastian P. Luque splu...@gmail.com wrote: On Thu, 11 Oct 2012 14:45:16 +0200, jennifer.moeller-gull...@de.pwc.com wrote: Dear All, at the moment I am using R for calculations of large databases. Unfortunately, R only manages to complete certain operations

Re: [R] dotplot in .R with lattice latticeExtra: proper visualization

2012-10-11 Thread David Winsemius
On Oct 11, 2012, at 6:48 AM, Andres LaCortadora wrote: Dear everyone, I'm trying to do a dotplot with the libraries lattice and latticeExtra. However, no proper representation of the values on the vertical y-axis is done by .R. Instead of choosing the actual values of the numeric variable,

Re: [R] optim and nlminb

2012-10-11 Thread John C Nash
It appears you are using the approach throw every method at a problem and select the answer you like. I use this quite a lot with optimx to see just what disasters I can create, but I do so to see if the software will return sensible error messages. You will have to provide a reproducible

[R] Formatting data for bootstrapping for confidence intervals

2012-10-11 Thread Paul Wennekes
Hi all, New to R, so this may be obvious to some. I've been trying to figure this out for a while, I have a dataset events that looks something like this: AreaNAMEDATEX Xn Y 1 X 1/10/10 1 1 0 1 Y 1/11/10

Re: [R] multiple t-tests across similar variable names

2012-10-11 Thread arun
Hi Shantanu, I guess the below code should solve both the issues: set.seed(432)

[R] plots for presentation

2012-10-11 Thread mamush bukana
Dear users, I am preparing a presentation in latex(beamer) . I would like to show parts of my plots per click. Example, consider I have two time series x and y: x-ts(rnorm(100), start=1900,end=1999) y-ts(rnorm(100), start=1900,end=1999) plot(x) lines(y,col=2) Then I imported this plot into latex

[R] Sorting a data frame by specifying a vector

2012-10-11 Thread LCOG1
Hello all, I cannot seem to figure out this seemingly simple procedure. I want to sort a data frame by a specified character vector. So for : df.. - data.frame(Season=rep(c(Summer,Fall,Winter,Spring),4),Obs= runif(length(rep(c(Summer,Fall,Winter,Spring),4 I want to sort the data

Re: [R] optim and nlminb

2012-10-11 Thread Spencer Graves
a fortune? On 10/11/2012 9:56 AM, John C Nash wrote: snip Indeed in several years on the list, I've never seen a query with a short, testable case fail to get an answer very quickly. JN -- Spencer Graves, PE, PhD President and Chief Technology Officer Structure Inspection and

Re: [R] Sorting a data frame by specifying a vector

2012-10-11 Thread Bert Gunter
?order df[order(yourcolumn, ] -- Bert On Thu, Oct 11, 2012 at 10:08 AM, LCOG1 jr...@lcog.org wrote: Hello all, I cannot seem to figure out this seemingly simple procedure. I want to sort a data frame by a specified character vector. So for : df.. -

[R] Help on probability distribution question

2012-10-11 Thread Andras Farkas
Dear All,   I have a questions I would like to ask about and wonder if you have any thoughts to make it work in R.   1. I work in the field of medicine where physiologic variables are often simulated, and they can not have negative values. Most often the assumption is made to simulate this

Re: [R] Expected number of events, Andersen-Gill model fit via coxph in package survival

2012-10-11 Thread Omar De la Cruz C.
Thank you, Dr. Therneau, that was very helpful. Best regards, Omar. On Mon, Oct 8, 2012 at 9:58 AM, Terry Therneau thern...@mayo.edu wrote: I am interested in producing the expected number of events, in a recurring events setting. I am using the Andersen-Gill model, as fit by the function

Re: [R] Sorting a data frame by specifying a vector

2012-10-11 Thread arun
Hi, In your dataset, it seems like it is already ordered in the way you wanted to. df.. - data.frame(Season=rep(c(Summer,Fall,Winter,Spring),4),Obs= runif(length(rep(c(Summer,Fall,Winter,Spring),4 #Suppose the order you want is:  vec2-c(Summer,Winter,Fall,Spring)

Re: [R] Help on probability distribution question

2012-10-11 Thread Ted Harding
On 11-Oct-2012 17:22:44 Andras Farkas wrote: Dear All, I have a questions I would like to ask about and wonder if you have any thoughts to make it work in R. 1. I work in the field of medicine where physiologic variables are often simulated, and they can not have negative values. Most

Re: [R] replacing ugly for loops

2012-10-11 Thread Bert Gunter
Sorry, you **did** supply data and my solution **does** work (except I left off 1 closing ) . sq.n - seq_len(nrow(data.df)) tapply(sq.n,data.df$seq,function(x)with(data.df[x,], + sort(unique(do.call(c,mapply(seq,from=startNo,length=len,SIMPLIFY=FALSE)) $`1` [1] 3 4 5 6 10 11 $`2` [1]

Re: [R] Sorting a data frame by specifying a vector

2012-10-11 Thread ROLL Josh F
Sorry if I wasn't clear but the result I am looking for is as follows #   Season   Obs #1  Summer 0.2141001 #5  Summer 0.2141001 #9  Summer 0.2141001 #13 Summer 0.2141001 #3    Fall 0.6722337 #7    Fall 0.6722337 #11   Fall 0.6722337 #15   Fall 0.6722337 #2  Winter 0.9318599 #6  Winter

Re: [R] plots for presentation

2012-10-11 Thread Duncan Murdoch
On 11/10/2012 1:08 PM, mamush bukana wrote: Dear users, I am preparing a presentation in latex(beamer) . I would like to show parts of my plots per click. Example, consider I have two time series x and y: x-ts(rnorm(100), start=1900,end=1999) y-ts(rnorm(100), start=1900,end=1999) plot(x)

[R] survey package question

2012-10-11 Thread Sebastián Daza
Hello, I have got a cluster sample using an election dataset where I already had the final results of a county-specific election. I am trying to figure out what would be the best sampling design for my data. The structure of the dataset is: 1) polling station (in general schools where people

Re: [R] Sorting a data frame by specifying a vector

2012-10-11 Thread Bert Gunter
On Thu, Oct 11, 2012 at 10:43 AM, ROLL Josh F jr...@lcog.org wrote: Sorry if I wasn't clear. Actually, my bad -- I didn't read carefully enough. But the answer is still essentially correct -- just change the ordering of the levels of Season, which, by default, is alphabetic. df$Season -

Re: [R] Sorting a data frame by specifying a vector

2012-10-11 Thread arun
HI, In this case, specifying the factor levels would be easier. Try this: set.seed(1) df - data.frame(Season=rep(c(Summer,Fall,Winter,Spring),4),Obs= runif(length(rep(c(Summer,Fall,Winter,Spring),4 df1-within(df,{Season-factor(Season,levels=c(Summer,Fall,Winter,Spring))}) library(plyr)

Re: [R] Sorting a data frame by specifying a vector

2012-10-11 Thread Sarah Goslee
I'm pretty sure you were already given the answer: order() in conjunction with a factor with the level in an order you specify. mydf$Season - factor(mydf$Season, levels=c(Summer,Fall,Winter,Spring)) mydf[order(mydf$Season),] Thanks for making sure to include the context in your replies. Sarah

Re: [R] Friedman test for replicated blocked data

2012-10-11 Thread kolassa
It looks like friedman in agricolae package handles replicates by averaging and then doing the unreplicated Freidman analysis. Any pointers to the fully replicated analysis, given, for ex., in Conover, Practical Nonparametric Statistics (3rd Edn.), pp 383f? Thanks, John -- View this message

[R] bug tracker broken

2012-10-11 Thread Antonio Piccolboni
Hi, I get a 404 page not found on the root. There is not webmaster link on r-project.org that I can see. Whom should I contact? Thanks Antonio PS: Yes I was trying to report my first bug. It's a conspiracy with p 0.01. [[alternative HTML version deleted]]

[R] Repeating a series of commands

2012-10-11 Thread KoopaTrooper
I'm trying to figure out how to repeat a series of commands in R and have the outputs added to a dataframe after each iteration. My code starts this way... a-read.csv(File1.csv) b-read.csv(File2.csv)

Re: [R] Formatting data for bootstrapping for confidence intervals

2012-10-11 Thread Rui Barradas
Hello, To aggregate the data use, yes, it's exists, function aggregate. with(dat, aggregate(cbind(X, Xn, Y), list(Area, DATE), FUN = sum)) # output Group.1 Group.2 X Xn Y 1 1 1/10/10 1 1 0 2 1 1/11/10 0 0 1 3 1 1/12/10 3 0 0 4 2 2/12/10 2 1 1 5 2 2/13/10 3 0

Re: [R] Repeating a series of commands

2012-10-11 Thread Bert Gunter
encapsulate them into a function and call the function ?? -- Bert On Thu, Oct 11, 2012 at 11:09 AM, KoopaTrooper ncoop...@tulane.edu wrote: I'm trying to figure out how to repeat a series of commands in R and have the outputs added to a dataframe after each iteration. My code starts this

Re: [R] Help on probability distribution question

2012-10-11 Thread Andras Farkas
Ted,   thanks for the answer. I actually think I have it the other way around. Let me give you an example:   1. I know the mean parameter value of a variable (V), lets call it M with a value of 5, and I also know the SD, let us call it SD with a value of 3: #V M -5 SD -3   2. Usually in case

Re: [R] Help on probability distribution question

2012-10-11 Thread Ted Harding
(I made a slip with the mulstivariate case below: see at [***]) On 11-Oct-2012 17:51:51 Ted Harding wrote: On 11-Oct-2012 17:22:44 Andras Farkas wrote: Dear All, I have a questions I would like to ask about and wonder if you have any thoughts to make it work in R. 1. I work in the field of

[R] Course: Data exploration, regression, GLM GAM with R introduction

2012-10-11 Thread Highland Statistics Ltd
We would like to announce the following statistics course: Data exploration, regression, GLM GAM. With introduction to R When: 4 - 8 February 2013. Where: Coimbra, Portugal. For details, see: http://www.highstat.com/statscourse.htm Course flyer:

Re: [R] multiple t-tests across similar variable names

2012-10-11 Thread arun
HI Shantanu, I saw your reply to Rui regarding multiple underscores in Nabble: (Actually, I see now that part of the problem is that many of the names have multiple underscores such as red_apple_pre or post_banana_organic. I think this is causing a problem for this line in your code:) I

Re: [R] bug tracker broken

2012-10-11 Thread peter dalgaard
On Oct 11, 2012, at 19:56 , Antonio Piccolboni wrote: Hi, I get a 404 page not found on the root. There is not webmaster link on r-project.org that I can see. Whom should I contact? Thanks The machine hosting the bug tracker is having some issues. Just wait for the dust to settle... -

Re: [R] bug tracker broken

2012-10-11 Thread Uwe Ligges
On 11.10.2012 19:56, Antonio Piccolboni wrote: Hi, I get a 404 page not found on the root. There is not webmaster link on r-project.org that I can see. Whom should I contact? Thanks Thanks for the note. The servers where the bug tracker is installed are experiencing problems that are known.

[R] struggling with R2wd or SWord? Try rtf!

2012-10-11 Thread Jean V Adams
I have been looking for a way to write R-generated reports to Microsoft Word documents. In the past, I used the package R2wd, but for some reason I haven't been able to get it to work on my current set up. R version 2.15.0 (64-bit) Windows 7 Enterprise - Service Pack 1

Re: [R] survey package question

2012-10-11 Thread Thomas Lumley
On Fri, Oct 12, 2012 at 6:56 AM, Sebastián Daza sebastian.d...@gmail.com wrote: Hello, I have got a cluster sample using an election dataset where I already had the final results of a county-specific election. I am trying to figure out what would be the best sampling design for my data. The

[R] epiR//Incidence rate//beginner question on syntax

2012-10-11 Thread ninbut
Hi, new in R and I would like to start with calculating an incidence rate. My data is imported into R from a tab delimited txt file, as shown below: ID DATE_BIRTH DATE_UNT EVENT TIME_EV 1 4867 08/02/1959 19/10/2001 1 31 2 52 15/07/1941 08/02/1999 1 6 3 63 02/01/1946

[R] Problems with getURL (RCurl) to obtain list files of an ftp directory

2012-10-11 Thread Francisco Zambrano
Dear all, I have a problem with the command 'getURL' from the RCurl package, which I have been using to obtain a ftp directory list from the MOD16 (ET, DSI) products, and then to download them. (part of the script by Tomislav Hengl, spatial-analyst). Instead of the list of files (from ftp), I am

[R] Selecting n observation

2012-10-11 Thread bibek sharma
Hello R help, I have a question similar to what is posted by someone before. my problem is that Instead of last assessment, I want to choose last two. I have a data set with several time assessments for each participant. I want to select the last assessment for each participant. My dataset looks

[R] simple parsing question?

2012-10-11 Thread Fuchs Ira
I am using the getQuote function in the Quantmod package to retrieve the % change for a stock as follows: getQuote(aapl,what=yahooQF(c(Change Percent (Real-time Trade Time %Change (RT) aapl 2012-10-11 03:41:00 N/A - -1.67% How can I extract the numeric change % which is being

Re: [R] Exporting summary plm results to latex

2012-10-11 Thread arun
HI Sebastian, Sorry, I found an error in my solution (the values and coefficients got mixed up in sorting). Try this: library(reshape) extract.plm - function(model) { if (!class(model)[1] == plm) { stop(Internal error: Incorrect model type! Should be a plm object!) }

Re: [R] Selecting n observation

2012-10-11 Thread Peter Ehlers
On 2012-10-11 12:48, bibek sharma wrote: Hello R help, I have a question similar to what is posted by someone before. my problem is that Instead of last assessment, I want to choose last two. I have a data set with several time assessments for each participant. I want to select the last

Re: [R] optim and nlminb

2012-10-11 Thread nserdar
I have already try optimx but I got this error message. How to solve it. fn is Linn Function has 10 arguments par[ 1 ]: 0 ? 0.5 ? 1 In Bounds par[ 2 ]: 0 ? 0.5 ? 1 In Bounds In Bounds par[ 3 ]: 0 ? 0.5 ? 1 In Bounds In Bounds In Bounds

Re: [R] simple parsing question?

2012-10-11 Thread William Dunlap
qs - getQuote(c(aapl,tibx,gm,badWolf),what=yahooQF(c(Change Percent (Real-time qs Trade Time %Change (RT) aapl2012-10-11 04:00:00 N/A - -2.00% tibx2012-10-11 04:00:00 N/A - -0.85% gm 2012-10-11 04:00:00 N/A - +1.77% badWolfNA N/A - 0.00%

Re: [R] simple parsing question?

2012-10-11 Thread Fuchs Ira
I'm glad I asked as I would have thought that this was a common requirement and quantmod itself or a simple R function would have done the conversion. You saved me from having to master R's sub function. One remaining thing…when I use your snippet for AAPL, I get:

Re: [R] simple parsing question?

2012-10-11 Thread William Dunlap
But I thought the intention was to turn the string into a number, not into another string. Bill Dunlap Spotfire, TIBCO Software wdunlap tibco.com -Original Message- From: arun [mailto:smartpink...@yahoo.com] Sent: Thursday, October 11, 2012 1:54 PM To: Fuchs Ira Cc: R help;

Re: [R] simple parsing question?

2012-10-11 Thread arun
HI, Try this:  sprintf(%.2f,as.numeric(sub(^.* ([-+]?[[:digit:].]+)%$, \\1, as.character(aapl[[2]] #[1] -2.00 A.K. - Original Message - From: Fuchs Ira irafu...@gmail.com To: r-help@r-project.org Cc: Sent: Thursday, October 11, 2012 4:45 PM Subject: Re: [R] simple parsing

Re: [R] simple parsing question?

2012-10-11 Thread Fuchs Ira
Yes, in my case it would be re-learning regular expressions. Unlike riding a bicycle, this is something I have managed to forget (except for the simplest cases). I even have an old O'reilly book on the subject which I can dust off. I was thinking (hoping?) that quantmod had functions to

Re: [R] Selecting n observation

2012-10-11 Thread David Winsemius
On Oct 11, 2012, at 12:48 PM, bibek sharma wrote: Hello R help, I have a question similar to what is posted by someone before. my problem is that Instead of last assessment, I want to choose last two. I have a data set with several time assessments for each participant. I want to select

Re: [R] replacing ugly for loops

2012-10-11 Thread andrewH
Dear Bert-- I tried your function on the data that I provided (data.df) and it worked beautifully (after I added a missing final parenthesis), producing exactly the same output as my function. This is an excellent example of what I was looking for, because it is (a) 50% shorter than mine,

Re: [R] replacing ugly for loops

2012-10-11 Thread Bert Gunter
I hate to decline such praise, but honesty demands that I must. In fact, my solution is **not** fully vectorized at all! The tapply() and mapply() calls are, in fact, in some sense hidden loops at the interpreted levels. They do have the virtue of being true to R's functional paradigm, but they

[R] Fonts in *.Rd files.

2012-10-11 Thread Rolf Turner
I wanted to put a certain string in sans serif font in an *.Rd file that I was writing. I tried {\sf ...} and \textsf{...} but both resulted in the warning unknown macro. The manual on Writing R Extensions seems to me to imply that one should be able to invoke such LaTeX macros (section 2.3):

[R] Error in file(file, rt) : cannot open the connection

2012-10-11 Thread Navin Goyal
Hi, I am using R package QT which call runs alongwith SAS I get this error : Error in file(file, rt) : cannot open the connection I have tried using setwd or running R directly from that directory but still get the same error. Any help would be appreciated setwd(C:\\Documents and

Re: [R] Formatting data for bootstrapping for confidence intervals

2012-10-11 Thread arun
Hi, Try this: dat1-read.table(text= Area    NAME    DATE    X    Xn    Y 1    X    1/10/10    1    1    0 1    Y    1/11/10    0    0    1 1    X    1/12/10    1    0    0 1    X    1/12/10    1    0    0 1    X    1/12/10  

[R] model selection with spg and AIC (or, convert list to fitted model object)

2012-10-11 Thread Ravi Varadhan
Adam, See the attached R code that solves your problem and beyond. One important issue is that you are enforcing constraints only indirectly. You need to make sure that P1, P2, and P3 (which are functions of original parameters and time) are all between 0 and 1. It is not enough to impose

[R] a question

2012-10-11 Thread mina izadi
Dear R-helpers, I need to read some data from output of garchFit in fGarch. my model is garch(1,1) and i want to read coefficients(omega,alpha,beta) and timeseries(x) and conditional SD(s). because i need them to use in other formula. for example :omega+x[1]+s[3] and maybe i have several

[R] In vegan package: running adonis (or similar) on a distance matrix

2012-10-11 Thread Roey Angel
Hi, Using Vegan package I was wondering if there's a way to use a distance matrix as an input for adonis (or any of the other similar hypothesis testing functions) instead of the usual species by sample table. Working in the field of microbial ecology, what I'm trying to do is to overcome the

[R] Changing NA to 0 in selected columns of a dataframe

2012-10-11 Thread scoyoc
I've been beating my head on the table for hours now and don't understand why this doesn't work. I have a dataframe that I want to change NAs to 0 for some of the columns and not others. Consider this... #create dataframe A = c(1:5) B = c(6, 7, NA, NA, NA) C = c(NA, NA, 13, 14, 15) D =

[R] characters, mathematical expressions and computed values

2012-10-11 Thread 1Rnwb
Hello, I have to add Age (bar(x)=14.3) as a title on a chart. I am unable to get this to working. I have tried bquote, substitute and expression, but they are only doing a part of the job. new- c(14.3, 18.5, 18.1, 17.7, 18, 15.9, 19.6, 17.3, 17.8, 17.5, 15.4, 16.3, 15, 17.1, 17.1, 16.4, 15.2,

[R] Question on survival

2012-10-11 Thread lau pel
Hi, I'm going crazy trying to plot a quite simple graph. i need to plot estimated hazard rate from a cox model. supposing the model i like this: coxPhMod=coxph(Surv(TIME, EV) ~ AGE+A+B+strata(C) data=data) with 4 level for C. how can i obtain a graph with 4 estimated (better smoothed) hazard curve

Re: [R] Changing NA to 0 in selected columns of a dataframe

2012-10-11 Thread scoyoc
Actually what does only logical matrix subscripts are allowed in replacement mean. I can designate columns using is.na. -- View this message in context: http://r.789695.n4.nabble.com/Changing-NA-to-0-in-selected-columns-of-a-dataframe-tp4645917p4645918.html Sent from the R help mailing list

Re: [R] Formatting data for bootstrapping for confidence intervals

2012-10-11 Thread Paul Wennekes
Thank you! That had me stuck for quite a while and this worked like a charm! -- View this message in context: http://r.789695.n4.nabble.com/Formatting-data-for-bootstrapping-for-confidence-intervals-tp4645860p4645920.html Sent from the R help mailing list archive at Nabble.com.

Re: [R] Changing NA to 0 in selected columns of a dataframe

2012-10-11 Thread arun
Hi, Try this:  dat1 = as.data.frame ( cbind ( A, B, C, D, E ) ) dat1$B[is.na(dat1$B)]-0  dat1$C[is.na(dat1$C)]-0  dat1 #  A B  C  D  E #1 1 6  0 16 21 #2 2 7  0 17 NA #3 3 0 13 18 NA #4 4 0 14 19 NA #5 5 0 15 20 25 A.K. - Original Message - From: scoyoc sco...@gmail.com To:

Re: [R] Changing NA to 0 in selected columns of a dataframe

2012-10-11 Thread R. Michael Weylandt
On Thu, Oct 11, 2012 at 11:58 PM, arun smartpink...@yahoo.com wrote: Hi, Try this: dat1 = as.data.frame ( cbind ( A, B, C, D, E ) ) No. Do not try this. It is a Very Bad Thing to use as.data.frame(cbind(...)) instead of data.frame(...) for reasons I've mentioned before on this list. In

Re: [R] a question

2012-10-11 Thread Rui Barradas
Hello, What a terribly asked question. Let me rephrase it. You have a time series 'x' simulated with garchSim from package fGarch and have fitted a model using garchFit. 1. You want to extract the coefficients. coef(fit) 2. You want the series of observations (simulated) and of conditional

Re: [R] Changing NA to 0 in selected columns of a dataframe

2012-10-11 Thread arun
Hi Michael, Sorry!  You are right. That was OP's code, which I cut and paste without noticing it.  To Scoyoc: You can also try this: dat1 -data.frame(A, B, C, D, E ) dat1new-dat1[,2:3]  dat1new[is.na(dat1new)]-0  dat1[,2:3]-dat1new  dat1 #  A B  C  D  E #1 1 6  0 16 21 #2 2 7  0 17 NA #3 3 0

Re: [R] characters, mathematical expressions and computed values

2012-10-11 Thread William Dunlap
I think that bquote, with its .() operator, suffices for [almost?] any single title; don't bother fiddling with expression(), substitute(), or parse(). (You can make those work in many situations, but if you stick with just bquote then you can spend your time on the title itself.) E.g.,

Re: [R] Fonts in *.Rd files.

2012-10-11 Thread Duncan Murdoch
On 12-10-11 6:05 PM, Rolf Turner wrote: I wanted to put a certain string in sans serif font in an *.Rd file that I was writing. I tried {\sf ...} and \textsf{...} but both resulted in the warning unknown macro. The manual on Writing R Extensions seems to me to imply that one should be able to

[R] error msg using na.approx x and index must have the same length

2012-10-11 Thread Jay Rice
Below I have written out some simplified data from my dataset. My goal is to interpolate Price based on timestamp. Therefore the closer a Price is in time to another price, the more like that price it will be. I want the interpolations for each St and not across St (St is a factor with levels A,

Re: [R] survey package question

2012-10-11 Thread Sebastián Daza
Hello Thomas, I use both svymean (with the expanded sample = people), and svyratio (voting unit level), using the same design: design -svydesign(id=~station + unit, fpc=~probstation+probunits, data=sample, pps=brewer) I got different results using the same sample: svyratio (voting unit)

[R] Columns and rows

2012-10-11 Thread Santana Sarma
Hi, Could you please advice some easy way to do the following for a dataframe (header=F) having unequal column- row- length. 1. Combine/stack/join contents from - a) multiple rows into one column. b) multiple columns into one row. 2. Stack contents from multiple

[R] Error with cForest

2012-10-11 Thread James Erickson (Student)
All -- I have been trying to work with the 'Party' package using R v2.15.1 and have cobbled together a (somewhat) functioning code from examples on the web. I need to run a series of unbiased, conditional, cForest tests on several subsets of data which I have made into a loop. The results

[R] mclogit

2012-10-11 Thread Katelyn Weaver
Hello, I am new to R and am trying to complete a mixed conditional logistic regression. There are two issues that I am currently having: 1. I am not sure how to insert the random effects variable into the equation. My current equation is model-mclogit(Presence~AllWet+AllAg+strata(Pair)) where

  1   2   >