[R] Date issues

2010-09-18 Thread Santosh Srinivas
Strangely this is not working ... what am I doing wrong here? > tDate <- FnO_Data$Date[1] > tDate [1] 20090101 > as.Date(c(tDate),format="%Y%m%d") [1] NA __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read th

Re: [R] Date issues

2010-09-18 Thread Santosh Srinivas
Thanks. -Original Message- From: David Winsemius [mailto:dwinsem...@comcast.net] Sent: 18 September 2010 21:07 To: Santosh Srinivas Cc: r-help@r-project.org Subject: Re: [R] Date issues On Sep 18, 2010, at 11:25 AM, Santosh Srinivas wrote: > Strangely this is not working ... what a

Re: [R] Date issues

2010-09-18 Thread Santosh Srinivas
COLLATE=English_United Kingdom.1252 LC_CTYPE=English_United Kingdom.1252 [3] LC_MONETARY=English_United Kingdom.1252 LC_NUMERIC=C [5] LC_TIME=English_United Kingdom.1252 attached base packages: [1] stats graphics grDevices utils datasets methods base other attached packages:

[R] DateDiff

2010-10-06 Thread Santosh Srinivas
Dear List, I have a column of dates say: test$date1 <- seq(19900511, to = 19900521) I want the next column to have the number of days between each subsequent date i.e days between r(i+1) and r(i) Any easy way to do this? (I've done it in a roundabout way but just wondering if there is any way m

[R] StrSplit

2010-10-09 Thread Santosh Srinivas
Newbie question ... I am looking something equivalent to read.delim but which accepts a text line as parameter instead of a file input. Below is my problem, I'm unable to get the exact output which is a simple data frame of the data where the delimiter exists ... coming quite close though I

Re: [R] StrSplit

2010-10-09 Thread Santosh Srinivas
Thanks Jim. Exactly what I needed! -Original Message- From: jim holtman [mailto:jholt...@gmail.com] Sent: 09 October 2010 22:01 To: Santosh Srinivas Cc: r-help@r-project.org Subject: Re: [R] StrSplit Is this what you are after: > x <- c("Scheme Code;Scheme Name;Net

[R] read.table issue

2010-10-09 Thread Santosh Srinivas
Dear R-Group, I am getting this error message "incomplete final line found by readTableHeader" in the code below. It seems to me that the error message is because of quote in the text data. Is there any easy way to handle this? Or should I do a substitute. > tempTxt <- "100589;Canara Robeco Exp

[R] trycatch examples

2010-10-10 Thread Santosh Srinivas
Dear R-group, I am looking for some good examples on trycatch. Any pointers? The help manual seems quite limited. Thanks. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-pr

[R] Number of occurences of a character in a string

2010-10-10 Thread Santosh Srinivas
New to R ... which is a function to most effectively search the number of occurrences of a character in a string? b <- c("jkhrikujhj345hi5hiklfjsdkljfksdio324j';;'lfd;g'lkfit34'5;435l;43'5k") I want the number of semi-colons ";" in b? Thanks. __ R-he

[R] textConnection on List

2010-10-10 Thread Santosh Srinivas
I'm trying to optimize some code that I have I have a list of delimited text in a list (see below). I want to do a read.table via a text connection so that I can get the delimited values into a table ... Something like ... tmp_MF_Data_F <- read.table(textConnection(tmpTxtList), sep=';', quote =

Re: [R] textConnection on List

2010-10-10 Thread Santosh Srinivas
row.names=F, quote=F) -Original Message- From: Santosh Srinivas [mailto:santosh.srini...@gmail.com] Sent: 11 October 2010 11:05 To: 'r-help' Subject: textConnection on List I'm trying to optimize some code that I have I have a list of delimited text in a list (see below)

[R] Dataset Transformation

2010-10-11 Thread Santosh Srinivas
I need to transpose the following input dataset into an output dataset like below Input Date TICKER Price 11/10/2010 A 0.991642 11/10/2010 B 0.475023 11/10/2010 C 0.218642 11/10/2010 D 0.365135 12/10/2010 A 0.687873 12/10/2010 B 0.47006 12/10/2010 C 0.533542

Re: [R] Dataset Transformation

2010-10-11 Thread Santosh Srinivas
Repost .. since the previous msg had problems I need to transpose the following input dataset  into an output dataset like below Input DateTICKER Price 11/10/2010 A 0.991642 11/10/2010 B 0.475023 11/10/2010 C

[R] Read from a website

2010-10-12 Thread Santosh Srinivas
Something similar to this was discussed recently, but I'm unable to find the thread. I want to read from a site where I need to enter the date into a form before I am presented with the CSV link. E.g. like reading ticker data from yahoo (but assuming you HAVE to enter the dates and click on req

[R] Basic data question

2010-10-13 Thread Santosh Srinivas
I have a question about the output given below after running few lines of code. Surely a 101 query! MF_Data <- read.csv("MF_Data_F.txt", header = F, sep="|") temp <- head(MF_Data) #Get the sample Data temp1 <- subset(temp, select= c(V1,V4,V6)) #where V1, V4, V6 are the col names .. to Get the rel

[R] Drop matching lines from readLines

2010-10-13 Thread Santosh Srinivas
Dear R-group, I have some noise in my text file (coding issues!) ... I imported a 200 MB text file using readlines Used grep to find the lines with the error? What is the easiest way to drop those lines? I plan to write back the "cleaned" data set to my base file. Thanks. _

Re: [R] Drop matching lines from readLines

2010-10-13 Thread Santosh Srinivas
I guess "invert" does the trick. For recording ... example .. file <- grep("Repurchase Price",file, fixed = TRUE, invert = TRUE) -Original Message- From: Santosh Srinivas [mailto:santosh.srini...@gmail.com] Sent: 14 October 2010 11:28 To: 'r-help'

[R] Replacing N.A values in a data frame

2010-10-14 Thread Santosh Srinivas
Hello, I have a data frame as below ... in cases where I have N.A. I want to use an average of the past date and next date .. any help? 13/10/2010 A 23 13/10/2010 B 12 13/10/2010 C 124 14/10/2010 A 43 14/10/2010 B 54 14/10/2010 C 6

Re: [R] Replacing N.A values in a data frame

2010-10-14 Thread Santosh Srinivas
urn profile on the data below after it is transformed? Thanks very much! S -Original Message- From: Gabor Grothendieck [mailto:ggrothendi...@gmail.com] Sent: 14 October 2010 18:22 To: Santosh Srinivas Cc: r-help Subject: Re: [R] Replacing N.A values in a data frame On Thu, Oct 14, 2010 a

Re: [R] Drop matching lines from readLines

2010-10-14 Thread Santosh Srinivas
Yes, thanks ... that works. -Original Message- From: Bert Gunter [mailto:gunter.ber...@gene.com] Sent: 14 October 2010 21:26 To: Mike Marchywka Cc: santosh.srini...@gmail.com; r-help@r-project.org Subject: Re: [R] Drop matching lines from readLines If I understand correctly, the poster k

Re: [R] Joining together multiple csv files

2010-10-14 Thread Santosh Srinivas
I guess you could simply read the files into a loop and write into the aggregated files using write.table with append = true in the same loop -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of aenea...@priest.com Sent: 15 October 2010

[R] Downloading file with lapply

2010-10-15 Thread Santosh Srinivas
I'm still getting familiar with lapply I have this date sequence x <- seq(as.Date("01-Jan-2010",format="%d-%b-%Y"), Sys.Date(), by=1) #to generate series of dates I want to apply the function for all values of x . so I use lapply (Still a newbie!) I wrote this test function pFun <- function (x) {

Re: [R] Downloading file with lapply

2010-10-15 Thread Santosh Srinivas
Thx. -Original Message- From: Uwe Ligges [mailto:lig...@statistik.tu-dortmund.de] Sent: 15 October 2010 13:11 To: Santosh Srinivas Cc: r-help@r-project.org Subject: Re: [R] Downloading file with lapply On 15.10.2010 09:19, Santosh Srinivas wrote: > I'm still getting famil

[R] R & MySQL (Databases)

2010-10-15 Thread Santosh Srinivas
Dear R-helpers, Considering that a substantial part of analysis is related data manipulation, I'm just wondering if I should do the basic data part in a database server (currently I have the data in .txt file). For this purpose, I am planning to use MySQL. Is MySQL a good way to go about? Are ther

[R] Class mode text isopen can read can write - too many open connections

2010-10-17 Thread Santosh Srinivas
I am downloading data files using RCurl and everything works except till some limit is hit and says too many connections open It is a simple download using URL and I am writing the status in a tryCatch block to a log file. showConnections() description class mode text isopen can read can wr

[R] Basic structure operations doubt

2010-10-17 Thread Santosh Srinivas
I'm doing these manipulations on the data frame and wondering why does R have to remember historical data on my operation and not just keep the needed info. Probably a basic fundamentals of the way R handles data .. Pls point me to the manual if possible .. I have this Index data: > head(NIFTY_IND

Re: [R] Class mode text isopen can read can write - too many open connections

2010-10-17 Thread Santosh Srinivas
print(paste("Failed to download:", paste("CM",sDate1,".zip",sep="")),file = "Failure-Log.txt",append=TRUE,sep="\n") write(paste("Failed to download:", paste("CM",sDate1,".zip",sep="&qu

Re: [R] Basic structure operations doubt

2010-10-17 Thread Santosh Srinivas
Wiley [mailto:jwiley.ps...@gmail.com] Sent: 18 October 2010 07:47 To: Santosh Srinivas Cc: r-help@r-project.org Subject: Re: [R] Basic structure operations doubt Hi, The easiest way to get rid of the empty levels is with droplevels(). See ?droplevels for details. It actually has a method for data frames

[R] read.zoo issues

2010-10-18 Thread Santosh Srinivas
I am getting problems using read.zoo I have the following data frame > head(anlyNiftyDat[,1:10]) TIMESTAMPACC AMBUJACEM AXISBANK BAJAJ-AUTO BHARTIARTL BHEL BPCL CAIRN CIPLA 1 2010-01-04 00:00:00 913.60106.10 992.101732.05 325.20 2426.10 650.75 285.50 337.55 2 201

Re: [R] Directive for first and last array arguments

2010-10-18 Thread Santosh Srinivas
X[1,1] .. first x[NROW(x),NCOL(x)] for last element and so on Is this what you need? -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of Alaios Sent: 18 October 2010 15:59 To: Rhelp Subject: [R] Directive for first and last array ar

Re: [R] read.zoo issues

2010-10-18 Thread Santosh Srinivas
Okay ... now I gotcha ... Thanks -Original Message- From: Gabor Grothendieck [mailto:ggrothendi...@gmail.com] Sent: 18 October 2010 17:19 To: Santosh Srinivas Cc: r-help@r-project.org Subject: Re: [R] read.zoo issues On Mon, Oct 18, 2010 at 4:24 AM, Santosh Srinivas wrote: > I

[R] Download.file problem

2010-10-18 Thread Santosh Srinivas
Strange problem with download.file . for non existent URL an empty file is created but I am not able to delete the without shutting down R Example: > download.file("http://test.com/test.txt","test.txt";) trying URL 'http://test.com/test.txt' Error in download.file("http://test.com/test.txt";, "t

[R] help -> RE: Download.file problem

2010-10-18 Thread Santosh Srinivas
Dear R-helpers ... any thoughts on the below issue ... will help me complete a small project! Strange problem with download.file . for non existent URL an empty file is created but I am not able to delete the without shutting down R Example: > download.file("http://test.com/test.txt","test.txt"

[R] If Statement with more than one condition

2010-10-22 Thread Santosh Srinivas
I'm unable to find the OR operator like other language .. any suggestions? I want to do If (condition1 OR condition 2){ do something } Thanks for answering this elementary question. [[alternative HTML version deleted]] __ R-help@r-proj

[R] dbWriteTable

2010-10-22 Thread Santosh Srinivas
I'm having a strange problem with dbWriteTable ... I have the dbWriteTable inside a batchloop. dbWriteTable(con,"mutual_funds",tmp_MF_Data_F,append=T,row.names=F) # append rows to the data table The data gets updated for the first 3 loops (out of say 100) but then there is no error a

[R] Extract table from a webpage

2010-10-25 Thread Santosh Srinivas
Dear R-group, I've been able to use the XML package for getting relevant tables from webpages for my analysis. I'm stuck with this slightly more interactive problem involving clicking a link Fro this link . http://www.etintelligence.com/etig/et500/et500Ranking.jsp I want to get the data tabl

[R] Best IDE for R

2010-10-27 Thread Santosh Srinivas
Dear R-Group, I am looking for suggestions for the "best" IDE for R. Best is obviously subjective but I need just the basic features that should function well (and I looked through the threads already). - Proper integration with R 2.11.1 - Good key shortcuts ... similar to the R Gui - Manageabilit

[R] R and Matlab

2010-10-28 Thread Santosh Srinivas
Dear Group, I am looking for ways to use R and Matlab. Doing the data transformations in R and using the data in Matlab to analyze with some pre-defined scripts. Any good ways to transfer the data into matlab in its most recent version? I tried using R.matlab but the writeMat output is not readabl

Re: [R] transforming a dataset for association analysis

2010-10-30 Thread Santosh Srinivas
A more usable problem input would definitely help ... use dput to send a reproducible sample to the group Think the below should solve your problem > read.csv("Book1.csv") Subject Item Score 1 Subject 1 Item 1 1 2 Subject 1 Item 2 0 3 Subject 1 Item 3 1 4 Subject 2 Item 1 1

[R] Downloading Package Sources

2010-10-31 Thread Santosh Srinivas
Dear Group, any idea how I can download the source code for all packages in Windows 7? __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and prov

[R] write.csv changes the format of the date

2010-11-01 Thread Santosh Srinivas
Dear Group, Why does write.csv modify the date format when it write to a file. I have the following variable Param_Dat: dput(Param_Dat) structure(list(Last_Successful_Run = structure(1L, .Label = "30/10/2010", class = "factor")), .Names = "Last_Successful_Run", class = "data.frame", row.names =

[R] File Downloading Problem

2010-11-01 Thread Santosh Srinivas
Dear Group, My code stopped working ... used to work till last week! sURL <- "http://www.nseindia.com/content/historical/EQUITIES/2010/NOV/cm01NOV2010bha v.csv.zip" > download.file(sURL,"test.zip") trying URL 'http://www.nseindia.com/content/historical/EQUITIES/2010/NOV/cm01NOV2010bha v.csv.zip'

Re: [R] write.csv changes the format of the date

2010-11-01 Thread Santosh Srinivas
Hi David, Its strange ... when I run this separately it works ... but I when I do in my function it changes the format. I just opened it using Notepad. -Original Message- From: David Winsemius [mailto:dwinsem...@comcast.net] Sent: 01 November 2010 19:15 To: Santosh Srinivas Cc: '

Re: [R] File Downloading Problem

2010-11-01 Thread Santosh Srinivas
V2010bha v.csv.zip" download.file(sURL,"test.zip") Put the same URL in a browser and it works fine. -Original Message- From: Duncan Murdoch [mailto:murdoch.dun...@gmail.com] Sent: 01 November 2010 19:04 To: Santosh Srinivas Cc: 'Rhelp' Subject: Re: [R] File Download

Re: [R] File Downloading Problem

2010-11-01 Thread Santosh Srinivas
Sent: 01 November 2010 20:48 To: Duncan Murdoch Cc: Santosh Srinivas; 'Rhelp' Subject: Re: [R] File Downloading Problem On Nov 1, 2010, at 10:41 AM, Duncan Murdoch wrote: > On 01/11/2010 10:37 AM, Santosh Srinivas wrote: >> Nope Duncan ... no changes .. the same old way without a

Re: [R] File Downloading Problem

2010-11-01 Thread Santosh Srinivas
, e.g. library(Rcompression) z = zipArchive(o) names(z) read.csv(textConnection(z[[1]])) D. On 11/1/10 8:27 AM, Santosh Srinivas wrote: > It's strange and the internet connection is fine because I am able to get > data from yahoo. > This was working till just yest

Re: [R] File Downloading Problem

2010-11-01 Thread Santosh Srinivas
voiding writing it to disk and then reading it back in, e.g. library(Rcompression) z = zipArchive(o) names(z) read.csv(textConnection(z[[1]])) D. On 11/1/10 8:27 AM, Santosh Srinivas wrote: > It's strange and the internet connection is fine because I am able to get > data

[R] Using R for Production - Discussion

2010-11-01 Thread Santosh Srinivas
Hello Group, This is an open-ended question. Quite fascinated by the things I can do and the control I have on my activities since I started using R. I basically have been using this for analytical related work off my desktop. My experience has been quite good and most issues where I need to inve

Re: [R] how to compare two datasets in R>?

2010-11-01 Thread Santosh Srinivas
Take a look at ?merge for doing such join operations. (I believe that should help) If you had provided a sample of your datasets using dput, I would have checked that for you. -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of song song

[R] Setting the names of a data.frame

2010-11-02 Thread Santosh Srinivas
I have tData as below. I need to set the names with the headers from the first row in sHeaders Sorry .. forgot how to set the names from row in another data frame .. pls advise. names(tData) = sHeaders[1,] does not work correctly Also, why doesn't drop.levels(sHeaders) not work? dput(tData) str

Re: [R] Setting the names of a data.frame

2010-11-02 Thread Santosh Srinivas
:length(sHeaders)){ names(tData)[i] <- as.character(sHeaders[1,i]) } Or with lapply: names(tData) <- unlist(lapply(sHeaders[1, ], FUN=as.character)) HTH, Ivan Le 11/2/2010 14:58, Santosh Srinivas a écrit : > I have tData as below. I need to set the names with the headers from the >

Re: [R] Setting the names of a data.frame

2010-11-02 Thread Santosh Srinivas
ly a readHTMLtable from a webpage. Your solutions works well enough for my purpose ... thanks. -Original Message- From: Ivan Calandra [mailto:ivan.calan...@uni-hamburg.de] Sent: 02 November 2010 22:15 To: Santosh Srinivas Cc: r-help@r-project.org Subject: Re: [R] Setting the names of a data.frame

[R] Drawing circles on a chart

2010-11-02 Thread Santosh Srinivas
Dear Group, I have the following data matrix which is a timeseries. > dput(tData) structure(list(A = c(0.2, 0.13, 0.05, 0.1, 0.02, 0.18, 0.09, 0.06, 0.13), B = c(0.15, 0.06, 0.09, 0.02, 0.03, 0.12, 0.01, 0.15, 0.06), C = c(-0.1, 0, -0.07, -0.06, -0.05, -0.05, -0.06, -0.08, -0.07), D = c(-0.15,

Re: [R] Drawing circles on a chart

2010-11-02 Thread Santosh Srinivas
- rownames(tData) tData.m <- melt(tData) # need to find a way to adjust the color for -ve values balloonplot(tData.m$Period,tData.m$variable,abs(tData.m$value)) -Original Message- From: Gabor Grothendieck [mailto:ggrothendi...@gmail.com] Sent: 03 November 2010 07:51 To: Santosh Srinivas

[R] Data transformation

2010-11-03 Thread Santosh Srinivas
Dear Group, Need to do the following transformation: I have the dataset structure(list(Date = structure(1L, .Label = "2010-06-16", class = "factor"), ACC.returns1Day = -0.018524832, ACC.returns5Day = 0.000863931, ACC.returns7Day = -0.019795222, BCC.returns1Day = -0.009861859, BCC.r

Re: [R] Drawing circles on a chart

2010-11-03 Thread Santosh Srinivas
Thanks Barry ... actually the intention was to have areas of the circle depicting the value (radius imputed) -Original Message- From: b.rowling...@googlemail.com [mailto:b.rowling...@googlemail.com] On Behalf Of Barry Rowlingson Sent: 03 November 2010 15:02 To: Santosh Srinivas Cc: r-help

Re: [R] postForm() in RCurl and library RHTMLForms

2010-11-04 Thread Santosh Srinivas
I don’t have the implementation in the way you want it …. Sorry … but someone here will definitely know The group showed me to do it this way though …. library(zoo) library("RCurl") sNiftyURL = "http://nseindia.com/content/indices/histdata/S&P%20CNX%20NIFTY01-01-2000-02 -11-2010.csv" Nifty_Dat =

[R] Extracting data only for particular index values from a zoo structure

2010-11-05 Thread Santosh Srinivas
Hello All, I have a zoo structure as follows: > dput(tMRet) structure(c(0.00138742474397713, -0.0309023681475112, 0.0390276302410908, 0.0832282874685357, -0.00315002033871414, -0.0158548785709138, -0.0410876001496389, -0.0503189291168807, 0.00229628598547049, 0.112348434473647, 0.07600046962546

Re: [R] Extracting data only for particular index values from a zoo structure

2010-11-05 Thread Santosh Srinivas
index(mRet),"%m")==11] -Original Message- From: Gabor Grothendieck [mailto:ggrothendi...@gmail.com] Sent: 05 November 2010 20:59 To: Santosh Srinivas Cc: r-help@r-project.org Subject: Re: [R] Extracting data only for particular index values from a zoo structure On Fri, Nov

[R] Row-wise recurive function call

2010-11-08 Thread Santosh Srinivas
Dear Group, I have a following dataset: > a A B C D 1 22 3 31 40 2 26 31 36 32 3 3 7 49 16 4 24 40 27 26 5 20 45 47 0 6 34 43 11 18 7 48 48 24 2 8 3 16 39 48 9 20 49 7 21 10 17 36 47 10 > dput(a) structure(list(A = c(22L, 26L, 3L, 24L, 20L, 34L, 48L, 3L, 20L, 17L), B = c(3

Re: [R] Row-wise recurive function call

2010-11-09 Thread Santosh Srinivas
Thanks this works. Only, I need to reference in the formula using indexes. -Original Message- From: Dimitris Rizopoulos [mailto:d.rizopou...@erasmusmc.nl] Sent: 09 November 2010 13:22 To: Santosh Srinivas Cc: r-help@r-project.org Subject: Re: [R] Row-wise recurive function call try

[R] Creating a list to store output objects from a recursive loop

2010-11-09 Thread Santosh Srinivas
Dear Group, I am having a function that I am running in a loop that generated two results for each loop The result1 is a zoo object The result2 is a data frame Now I want to put both of them in a list or some structure ... that I can access or output to a file after the loop is done. For e.g.

Re: [R] Creating a list to store output objects from a recursive loop

2010-11-09 Thread Santosh Srinivas
Figured this out this ways I think outPut <- list(list(result1),list(result2)) -Original Message- From: Santosh Srinivas [mailto:santosh.srini...@gmail.com] Sent: 09 November 2010 14:21 To: 'r-help@r-project.org' Subject: Creating a list to store output objects from a r

Re: [R] arrays of arrays

2010-11-09 Thread Santosh Srinivas
Not sure if this is the best way ... but something similar to my question from yesterday that I could solve as follows. > tD <- read.csv("Book1.csv") > tD X0 X0.1 X1 X1.1 X X.1 1 13 5 NA NA NA 2 44 NA NA NA NA 3 7 -1 89 10 6 > x1 <- tD[1,1:3] > > x2 <- tD[2,1:2] > >

Re: [R] concatenating a string to a column

2010-11-09 Thread Santosh Srinivas
Try on these lines library(MASS) data(Boston) Boston$crim<-paste(Boston$crim,"Test",sep="-") -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of sachinthaka.abeyward...@allianz.com.au Sent: 10 November 2010 10:39 To: R-help Forum Subject

Re: [R] Parsing txt file

2010-11-10 Thread Santosh Srinivas
You could use the following to achieve your objective. To start with ?readLines ?strsplit ?for ?ifelse As you try, you may receive more specific answers for the issues you come up with. -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf

[R] format as percentage

2010-11-10 Thread Santosh Srinivas
Basic question ... checked the help page but the only answer was to use paste! Is there any way to format as %? > degree = c(0.20,0.5) > degree [1] 0.2 0.5 > print(degree) [1] 0.2 0.5 -- Thanks R-

[R] Parallel code runs slower!

2010-11-10 Thread Santosh Srinivas
My parallel code is running slower than my non-parallel code! Can someone pls advise what am I doing wrong here? t and tTA are simple matrices of equal dimensions. #NON PARALLEL CODE nCols=ncol(t) nRows=nrow(t) tTA = matrix(nrow=nRows,ncol=nCols) require(TTR) system.time( for (i in 1:nCols) {

[R] Time Delay / Wait

2010-11-11 Thread Santosh Srinivas
Hi Group, Is there something like a delay function based on System time or equivalent? I basically am generating a few graphs and I would like to see each graph for say 2mins before moving on to the next one? I can always have an empty for-loop I guess but is there a better way? Thanks, S _

[R] Deploying code as exe

2010-11-12 Thread Santosh Srinivas
Dear Group, Is there some way for me to package a few lines of R-code as exe and have it running in the background? (unable to find info in the archives) Even better if I can package it as an installation and send to my team who do not have any background in programming / R? If they can install a

Re: [R] filling a vector with a tapply function applied to another vector

2010-11-12 Thread Santosh Srinivas
You could just create a new data frame with the result and cbind? On Fri, Nov 12, 2010 at 2:11 PM, albechan wrote: > > I have a data frame with three columns. The first one is filled with factors, > the second one with numeric values and the third one is an empty vector. > I need fill the third c

[R] RMySQL on Windows 2008 64 Bit -Help!

2010-11-12 Thread Santosh Srinivas
Dear Group, I'm having lots of problems getting RMySQL on a 64 bit machine. I followed all instructions available but couldn't get it working yet! Please help. See the output below. I did a install of RMySQL binary from the revolution cran source. It seems to have unpacked fine but gives this err

Re: [R] RMySQL on Windows 2008 64 Bit -Help!

2010-11-13 Thread Santosh Srinivas
I could do that but will have to change all my code. It would be great if I could get RMySQL on the 64 bit machine. -Original Message- From: Ajay Ohri [mailto:ohri2...@gmail.com] Sent: 13 November 2010 14:13 To: Santosh Srinivas Cc: r-help@r-project.org Subject: Re: [R] RMySQL on

[R] Access DDE Data

2010-11-15 Thread Santosh Srinivas
Hello Group, Is it possible to access DDE data from R? Thanks in advance for any pointers. S __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html

[R] Accessing variables inside a namespace

2010-11-17 Thread Santosh Srinivas
Hello Group, I am trying to see if there is way to access data that is inside another namespace. For e.g. the addATR function in the quantmod package calculates the ATR using the TTR package and then plots it to the graph. Now since it has already calculated the info that I need, can I access tha

[R] Option to Print with numbers formatted

2010-11-19 Thread Santosh Srinivas
Hello group, I have a data frame called test.df with a bunch of columns. When I do a print(test.df), I want the numbers to appear a pre-defined setting. I believe this can be achieved by sprintf but this needs to be done individually for the data. However, is there an option that I can set so

Re: [R] a philosophy R question

2010-11-20 Thread Santosh Srinivas
Not many really care about what it is called but here is what the page says R is `GNU S', a freely available language and environment for statistical computing and graphics which provides a wide variety of statistical and graphical techniques: linear and nonlinear modelling, statistical test

[R] Check for is.object

2010-11-22 Thread Santosh Srinivas
Hello, I am trying to recursively append some data from multiple files into a common object For this, I am using in a loop NewObject <- rbind(NewObject,tempObject) For the first loop, obviously there is no NewObject ... so I wanted to do NewObject <- tempObject[0,] Now when it loops again I w

[R] Executing multiple .R files

2010-11-23 Thread Santosh Srinivas
Hello R-Helpers, I have a directory with some ".R" files that I execute every day. I want to write a script that executes each one of time sequentially. Is there a statement for this? Thank you. __ R-help@r-project.org mailing list https://stat.ethz.c

[R] Finding the rows with the duplicated index

2010-11-23 Thread Santosh Srinivas
Hello Group, I have a huge time series dataset with sample below. I am basically trying to read it into a zoo object with columns 1:6 to index. Zoo issues a warning that some of the rows have duplicated index. dput(z) structure(list(TrdTimestamp = structure(list(sec = c(19, 19, 18, 10, 12, 43, 4

Re: [R] Finding the rows with the duplicated index

2010-11-23 Thread Santosh Srinivas
[mailto:ggrothendi...@gmail.com] Sent: 23 November 2010 21:54 To: Santosh Srinivas Cc: r-help@r-project.org Subject: Re: [R] Finding the rows with the duplicated index On Tue, Nov 23, 2010 at 11:04 AM, Santosh Srinivas wrote: > Hello Group, > > I have a huge time series dataset with sample be

[R] Finding the nearest data in intraday data from two zoo objects

2010-11-24 Thread Santosh Srinivas
Hello Group, I have the following options and future data in zoo objects > head(optData.z) ExpDt OptTyp Strike TrdPrice TotTrdQty 2009-01-01 09:55:03 20090129 1 2900 180.50 2009-01-01 09:55:31 20090129 1 2900 188.50 2009-01-01 09:55:37

[R] Installing RQuantLib on Win 7 64 Bit

2010-11-25 Thread Santosh Srinivas
Hello Group, I am trying out RQuantLib on a 64bit Win 7 machine. But running into installation errors install.packages("RQuantLib") Warning in install.packages("RQuantLib") : argument 'lib' is missing: using 'C:\Users\Tester\Documents/R/win64-library/2.11' Warning: unable to access index for r

Re: [R] Installing RQuantLib on Win 7 64 Bit

2010-11-26 Thread Santosh Srinivas
To: santosh.srini...@gmail.com From: e...@debian.org CC: r-help@r-project.org Subject: Re: [R] Installing RQuantLib on Win 7 64 Bit On 26 November 2010 at 07:05, Santosh Srinivas wrote: | Hello Group, | | I am trying out RQuantLib on a 64bit Win 7 machine. But running into | installation errors

[R] Difference between loops and vectorization

2010-11-30 Thread Santosh Srinivas
Hello R-helpers, A fundamental question ...I'm trying to understand the differences between loop and vectorization ... I understand that it should be a natural choice to use apply / adply when it is needed to perform the same function across all rows of a data frame. Any pointers on why this is so

[R] using foreach (parallel processing)

2010-12-02 Thread Santosh Srinivas
Hello group, I am experimenting with parallel processing on my quad core Win 7 32 bit machine. Using these packages for the first time. I can see all my processor running at full performance when I use a smaller dataset require(snow) require(doSNOW) require(foreach) #change the 8 to however many

Re: [R] using foreach (parallel processing)

2010-12-02 Thread Santosh Srinivas
Thanks. I guess I had to wait long enough to get the threads running and now they seem be on top gear. Hope this thing doesn't crash now! On Thu, Dec 2, 2010 at 3:36 PM, Rainer M Krug wrote: > -BEGIN PGP SIGNED MESSAGE- > Hash: SHA1 > > On 12/02/2010 10:56 AM, Santo

Re: [R] colname refered by a variable

2010-12-02 Thread Santosh Srinivas
try this .. df[,colnames(df)==paste("A","C",sep="")] On Fri, Dec 3, 2010 at 12:05 PM, Yuan Jian wrote: > Hello, > > I tried to use a variable to refer colname, but I got error, could anyone > give me advice? > >>df=data.frame(cbind(AB=1:3,AC=3:5)) >> df$AC > [1] 3 4 5 >> df$paste("A","C",sep=""

[R] Querying a data frame or data.table

2010-12-03 Thread Santosh Srinivas
Hello Group, Is there an easy way to query a data.frame or data.table (this is fast!) for multiple conditions? I don't want to use a SQL kind of statement. I am looking for something like a subset with multiple conditions. Any tips of the like the binary search methodology used for data.table wo

[R] intraday zoo

2010-12-03 Thread Santosh Srinivas
I'm trying to read intraday zoo but running into issues (again) ... what am I missing here? (the date doesn't seem to read in correctly) > head(dat) TrdDate TrdTime impliedVol 1 20090102 09:55:03 0.3610715 2 20090102 09:55:04 0.3637943 3 20090102 09:55:05 0.3752375 4 20090102 09:55:05 0.41

[R] data.table query

2010-12-03 Thread Santosh Srinivas
Hello Group, I need a modification in the data.table example to get my intended result shown below ... is there a more simple way! dt <- data.table(A = rep(1:3, each=4), B = rep(1:4, each=3), C = rep(1:2, 6)) dt[, transform(.SD,D=mean(A)), by="B"] The result I want is below ... which is probabl

[R] grep for strings

2010-12-04 Thread Santosh Srinivas
I am trying to find the function where I can search for a pattern in a text string (I thought I could use grep for this but no :(). > x [1] "abcdefghijkl" I want to find the positions (i.e. equivalent of nchar) for "cd" and in case there are multiple hits .. then the results as a array Thank you

[R] foreach question

2010-12-05 Thread Santosh Srinivas
Hello Group, I am experimenting with parallel processing ... here is part of my code. require(snow) require(doSNOW) require(foreach) cl.tmp = makeCluster(rep("localhost",4), type="SOCK") registerDoSNOW(cl.tmp) foreach(i=1:NROW(sDat),.packages="gdata",.verbose=TRUE) %dopar% { do somethin

Re: [R] merging two vectors

2010-12-05 Thread Santosh Srinivas
unique(c(x,y)) On Sun, Dec 5, 2010 at 8:27 PM, ram basnet wrote: > Dear R users, > > It may be very simple but it is being difficult for me. > I have two vectors with some common string. And, i want to combine into a > vector in such a way that it includes string from both vectors and make a >

[R] Time out for a R Function

2010-12-06 Thread Santosh Srinivas
Hello Group, I have an R-function that works fine for most part but sometime runs into a long loop! (I'm lazy and short on time to debug right now so want to do something easy) For my purpose, it is ok to make few errors is there a way I can put a timeout on a function and the r-process neede

Re: [R] Creating binary variable depending on strings of two dataframes

2010-12-07 Thread Santosh Srinivas
your question is not clear to me .. but your solution is a variation of > data1$x.1 <- data1$x1 %in% data2$y1 you can play with your conditions to get the result you want On Tue, Dec 7, 2010 at 10:00 PM, Pete Pete wrote: > > Hi, > consider the following two dataframes: > x1=c("232","3454","3455

Re: [R] Time out for a R Function

2010-12-08 Thread Santosh Srinivas
osh Srinivas Cc: r-help@r-project.org Subject: Re: [R] Time out for a R Function On Tue, 7 Dec 2010, Santosh Srinivas wrote: > Hello Group, > > I have an R-function that works fine for most part but sometime runs into a > long loop! (I'm lazy and short on time to debug right now so wa

Re: [R] One question about R

2010-12-08 Thread Santosh Srinivas
Why 2.8? You should perhaps go for 2.12 ... I like 2.11 right now because most of my work has been tested on it already and it is quite stable with other packages. But, the ideally you should go for 2.12 which is the most recent release and has substantial enhancements. Then you should post the e

Re: [R] hi have a question about merging.

2010-12-08 Thread Santosh Srinivas
Try this male.df <- subset(raceprofiling, (male==1)) female.df <- subset(raceprofiling, (male==0)) people.df <- rbind(male.df,female.df) works? -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of tanzia chaudhury Sent: 09 December 2010

[R] Rapache on windows

2010-12-11 Thread Santosh Srinivas
Hello all, I searched on the www but could not find installation instructution for rapache on windows. The page says that the release runs on UNIX/Linux and Mac OS X operating systems. Has anyone been able to configure it on windows? Any idea how to go about it? Thank you. __

  1   2   >