[R] Calling R functions into C# or C++
Hi R, I have a request... Can I call R functions/routines from C# or C++? If so, how do I do this? Do I need to have some knowledge on DLL to do this? Thanks a lot for your help, Shubha Shubha Karanth | Amba Research Ph +91 80 3980 8031 | Mob +91 94 4886 4510 Bangalore * Colombo * London * New York * San José * Singapore * www.ambaresearch.com This e-mail may contain confidential and/or privileged i...{{dropped:13}} __ 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 provide commented, minimal, self-contained, reproducible code.
[R] Comparison between R and MATLAB
Hi R, Can I get a comparison between R and MATLAB? How is R efficient than MATLAB? Or what are the weaknesses of R compared to MATLAB? Thank you very much for your help, Shubha Shubha Karanth | Amba Research Ph +91 80 3980 8031 | Mob +91 94 4886 4510 Bangalore * Colombo * London * New York * San José * Singapore * www.ambaresearch.com This e-mail may contain confidential and/or privileged i...{{dropped:13}} __ 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 provide commented, minimal, self-contained, reproducible code.
[R] Sum(Random Numbers)=100
Hi R, I need to generate 50 random numbers (preferably poisson), such that their sum is equal to 100. How do I do this? Thank you, Shubha This e-mail may contain confidential and/or privileged i...{{dropped:13}} __ 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 provide commented, minimal, self-contained, reproducible code.
Re: [R] Sum(Random Numbers)=100
...actually I need to allocate certain amount of money (here I mentioned it as 100) to a randomly selected stocks(50 stocks)... i.e., 100 being divided among 50 stocks and preferably all are integer allocations(i.e., 5 8 56 12 etc without any decimals)... Thank you, Shubha -Original Message- From: Moshe Olshansky [mailto:[EMAIL PROTECTED] Sent: Tuesday, July 08, 2008 12:09 PM To: [EMAIL PROTECTED]; Shubha Vishwanath Karanth Subject: Re: [R] Sum(Random Numbers)=100 If they are really random you can not expect their sum to be 100. However, it is not difficult to get that given that the sum of n independent Poisson random variables equals N, any individual one has the conditional binomial distribution with size = N and p = 1/n, i.e. P(Xi=k/Sn=N) = (N over k)*(1/n)^k*((n-1)/n)^(N-k). So you can generate X1 binomial with size = 100 and p = 1/50; if X1 = k1 then the sum of the rest 49 must equal 100 - k1, so now you generate X2 binomial with size = 100-k1 and p = 1/49; if X2 = k2 then generate X3 binomial with size = 100 -(k1+k2) and p = 1/48, etc. Why do you need this? --- On Tue, 8/7/08, Shubha Vishwanath Karanth <[EMAIL PROTECTED]> wrote: > From: Shubha Vishwanath Karanth <[EMAIL PROTECTED]> > Subject: [R] Sum(Random Numbers)=100 > To: [EMAIL PROTECTED] > Received: Tuesday, 8 July, 2008, 3:58 PM > Hi R, > > > > I need to generate 50 random numbers (preferably poisson), > such that > their sum is equal to 100. How do I do this? > > > > > > Thank you, > > Shubha > > > > This e-mail may contain confidential and/or privileged > i...{{dropped:13}} > > __ > 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 provide commented, minimal, self-contained, > reproducible code. This e-mail may contain confidential and/or privileged i...{{dropped:10}} __ 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 provide commented, minimal, self-contained, reproducible code.
[R] A neural network problem---neuralnet package
Hi R, Here's a question/problem on the 'neuralnet' package for neural networks. I have more than 50 factors in each of my independent variables. When I apply the command 'neuralnet', I get the below warning message, > net.sum <- neuralnet( Sum~Var1+Var2+Var3, b, hidden=0,linear.output=TRUE) Warning message: 'predictions' will not be calculated, as at least one covariate contains more than 50 different values > > net.sum$predictions NULL Understand that the documentation of 'neuralnet' also says this. But I need to get the predictions. How do I achieve this? Thanks, Shubha This e-mail may contain confidential and/or privileged i...{{dropped:13}} __ 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 provide commented, minimal, self-contained, reproducible code.
[R] Simple... but...
Hi R, If x=c(1,3,5) y=c(2,4,6) I need a vector which is c(1,2,3,4,5,6) from x and y. How do I do it? I mean the best way Thanks, Shubha This e-mail may contain confidential and/or privileged i...{{dropped:13}} __ 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 provide commented, minimal, self-contained, reproducible code.
Re: [R] Simple... but...
Guess this should be fine c(rbind(x,y)) Please let me know if there are some better ways... Thanks, Shubha -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Shubha Vishwanath Karanth Sent: Wednesday, July 23, 2008 6:25 PM To: [EMAIL PROTECTED] Subject: [R] Simple... but... Hi R, If x=c(1,3,5) y=c(2,4,6) I need a vector which is c(1,2,3,4,5,6) from x and y. How do I do it? I mean the best way Thanks, Shubha This e-mail may contain confidential and/or privileged i...{{dropped:13}} __ 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 provide commented, minimal, self-contained, reproducible code. This e-mail may contain confidential and/or privileged i...{{dropped:10}} __ 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 provide commented, minimal, self-contained, reproducible code.
Re: [R] Simple... but...
OK, Let x=c(4,2,2) y=c(1,5,3) My result should be c(4,1,2,5,2,3) Thanks, Shubha -Original Message- From: Doran, Harold [mailto:[EMAIL PROTECTED] Sent: Wednesday, July 23, 2008 6:47 PM To: Shubha Vishwanath Karanth; [EMAIL PROTECTED] Subject: RE: [R] Simple... but... x <- c(1,3,5) y <- c(2,4,6) sort(c(x,y)) > -Original Message- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] On Behalf Of Shubha > Vishwanath Karanth > Sent: Wednesday, July 23, 2008 8:55 AM > To: [EMAIL PROTECTED] > Subject: [R] Simple... but... > > Hi R, > > > > If > > x=c(1,3,5) > > y=c(2,4,6) > > > > I need a vector which is c(1,2,3,4,5,6) from x and y. > > > > How do I do it? I mean the best way > > > > Thanks, Shubha > > > > This e-mail may contain confidential and/or privileged > i...{{dropped:13}} > > __ > 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 provide commented, minimal, self-contained, reproducible code. > This e-mail may contain confidential and/or privileged i...{{dropped:10}} __ 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 provide commented, minimal, self-contained, reproducible code.
[R] sequential sum of a vector...
Hi R, Let, x=1:80 I want to sum up first 8 elements of x, then again next 8 elements of x, then again another 8 elements. So, my new vector should look like: c(36,100,164,228,292,356,420,484,548,612) I used: aggregate(x,list(rep(1:10,each=8)),sum)[-1] or rowsum(x,group=rep(1:10,each=8)) But without grouping, can I achieve the required? Any other ways of doing this? Thanks, Shubha This e-mail may contain confidential and/or privileged i...{{dropped:13}} __ 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 provide commented, minimal, self-contained, reproducible code.
Re: [R] sequential sum of a vector...
Many Thanks Jorge... That was one more way...Is it possible if I can do this without using rep(1:10,each=8) or the groupingbecause I feel the number 8 here is fixed... If there is some technique of tracking the position of first 8, then next 8... don't know whether I am clear in conveying... Thanks, shubha From: Jorge Ivan Velez [mailto:[EMAIL PROTECTED] Sent: Wednesday, July 23, 2008 8:59 PM To: Shubha Vishwanath Karanth Cc: [EMAIL PROTECTED] Subject: Re: [R] sequential sum of a vector... Dear Shubha, Try this: x=1:80 tapply(x,rep(1:10,each=8),sum) 1 2 3 4 5 6 7 8 9 10 36 100 164 228 292 356 420 484 548 612 HTH, Jorge On Wed, Jul 23, 2008 at 10:03 AM, Shubha Vishwanath Karanth <[EMAIL PROTECTED]> wrote: Hi R, Let, x=1:80 I want to sum up first 8 elements of x, then again next 8 elements of x, then again another 8 elements. So, my new vector should look like: c(36,100,164,228,292,356,420,484,548,612) I used: aggregate(x,list(rep(1:10,each=8)),sum)[-1] or rowsum(x,group=rep(1:10,each=8)) But without grouping, can I achieve the required? Any other ways of doing this? Thanks, Shubha This e-mail may contain confidential and/or privileged i...{{dropped:13}} __ 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 provide commented, minimal, self-contained, reproducible code. This e-mail may contain confidential and/or privileged i...{{dropped:13}} __ 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 provide commented, minimal, self-contained, reproducible code.
[R] "dens" function
Hi R, Is there a function called "dens" in R? Is it similar to density? I found this function in an RExcel demo... Or is it in a specific other package? The function is used as (=rapply("dens",A11:A1010,100,D8,-5,5)) Thanks, Shubha This e-mail may contain confidential and/or privileged i...{{dropped:13}} __ 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 provide commented, minimal, self-contained, reproducible code.
[R] Downloading Yahoo data
Hi R, I am trying to download the data from R. I give the below command. > library(fImport) > yahooSeries("IBM") trying URL 'http://chart.yahoo.com/table.csv?s=IBM&a=7&b=08&c=2007&d=7&e=07&f=2008&; g=d&x=.csv' Error in download.file(url = url, destfile = file, method = method) : cannot open URL 'http://chart.yahoo.com/table.csv?s=IBM&a=7&b=08&c=2007&d=7&e=07&f=2008&; g=d&x=.csv' In addition: Warning message: In download.file(url = url, destfile = file, method = method) : unable to connect to 'chart.yahoo.com' on port 80. Error: cannot get a slot ("data") from an object of type "character" In addition: Warning message: trying to get slot "data" from an object of a basic class ("character") with no slots The problem is related with connection of R with the internet. But my port 80 is opened. Then also the error persists. And also, the link is accessible in my PC via the direct internet. How do I make this work? Many Thanks, Shubha This e-mail may contain confidential and/or privileged i...{{dropped:13}} __ 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 provide commented, minimal, self-contained, reproducible code.
Re: [R] Downloading Yahoo data
Yes Henrique... we are connecting to the internet through a proxy... Thanks, Shubha Shubha Karanth | Amba Research Ph +91 80 3980 8031 | Mob +91 94 4886 4510 Bangalore * Colombo * London * New York * San José * Singapore * www.ambaresearch.com -Original Message- From: Henrique Dallazuanna [mailto:[EMAIL PROTECTED] Sent: Thursday, August 07, 2008 8:17 PM To: Shubha Vishwanath Karanth Cc: [EMAIL PROTECTED] Subject: Re: [R] Downloading Yahoo data You are connecting to the internet trougth a proxy? On Thu, Aug 7, 2008 at 9:40 AM, Shubha Vishwanath Karanth <[EMAIL PROTECTED]> wrote: > Hi R, > > > > I am trying to download the data from R. I give the below command. > > > >> library(fImport) > >> yahooSeries("IBM") > > trying URL > 'http://chart.yahoo.com/table.csv?s=IBM&a=7&b=08&c=2007&d=7&e=07&f=2008&; > g=d&x=.csv' > > Error in download.file(url = url, destfile = file, method = method) : > > cannot open URL > 'http://chart.yahoo.com/table.csv?s=IBM&a=7&b=08&c=2007&d=7&e=07&f=2008&; > g=d&x=.csv' > > In addition: Warning message: > > In download.file(url = url, destfile = file, method = method) : > > unable to connect to 'chart.yahoo.com' on port 80. > > Error: cannot get a slot ("data") from an object of type "character" > > In addition: Warning message: > > trying to get slot "data" from an object of a basic class ("character") > with no slots > > > > > > The problem is related with connection of R with the internet. But my > port 80 is opened. Then also the error persists. > > > > And also, the link is accessible in my PC via the direct internet. How > do I make this work? > > > > Many Thanks, > > Shubha > > > > This e-mail may contain confidential and/or privileged i...{{dropped:13}} > > __ > 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 provide commented, minimal, self-contained, reproducible code. > -- Henrique Dallazuanna Curitiba-Paraná-Brasil 25° 25' 40" S 49° 16' 22" O This e-mail may contain confidential and/or privileged i...{{dropped:10}} __ 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 provide commented, minimal, self-contained, reproducible code.
[R] Between the values
Hi R, This is a very trivial one C=0.1 I want to check whether my value of C is between 0 and 1 exclusively I don't want to use (C>0 & C<1). And I can't use a single statement like (0https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Between the values
Or at least anyways of defining a vector/(or something like that) which has all values between 0 and 1? For example: C(0,1) is incorrect, seq(0,1,0.2) is also incorrect, seq(0,1,0.1) is also incorrect How does one specify this? Thanks, Shubha -Original Message- From: Dan Davison [mailto:[EMAIL PROTECTED] Sent: Tuesday, August 12, 2008 5:54 PM To: Shubha Vishwanath Karanth Cc: [EMAIL PROTECTED] Subject: Re: [R] Between the values On Tue, Aug 12, 2008 at 05:16:01PM +0530, Shubha Vishwanath Karanth wrote: > Hi R, > > > > This is a very trivial one > > > > C=0.1 > > > > I want to check whether my value of C is between 0 and 1 exclusively > I don't want to use (C>0 & C<1). And I can't use a single statement like > (0 Does %in% help me? If you don't like (C > 0 && C < 1), then just write your own function is.between(x, low, high) (NB1 you've basically written it already; NB2 single '&' for the vectorised version 'are.between'). People's personal tastes about what's desirable will vary, and anyway it's good practice to build up your own personal library of functions. Ultimately if you have a high quality collection of related functions for working on a particular sort of problem, then you should publish them as an R package on CRAN. Dan > > > > > > Many Thanks, > > Shubha > > > > This e-mail may contain confidential and/or privileged i...{{dropped:13}} > > __ > 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 provide commented, minimal, self-contained, reproducible code. -- www.stats.ox.ac.uk/~davison This e-mail may contain confidential and/or privileged i...{{dropped:10}} __ 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 provide commented, minimal, self-contained, reproducible code.
Re: [R] Between the values
Thanks Ravi... But was just wondering if there existed a simple tricky command for that without using the & condition Also was thinking on my second question that how do we define an interval between 0 and 1 which contains all the values between 0 and 1. Thanks, Shubha Shubha Karanth | Amba Research Ph +91 80 3980 8031 | Mob +91 94 4886 4510 Bangalore * Colombo * London * New York * San José * Singapore * www.ambaresearch.com -Original Message- From: Ravi Varadhan [mailto:[EMAIL PROTECTED] Sent: Tuesday, August 12, 2008 7:12 PM To: Shubha Vishwanath Karanth; 'Dan Davison' Cc: [EMAIL PROTECTED] Subject: RE: [R] Between the values Hi Shubaa, Here is one way to do this: is.between <- function(x, a, b) { x > a & x < b } set.seed(123) x <- rnorm(5) is.between(x, -1, 1) > is.between(x, -1, 1) [1] TRUE TRUE FALSE TRUE TRUE > Ravi. -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Shubha Vishwanath Karanth Sent: Tuesday, August 12, 2008 9:25 AM To: Dan Davison Cc: [EMAIL PROTECTED] Subject: Re: [R] Between the values Or at least anyways of defining a vector/(or something like that) which has all values between 0 and 1? For example: C(0,1) is incorrect, seq(0,1,0.2) is also incorrect, seq(0,1,0.1) is also incorrect How does one specify this? Thanks, Shubha -Original Message- From: Dan Davison [mailto:[EMAIL PROTECTED] Sent: Tuesday, August 12, 2008 5:54 PM To: Shubha Vishwanath Karanth Cc: [EMAIL PROTECTED] Subject: Re: [R] Between the values On Tue, Aug 12, 2008 at 05:16:01PM +0530, Shubha Vishwanath Karanth wrote: > Hi R, > > > > This is a very trivial one > > > > C=0.1 > > > > I want to check whether my value of C is between 0 and 1 exclusively > I don't want to use (C>0 & C<1). And I can't use a single statement like > (0 Does %in% help me? If you don't like (C > 0 && C < 1), then just write your own function is.between(x, low, high) (NB1 you've basically written it already; NB2 single '&' for the vectorised version 'are.between'). People's personal tastes about what's desirable will vary, and anyway it's good practice to build up your own personal library of functions. Ultimately if you have a high quality collection of related functions for working on a particular sort of problem, then you should publish them as an R package on CRAN. Dan > > > > > > Many Thanks, > > Shubha > > > > This e-mail may contain confidential and/or privileged i...{{dropped:13}} > > __ > 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 provide commented, minimal, self-contained, reproducible code. -- www.stats.ox.ac.uk/~davison This e-mail may contain confidential and/or privileged i...{{dropped:10}} __ 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 provide commented, minimal, self-contained, reproducible code. This e-mail may contain confidential and/or privileged i...{{dropped:10}} __ 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 provide commented, minimal, self-contained, reproducible code.
Re: [R] Between the values
ThanksDidn't mean actually using '&', but not bigger than that too... I usually see something done much better in R-help by a code which I don't know at all. So, wanted to know if I am missing somewhere in using some codes which I am not aware of...so, posted the query... Thanks for your help, Shubha Shubha Karanth | Amba Research Ph +91 80 3980 8031 | Mob +91 94 4886 4510 Bangalore * Colombo * London * New York * San José * Singapore * www.ambaresearch.com -Original Message- From: Ravi Varadhan [mailto:[EMAIL PROTECTED] Sent: Tuesday, August 12, 2008 7:34 PM To: Shubha Vishwanath Karanth; 'Dan Davison' Cc: [EMAIL PROTECTED] Subject: RE: [R] Between the values Here is how you check whether a < x < b "without" using the `&' condition: is.between <- function(x, a, b) { (x - a) * (b - x) > 0 } Ravi. -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Shubha Vishwanath Karanth Sent: Tuesday, August 12, 2008 9:46 AM To: Ravi Varadhan; Dan Davison; Ravi Varadhan; Dan Davison; Ravi Varadhan; Dan Davison; Ravi Varadhan; Dan Davison Cc: [EMAIL PROTECTED]; [EMAIL PROTECTED]; [EMAIL PROTECTED]; [EMAIL PROTECTED] Subject: Re: [R] Between the values Thanks Ravi... But was just wondering if there existed a simple tricky command for that without using the & condition Also was thinking on my second question that how do we define an interval between 0 and 1 which contains all the values between 0 and 1. Thanks, Shubha Shubha Karanth | Amba Research Ph +91 80 3980 8031 | Mob +91 94 4886 4510 Bangalore * Colombo * London * New York * San José * Singapore * www.ambaresearch.com -Original Message- From: Ravi Varadhan [mailto:[EMAIL PROTECTED] Sent: Tuesday, August 12, 2008 7:12 PM To: Shubha Vishwanath Karanth; 'Dan Davison' Cc: [EMAIL PROTECTED] Subject: RE: [R] Between the values Hi Shubaa, Here is one way to do this: is.between <- function(x, a, b) { x > a & x < b } set.seed(123) x <- rnorm(5) is.between(x, -1, 1) > is.between(x, -1, 1) [1] TRUE TRUE FALSE TRUE TRUE > Ravi. -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Shubha Vishwanath Karanth Sent: Tuesday, August 12, 2008 9:25 AM To: Dan Davison Cc: [EMAIL PROTECTED] Subject: Re: [R] Between the values Or at least anyways of defining a vector/(or something like that) which has all values between 0 and 1? For example: C(0,1) is incorrect, seq(0,1,0.2) is also incorrect, seq(0,1,0.1) is also incorrect How does one specify this? Thanks, Shubha -Original Message- From: Dan Davison [mailto:[EMAIL PROTECTED] Sent: Tuesday, August 12, 2008 5:54 PM To: Shubha Vishwanath Karanth Cc: [EMAIL PROTECTED] Subject: Re: [R] Between the values On Tue, Aug 12, 2008 at 05:16:01PM +0530, Shubha Vishwanath Karanth wrote: > Hi R, > > > > This is a very trivial one > > > > C=0.1 > > > > I want to check whether my value of C is between 0 and 1 exclusively > I don't want to use (C>0 & C<1). And I can't use a single statement like > (0 Does %in% help me? If you don't like (C > 0 && C < 1), then just write your own function is.between(x, low, high) (NB1 you've basically written it already; NB2 single '&' for the vectorised version 'are.between'). People's personal tastes about what's desirable will vary, and anyway it's good practice to build up your own personal library of functions. Ultimately if you have a high quality collection of related functions for working on a particular sort of problem, then you should publish them as an R package on CRAN. Dan > > > > > > Many Thanks, > > Shubha > > > > This e-mail may contain confidential and/or privileged i...{{dropped:13}} > > __ > 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 provide commented, minimal, self-contained, reproducible code. -- www.stats.ox.ac.uk/~davison This e-mail may contain confidential and/or privileged i...{{dropped:10}} __ 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 provide commented, minimal, self-contained, reproducible code. This e-mail may contain confidential and/or privileged i...{{dropped:10}} __ 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 provide commented,
Re: [R] Between the values
Not to define a vector of all infinite values... But if I have some object (may not be a vector) which has this interval, then I can apply whatever function I need to on this interval apart from 'between' function... Is there something like that... Hope I am clear with the idea... Thanks, Shubha Shubha Karanth | Amba Research Ph +91 80 3980 8031 | Mob +91 94 4886 4510 Bangalore * Colombo * London * New York * San José * Singapore * www.ambaresearch.com -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Dan Davison Sent: Tuesday, August 12, 2008 7:21 PM To: r-help@r-project.org Subject: Re: [R] Between the values Shubha Vishwanath Karanth wrote: > > Or at least anyways of defining a vector/(or something like that) which > has all values between 0 and 1? > > For example: > C(0,1) is incorrect, seq(0,1,0.2) is also incorrect, seq(0,1,0.1) is > also incorrect How does one specify this? > > Hi Shubha, What are you trying to do? The set of all real numbers between 0 and 1 is infinitely large. Obviously you can't explicitly construct an infinitely large vector in R. If you want to construct an implicit specification of that set, then I think I've already given you a good answer in R: define a predicate function and use it. E.g. between <- function(x, low, high) x > low && x < high I don't know much at all about symbolic mathematics packages like Maple and Mathematica, but maybe you're thinking of something you can do in those softwares? R is not trying to be a competitor to them; they do lots of things R doesn't, and vice versa. Dan Shubha Vishwanath Karanth wrote: > > > Thanks, Shubha > > > -Original Message----- > From: Dan Davison [mailto:[EMAIL PROTECTED] > Sent: Tuesday, August 12, 2008 5:54 PM > To: Shubha Vishwanath Karanth > Cc: [EMAIL PROTECTED] > Subject: Re: [R] Between the values > > On Tue, Aug 12, 2008 at 05:16:01PM +0530, Shubha Vishwanath Karanth > wrote: >> Hi R, >> >> >> >> This is a very trivial one >> >> >> >> C=0.1 >> >> >> >> I want to check whether my value of C is between 0 and 1 > exclusively >> I don't want to use (C>0 & C<1). And I can't use a single statement > like >> (0 1? >> Does %in% help me? > > If you don't like (C > 0 && C < 1), then just write your own function > is.between(x, low, high) (NB1 you've basically written it already; NB2 > single '&' for the vectorised version 'are.between'). People's > personal tastes about what's desirable will vary, and anyway it's good > practice to build up your own personal library of > functions. Ultimately if you have a high quality collection of related > functions for working on a particular sort of problem, then you should > publish them as an R package on CRAN. > > Dan > >> >> >> >> >> >> Many Thanks, >> >> Shubha >> >> >> >> This e-mail may contain confidential and/or privileged > i...{{dropped:13}} >> >> __ >> 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 provide commented, minimal, self-contained, reproducible code. > > -- > www.stats.ox.ac.uk/~davison > This e-mail may contain confidential and/or privileged i...{{dropped:10}} > > __ > 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 provide commented, minimal, self-contained, reproducible code. > > -- View this message in context: http://www.nabble.com/Between-the-values-tp18943069p18944668.html Sent from the R help mailing list archive at Nabble.com. __ 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 provide commented, minimal, self-contained, reproducible code. This e-mail may contain confidential and/or privileged i...{{dropped:10}} __ 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 provide commented, minimal, self-contained, reproducible code.
Re: [R] extracting max row from data matrix
> aggregate(x$weight,list(x$fruit),max) Group.1 x 1 apple 1.6 2 orange 1.6 Shubha Karanth | Amba Research Ph +91 80 3980 8031 | Mob +91 94 4886 4510 Bangalore * Colombo * London * New York * San José * Singapore * www.ambaresearch.com -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Srinivas Iyyer Sent: Monday, September 08, 2008 7:55 AM To: [EMAIL PROTECTED] Subject: [R] extracting max row from data matrix dear group, i have a data matrix with some replicate items with different values. I want to extract the row with max value. for example: > x fruit weight 1 apple1.3 2 apple1.5 3 apple1.6 4 orange1.4 5 orange1.6 x is a data frame. I want to extract unique items from fruits that has max weight. that is: 3 apple1.6 5 orange1.6 I want to be able to use apply functions. Could some one lend some help please. Thanks srini __ 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 provide commented, minimal, self-contained, reproducible code. This e-mail may contain confidential and/or privileged i...{{dropped:10}} __ 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 provide commented, minimal, self-contained, reproducible code.
[R] To find vector X under contraints
Hi R, I have the variance-covariance matrix, >V=matrix(c(0.09238, 0.002407527, 0.002407527, 0.020739401),2,2) I need to find a vector X=c(x1,x2), such that 1) X'VX is equal to a constant 2 (say) and 2) sum(x) should be equal to a another constant 1.5 (say). How do we do this in R? BR, Shubha Shubha Karanth | Amba Research Ph +91 80 3980 8031 | Mob +91 94 4886 4510 Bangalore * Colombo * London * New York * San José * Singapore * www.ambaresearch.com This e-mail may contain confidential and/or privileged i...{{dropped:13}} __ 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 provide commented, minimal, self-contained, reproducible code.
[R] Cross-tabulation Question
Hi R, This is a cross tabulation question. Suppose that, > d=read.table("clipboard",header=F) > d V1 V2V3 A One Apple A One Cake A One Cake B One Apple B One Apple B One Apple > table(d$V2,d$V3) Apple Cake One 42 But, I don't want the count to be like the above. Here, it is counting the number of rows in that particular category. What I need is in each category, the count of unique V1's. So, my output should look like, Apple Cake One 21 Any ideas please... Thanks, Shubha This e-mail may contain confidential and/or privileged i...{{dropped:13}} __ 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 provide commented, minimal, self-contained, reproducible code.
[R] Rolling Correlations
Hi R, I want to do some rolling correlations. But before, I searched for "?rollingCorrelation" and tried the example in it. But I was not successful. What could be the problem? Here is the code I tried: > library(zoo) > library(PerformanceAnalytics) > rollingCorrelation([EMAIL PROTECTED],1],[EMAIL PROTECTED],n=12) Error in inherits(object, "zoo") : object "manager.ts" not found BR, Shubha [[alternative HTML version deleted]] __ 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 provide commented, minimal, self-contained, reproducible code.
[R] FW: Rolling Correlations
Hi, Any help on this please BR, Shubha -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Shubha Vishwanath Karanth Sent: Friday, November 30, 2007 6:09 PM To: [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Subject: [R] Rolling Correlations Hi R, I want to do some rolling correlations. But before, I searched for "?rollingCorrelation" and tried the example in it. But I was not successful. What could be the problem? Here is the code I tried: > library(zoo) > library(PerformanceAnalytics) > rollingCorrelation([EMAIL PROTECTED],1],[EMAIL PROTECTED],n=12) Error in inherits(object, "zoo") : object "manager.ts" not found BR, Shubha [[alternative HTML version deleted]] __ 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 provide commented, minimal, self-contained, reproducible code. __ 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 provide commented, minimal, self-contained, reproducible code.
[R] iid.test package/ncdf package
Hi R, I want to conduct iid tests. So, I went to download 'iid.test' package. And the dependent package is 'ncdf', which is not available. So, how do I conduct the IID tests? Can I do these iid tests in Base R? Thanks in advance, Shubha This e-mail may contain confidential and/or privileged i...{{dropped:12}} __ 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 provide commented, minimal, self-contained, reproducible code.
[R] Accesing the value
Hi R, x="A" A=5 I need to get the value of A using x only. How do I do this? Thanks in advance, Shubha This e-mail may contain confidential and/or privileged i...{{dropped:13}} __ 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 provide commented, minimal, self-contained, reproducible code.
[R] EQUALITY constraints in 'constrOptim'
Does anybody know to introduce EQUALITY constraints in 'constrOptim' function? BR, Shubha This e-mail may contain confidential and/or privileged i...{{dropped:13}} __ 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 provide commented, minimal, self-contained, reproducible code.
[R] acf lag1 value
Hi R, I have doubt. >x= c(4,5,6,3,2,4,5) >acf(x,plot=F,lag.max=1) Autocorrelations of series 'x', by lag 0 1 1.000 0.182 But if I actually calculate the autocorrelation at lag1 I get, >cor(x[-1],x[-length(x)]) [1] 0.1921538 Even in excel I get 0.1921538 value. So, I want to know what the 'acf' function is calculating here Thanks in advance, Shubha Karanth This e-mail may contain confidential and/or privileged i...{{dropped:13}} __ 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 provide commented, minimal, self-contained, reproducible code.
Re: [R] acf lag1 value
Thank you Professor... Shubha Karanth | Amba Research Ph +91 80 3980 8031 | Mob +91 94 4886 4510 Bangalore * Colombo * London * New York * San José * Singapore * www.ambaresearch.com -Original Message- From: Prof Brian Ripley [mailto:[EMAIL PROTECTED] Sent: Thursday, January 17, 2008 2:27 PM To: Shubha Vishwanath Karanth Cc: [EMAIL PROTECTED] Subject: Re: [R] acf lag1 value Please re-check your time-series books. The acf at lag 1 is _not_ the correlation between x and lag(x). For one thing, the variance of x is computed from the whole series, and not from the series with either the first or last value removed -- there is also the question of the divisor. See MASS p.390 for the formulae used. On Thu, 17 Jan 2008, Shubha Vishwanath Karanth wrote: > Hi R, > > > > I have doubt. > > > >> x= c(4,5,6,3,2,4,5) > >> acf(x,plot=F,lag.max=1) > > > > Autocorrelations of series 'x', by lag > > > >0 1 > > 1.000 0.182 > > > > But if I actually calculate the autocorrelation at lag1 I get, Not the right formula. > > >> cor(x[-1],x[-length(x)]) > > [1] 0.1921538 > > > > Even in excel I get 0.1921538 value. So, I want to know what the 'acf' > function is calculating here > > > > Thanks in advance, > > Shubha Karanth > > This e-mail may contain confidential and/or privileged i...{{dropped:13}} > > __ > 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 provide commented, minimal, self-contained, reproducible code. > -- Brian D. Ripley, [EMAIL PROTECTED] Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UKFax: +44 1865 272595 This e-mail may contain confidential and/or privileged i...{{dropped:10}} __ 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 provide commented, minimal, self-contained, reproducible code.
[R] constrOptim for quadratic constraints?
Hi, Can I use "constrOptim" for quadratic constraints? If not, which optimizer can I go for? BR, Shubha This e-mail may contain confidential and/or privileged i...{{dropped:13}} __ 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 provide commented, minimal, self-contained, reproducible code.
[R] Accessing the elements of a list
Hi R, I wanted to know how do we access the elements of a list. In particular, v=list(c(1,2,3,4,5),c(1,2,33,4,5),c(1,2,333,4,5),c(1,2,,4,5)) I want to access all the thirds items of the elements of the list. i.e., I want to access the elements, 3,33,333,. This can be done through sapply as: sapply(v,function(x) x[3]) But I need to access this without using 'sapply'. Like in a data frame, we do df[2,3] etc Any ideas? BR, Shubha This e-mail may contain confidential and/or privileged i...{{dropped:13}} __ 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 provide commented, minimal, self-contained, reproducible code.
[R] Downloading Reuters data from R
Hi R, Can we download Reuters (3000 Xtra) data from R? Does ODBC package help me in this? Or otherwise, is there a way to extract daily closing prices data of Reuters from R? Thank you very much, Shubha This e-mail may contain confidential and/or privileged i...{{dropped:13}} __ 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 provide commented, minimal, self-contained, reproducible code.
Re: [R] Downloading Reuters data from R
Thank you very much for this. But since I don't know much of DLL, I am kind of a stuck with how to proceed with 'reuters_ts1.zip'. This zip file contains the 'reuters_ts.dll' file. dyn.load("reuters_ts.dll") generates the error, > dyn.load("Z:\\reuters_ts1\\package\\reuters_ts.dll") Error in inDL(x, as.logical(local), as.logical(now), ...) : unable to load shared library 'C:/Documents and Settings/shubhak/reuters_ts1/package/reuters_ts.dll': LoadLibrary failure: This application has failed to start because the application configuration is incorrect. Reinstalling the application may fix this problem. Where should the 'reuters_ts1.zip' to be stored? And how can I access 'reuters_ts.dll' file for my use? Even checked ?dyn.load, but a bit confused. How do we use this? I am sorry, if this troubles. Mine is a Windows XP Config. Thanks again, Shubha -Original Message- From: rory.wins...@rbs.com [mailto:rory.wins...@rbs.com] Sent: Thursday, December 11, 2008 9:44 PM To: Shubha Vishwanath Karanth; r-h...@stat.math.ethz.ch Subject: RE: Downloading Reuters data from R Hi Shubha I have created an extension DLL for downloading time series data from Reuters. You can download it from here: http://www.theresearchkitchen.com/blog/archives/287 There is also a short manual available at the same location: http://www.theresearchkitchen.com/blog/wp-content/uploads/2008/12/intro. pdf I am currently in the process of uploading a separate extension DLL for retrieval of real-time data from Reuters. Thanks Rory Rory Winston RBS Global Banking & Markets Office: +44 20 7085 4476 -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of Shubha Vishwanath Karanth Sent: 11 December 2008 07:41 To: r-h...@stat.math.ethz.ch Subject: [R] Downloading Reuters data from R Hi R, Can we download Reuters (3000 Xtra) data from R? Does ODBC package help me in this? Or otherwise, is there a way to extract daily closing prices data of Reuters from R? Thank you very much, Shubha This e-mail may contain confidential and/or privileged i...{{dropped:13}} __ 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 provide commented, minimal, self-contained, reproducible code. *** The Royal Bank of Scotland plc. Registered in Scotland No 90312. Registered Office: 36 St Andrew Square, Edinburgh EH2 2YB. Authorised and regulated by the Financial Services Authority This e-mail message is confidential and for use by the addressee only. If the message is received by anyone other than the addressee, please return the message to the sender by replying to it and then delete the message from your computer. Internet e-mails are not necessarily secure. The Royal Bank of Scotland plc does not accept responsibility for changes made to this message after it was sent. Whilst all reasonable care has been taken to avoid the transmission of viruses, it is the responsibility of the recipient to ensure that the onward transmission, opening or use of this message and any attachments will not adversely affect its systems or data. No responsibility is accepted by The Royal Bank of Scotland plc in this regard and the recipient should carry out such virus and other checks as it considers appropriate. Visit our websites at: www.rbs.com www.rbs.com/gbm www.rbsgc.com *** This e-mail may contain confidential and/or privileged information. If you are not the intended recipient (or have received this e-mail in error) please notify the sender immediately and destroy this e-mail. Any unauthorized copying, disclosure or distribution of the material in this e-mail is strictly forbidden. Any views or opinions presented are solely those of the author and do not necessarily represent those of Amba Holdings Inc., and/or its affiliates. Important additional terms relating to this email can be obtained at http://www.ambaresearch.com/disclaimer __ 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 provide commented, minimal, self-contained, reproducible code.
[R] Calling R from SAS
Can I call R from SAS? I tried the below command in SAS, but not working... OPTIONS XWAIT XSYNC; X "C:\Program Files\R\R-2.7.1\bin\R.exe --no-save -quiet <""C:\TEMPO\program.r""> ""C:\TEMPO\program.log"""; Had done this before and it was working perfect... But now, not... Sorry if this query was supposed to be put in SAS mailing list. But thought if someone would have worked with this, can help... Thanks for your help, Shubha This e-mail may contain confidential and/or privileged i...{{dropped:13}} __ 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 provide commented, minimal, self-contained, reproducible code.
Re: [R] Calling R from SAS
Got it working... Just that the R code file's extension was missing in the physical folder... Shubha Karanth | Amba Research Ph +91 80 3980 8031 | Mob +91 94 4886 4510 Bangalore * Colombo * London * New York * San José * Singapore * www.ambaresearch.com -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of Shubha Vishwanath Karanth Sent: Saturday, January 24, 2009 6:58 PM To: r-h...@stat.math.ethz.ch Subject: [R] Calling R from SAS Can I call R from SAS? I tried the below command in SAS, but not working... OPTIONS XWAIT XSYNC; X "C:\Program Files\R\R-2.7.1\bin\R.exe --no-save -quiet <""C:\TEMPO\program.r""> ""C:\TEMPO\program.log"""; Had done this before and it was working perfect... But now, not... Sorry if this query was supposed to be put in SAS mailing list. But thought if someone would have worked with this, can help... Thanks for your help, Shubha This e-mail may contain confidential and/or privileged i...{{dropped:13}} __ 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 provide commented, minimal, self-contained, reproducible code. This e-mail may contain confidential and/or privileged i...{{dropped:10}} __ 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 provide commented, minimal, self-contained, reproducible code.
[R] single plot statement, multiple plots
Hi R, par(mfrow=c(2,2)) x1=(1:5)^1; x2=(1:5)^2; x3=(1:5)^3; x4=(1:5)^4 I need to write a single plot statement, which creates 4 plots (for x1, x2, x3 and x4) in the graphics window, without using 'for' loop. Is this possible? Does 'do.call' help in this context? Or do I have any option in the 'plot' statement itself to do this? Thanks in advance, Shubha This e-mail may contain confidential and/or privileged i...{{dropped:13}} __ 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 provide commented, minimal, self-contained, reproducible code.
Re: [R] single plot statement, multiple plots
Thank you very much Gabor...Zoo is very powerful... Shubha Karanth | Amba Research Ph +91 80 3980 8031 | Mob +91 94 4886 4510 Bangalore * Colombo * London * New York * San José * Singapore * www.ambaresearch.com -Original Message- From: Gabor Grothendieck [mailto:[EMAIL PROTECTED] Sent: Tuesday, May 06, 2008 7:40 PM To: Shubha Vishwanath Karanth Cc: [EMAIL PROTECTED] Subject: Re: [R] single plot statement, multiple plots Try plot.zoo in which case you don't need the par: library(zoo) plot(zoo(cbind(x1, x2, x3, x4)), nc = 2) or plot(zoo(outer(1:5, 1:4, "^")), nc = 2) See ?plot.zoo, ?xyplot.zoo and the three vignettes in the zoo package. On Tue, May 6, 2008 at 9:47 AM, Shubha Vishwanath Karanth <[EMAIL PROTECTED]> wrote: > Hi R, > > > > par(mfrow=c(2,2)) > > x1=(1:5)^1; x2=(1:5)^2; x3=(1:5)^3; x4=(1:5)^4 > > > > I need to write a single plot statement, which creates 4 plots (for x1, > x2, x3 and x4) in the graphics window, without using 'for' loop. Is this > possible? Does 'do.call' help in this context? Or do I have any option > in the 'plot' statement itself to do this? > > > > Thanks in advance, > > Shubha > > This e-mail may contain confidential and/or privileged i...{{dropped:13}} > > __ > 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 provide commented, minimal, self-contained, reproducible code. > This e-mail may contain confidential and/or privileged i...{{dropped:10}} __ 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 provide commented, minimal, self-contained, reproducible code.
Re: [R] single plot statement, multiple plots
Wonderful...This works... lapply(list(x1,x2,x3,x4),plot,type="l") Thanks a lot! -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of David Winsemius Sent: Tuesday, May 06, 2008 7:55 PM To: [EMAIL PROTECTED] Subject: Re: [R] single plot statement, multiple plots "Shubha Vishwanath Karanth" <[EMAIL PROTECTED]> wrote in news:[EMAIL PROTECTED]: > Hi R, > > par(mfrow=c(2,2)) > > x1=(1:5)^1; x2=(1:5)^2; x3=(1:5)^3; x4=(1:5)^4 > > I need to write a single plot statement, which creates 4 plots (for > x1, x2, x3 and x4) in the graphics window, without using 'for' loop. > Is this possible? Does 'do.call' help in this context? Or do I have > any option in the 'plot' statement itself to do this? > Have you considered lapply()? -- David Winsemius __ 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 provide commented, minimal, self-contained, reproducible code. This e-mail may contain confidential and/or privileged i...{{dropped:10}} __ 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 provide commented, minimal, self-contained, reproducible code.
[R] To preserve the class "Matrix"
Hi, Suppose a=matrix(1:9,3,3) > a [,1] [,2] [,3] [1,]147 [2,]258 [3,]369 Now, > class(a[1:2,]) [1] "matrix" > class(a[1:3,]) [1] "matrix" > class(a[,1:2]) [1] "matrix" > class(a[,1:3]) [1] "matrix" But, > class(a[1,]) [1] "integer" > class(a[,1]) [1] "integer" Can in a general way get class(a[1,]) or class(a[,1]) to be "matrix" only? Shubha Karanth | Amba Research Ph +91 80 3980 8031 | Mob +91 94 4886 4510 Bangalore * Colombo * London * New York * San José * Singapore * www.ambaresearch.com This e-mail may contain confidential and/or privileged i...{{dropped:13}} __ 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 provide commented, minimal, self-contained, reproducible code.
Re: [R] To preserve the class "Matrix"
Thank you very much Mark! That worked Just a question, ?[ does give an error to me...how do I find it? Shubha Karanth | Amba Research Ph +91 80 3980 8031 | Mob +91 94 4886 4510 Bangalore * Colombo * London * New York * San José * Singapore * www.ambaresearch.com -Original Message- From: Shubha Vishwanath Karanth Sent: Tuesday, May 06, 2008 8:50 PM To: 'Mark Leeds' Subject: RE: [R] To preserve the class "Matrix" Thank you very much Mark! That worked Just a question, ?[ does give an error to me...how do I find it? Shubha Karanth | Amba Research Ph +91 80 3980 8031 | Mob +91 94 4886 4510 Bangalore * Colombo * London * New York * San José * Singapore * www.ambaresearch.com -Original Message- From: Mark Leeds [mailto:[EMAIL PROTECTED] Sent: Tuesday, May 06, 2008 8:46 PM To: Shubha Vishwanath Karanth Subject: RE: [R] To preserve the class "Matrix" Hui Shubha: If I understand what you're asking, you want to use drop=FALSE as in a[1,,drop=FALSE] That retains the dimension ( ie, the matrixness ) of the object. -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Shubha Vishwanath Karanth Sent: Tuesday, May 06, 2008 11:07 AM To: [EMAIL PROTECTED] Subject: [R] To preserve the class "Matrix" Hi, Suppose a=matrix(1:9,3,3) > a [,1] [,2] [,3] [1,]147 [2,]258 [3,]369 Now, > class(a[1:2,]) [1] "matrix" > class(a[1:3,]) [1] "matrix" > class(a[,1:2]) [1] "matrix" > class(a[,1:3]) [1] "matrix" But, > class(a[1,]) [1] "integer" > class(a[,1]) [1] "integer" Can in a general way get class(a[1,]) or class(a[,1]) to be "matrix" only? Shubha Karanth | Amba Research Ph +91 80 3980 8031 | Mob +91 94 4886 4510 Bangalore * Colombo * London * New York * San Josi * Singapore * www.ambaresearch.com This e-mail may contain confidential and/or privileged i...{{dropped:13}} This e-mail may contain confidential and/or privileged i...{{dropped:10}} __ 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 provide commented, minimal, self-contained, reproducible code.
[R] orders of the arima model
Hi R, Was just checking the "?ar ", the autoregressive model. It's great that R can give the order of the autoregressive model. Suppose if I had 2000 observations to fit an AR model. Then, if I am correct R builds 33+1 autoregressive models (10*log10(2000)=33) and select the order at which the aic's of the models were the least. My question is whether the procedure "?arima " can throw the orders (p and q) of the arima model? Many Thanks, Shubha This e-mail may contain confidential and/or privileged i...{{dropped:13}} __ 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 provide commented, minimal, self-contained, reproducible code.
Re: [R] Re turning variable names with variables (in a function)
You can just go for a small change in the function as, results <- cbind(se, upper, lower, cv) OR results <- data.frame(se, upper, lower, cv) -S- -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Stropharia Sent: Thursday, May 08, 2008 5:51 PM To: r-help@r-project.org Subject: [R] Re turning variable names with variables (in a function) Dear R Users, I have written a function that returns 4 variables. I would like to have the variables returned with their variable names, is this possible? - R Code - mc.error <- function(T, p=0.05){ se <- sqrt((p)*(1-(p))/T) # standard error upper <- p+(1.96*se) # upper CI lower <- p-(1.96*se) # lower CI cv <- se/p # coefficient of variation results <- c(se, upper, lower, cv) return(results) } - R Code - This returns (or something like this, depending on the value of T): [1] 0.004998685 0.059797422 0.040202578 0.099973695 I would like: [1] se=0.004998685 upper=0.059797422 lower=0.040202578 cv=0.099973695 Or even better: se upper lowercv 0.004998685 0.059797422 0.040202578 0.099973695 Any help is much appreciated, thanks. Steve ~~ Steven Worthington Ph.D. Candidate New York Consortium in Evolutionary Primatology & Department of Anthropology New York University 25 Waverly Place New York, NY 10003 U.S.A. ~~ -- View this message in context: http://www.nabble.com/Returning-variable-names-with-variables-%28in-a-fu nction%29-tp17124874p17124874.html Sent from the R help mailing list archive at Nabble.com. __ 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 provide commented, minimal, self-contained, reproducible code. This e-mail may contain confidential and/or privileged i...{{dropped:10}} __ 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 provide commented, minimal, self-contained, reproducible code.
[R] Quadratic Constraints
Hi R, A quick question How can I optimize the objective function constrained to quadratic constraints? Which function of R is useful for quadratic constraints? Many Thanks, Shubha This e-mail may contain confidential and/or privileged i...{{dropped:13}} __ 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 provide commented, minimal, self-contained, reproducible code.
Re: [R] Quadratic Constraints
Hello R, By any chance, Rdonlp2 package of R defined in http://arumat.net/Rdonlp2/tutorial.html#SECTION0002 serves the below purpose? BR, Shubha -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Shubha Vishwanath Karanth Sent: Monday, May 12, 2008 3:27 PM To: [EMAIL PROTECTED] Subject: [R] Quadratic Constraints Hi R, A quick question How can I optimize the objective function constrained to quadratic constraints? Which function of R is useful for quadratic constraints? Many Thanks, Shubha This e-mail may contain confidential and/or privileged i...{{dropped:13}} __ 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 provide commented, minimal, self-contained, reproducible code. This e-mail may contain confidential and/or privileged i...{{dropped:10}} __ 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 provide commented, minimal, self-contained, reproducible code.
[R] Regular Expressions
Hi R, Again struck with regular expressions... Suppose, S=c("World_is_beautiful", "one_two_three_four","My_book") I need to extract the last but one element of the strings. So, my output should look like: Ans=c("is","three","My") gsub() can do this...but wondering how do I give the regular expression Shubha Karanth | Amba Research Ph +91 80 3980 8031 | Mob +91 94 4886 4510 Bangalore * Colombo * London * New York * San José * Singapore * www.ambaresearch.com This e-mail may contain confidential and/or privileged i...{{dropped:13}} __ 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 provide commented, minimal, self-contained, reproducible code.
[R] Remove an object by the reference
Hi R, A simple question, but don't know the answer... x="a" a=5 I need to remove the object "a" by using only x. something like rm(somefunction(x))...Is this possible? Shubha Karanth | Amba Research Ph +91 80 3980 8031 | Mob +91 94 4886 4510 Bangalore * Colombo * London * New York * San José * Singapore * www.ambaresearch.com This e-mail may contain confidential and/or privileged i...{{dropped:13}} __ 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 provide commented, minimal, self-contained, reproducible code.
[R] dataframes to a list
Hi R, I have the data frames, data1, data2data50. Now I want to put all of these in a single list. But, >list(data1, data2,.data50) is very big to write. How do I then do it? Thanks, Shubha This e-mail may contain confidential and/or privileged i...{{dropped:13}} __ 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 provide commented, minimal, self-contained, reproducible code.
Re: [R] dataframes to a list
How do I proceed from this stage? paste("data",1:10,sep="",collapse=",") Shubha Karanth | Amba Research Ph +91 80 3980 8031 | Mob +91 94 4886 4510 Bangalore * Colombo * London * New York * San José * Singapore * www.ambaresearch.com -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Shubha Vishwanath Karanth Sent: Wednesday, May 14, 2008 3:59 PM To: [EMAIL PROTECTED] Subject: [R] dataframes to a list Hi R, I have the data frames, data1, data2data50. Now I want to put all of these in a single list. But, >list(data1, data2,.data50) is very big to write. How do I then do it? Thanks, Shubha This e-mail may contain confidential and/or privileged i...{{dropped:13}} __ 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 provide commented, minimal, self-contained, reproducible code. This e-mail may contain confidential and/or privileged i...{{dropped:10}} __ 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 provide commented, minimal, self-contained, reproducible code.
[R] A very simple question
Hi R, Suppose l=c(1,1,1,2,2,1,1,1) k[-which(k==1)] [1] 2 2 k[-which(k==2)] [1] 1 1 1 1 1 1 But, k[-which(k==3)] numeric(0) I do not want this numeric(0), instead the whole k itself should be my result... How do I do this? Thanks, Shubha This e-mail may contain confidential and/or privileged i...{{dropped:13}} __ 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 provide commented, minimal, self-contained, reproducible code.
[R] apply function
Hi R, Getting a strange result using ?apply. Please look into the below codes: > d=data.frame(a=c(1,2,3),b=c("A","B","C"),c=c(TRUE,FALSE,FALSE),d=c(T,F,F )) > class(d[,1]) [1] "numeric" > class(d[,2]) [1] "factor" > class(d[,3]) [1] "logical" > class(d[,4]) [1] "logical" > apply(d,2,class) a b c d "character" "character" "character" "character" > apply(d[,c(1,3)],2,class) a c "numeric" "numeric" > apply(d[,c(3,4)],2,class) c d "logical" "logical" > apply(d[,c(3,2)],2,class) c b "character" "character" > Why is this so? How do I get the actual classes of columns of my dataframe d? Thanks, Shubha This e-mail may contain confidential and/or privileged i...{{dropped:13}} __ 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 provide commented, minimal, self-contained, reproducible code.
[R] Reading SAS data into R
Hi R, Suppose that SAS dataset 'tsubset1' is stored in the path, "Z:/data". Then I give the below read.ssd() command to read SAS dataset, 'tsubset1.sas7bat' into R. > library(foreign) > s=read.ssd("Z:/data","tsubset1",sascmd = "C:/Program Files/SAS/SAS 9.1/sas.exe") > s A B C 1 3 4 5 2 6 7 8 3 3 4 5 It reads perfect! It reads well for "tsubset1","tsubset2",., "tsubset9" datasets. But then onwards it gives an error as below: * s=read.ssd("Z:/data","tsubset10",sascmd = "C:/Program Files/SAS/SAS 9.1/sas.exe") SAS failed. SAS program at C:\DOCUME~1\SHUBHA~1.AMB\LOCALS~1\Temp\1\RtmpObHuqk\file6df11649.sas The log file will be file6df11649.log in the current directory Warning message: In read.ssd("Z:/data", "tsubset1011", sascmd = "C:/Program Files/SAS/SAS 9.1/sas.exe") : SAS return code was 2 Why is this? Are two numerical digits in a filename of a SAS dataset cannot be read by R? The error prevails for "tsubset201", "tsubset35462" etc Can somebody point out to me where actually the error is? Many Thanks, Shubha This e-mail may contain confidential and/or privileged i...{{dropped:13}} __ 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 provide commented, minimal, self-contained, reproducible code.
Re: [R] Reading SAS data into R
Seems that it gets deleted But lemme try again by providing the arguments... Shubha Karanth | Amba Research Ph +91 80 3980 8031 | Mob +91 94 4886 4510 Bangalore * Colombo * London * New York * San José * Singapore * www.ambaresearch.com -Original Message- From: Peter Dalgaard [mailto:[EMAIL PROTECTED] Sent: Thursday, May 15, 2008 6:30 PM To: Shubha Vishwanath Karanth Cc: [EMAIL PROTECTED] Subject: Re: [R] Reading SAS data into R Shubha Vishwanath Karanth wrote: > Hi R, > > > > Suppose that SAS dataset 'tsubset1' is stored in the path, "Z:/data". > Then I give the below read.ssd() command to read SAS dataset, > 'tsubset1.sas7bat' into R. > > > > >> library(foreign) >> > > >> s=read.ssd("Z:/data","tsubset1",sascmd = "C:/Program Files/SAS/SAS >> > 9.1/sas.exe") > > >> s >> > > A B C > > 1 3 4 5 > > 2 6 7 8 > > 3 3 4 5 > > > > It reads perfect! It reads well for "tsubset1","tsubset2",., > "tsubset9" datasets. But then onwards it gives an error as below: > > > > * s=read.ssd("Z:/data","tsubset10",sascmd = "C:/Program > Files/SAS/SAS 9.1/sas.exe") > > > > SAS failed. SAS program at > C:\DOCUME~1\SHUBHA~1.AMB\LOCALS~1\Temp\1\RtmpObHuqk\file6df11649.sas > > The log file will be file6df11649.log in the current directory > > Warning message: > > In read.ssd("Z:/data", "tsubset1011", sascmd = "C:/Program Files/SAS/SAS > 9.1/sas.exe") : > > SAS return code was 2 > > > > Why is this? Are two numerical digits in a filename of a SAS dataset > cannot be read by R? The error prevails for "tsubset201", "tsubset35462" > etc Can somebody point out to me where actually the error is? > > What is in the SAS log file? -- O__ Peter Dalgaard Øster Farimagsgade 5, Entr.B c/ /'_ --- Dept. of Biostatistics PO Box 2099, 1014 Cph. K (*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918 ~~ - ([EMAIL PROTECTED]) FAX: (+45) 35327907 This e-mail may contain confidential and/or privileged i...{{dropped:10}} __ 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 provide commented, minimal, self-contained, reproducible code.
Re: [R] Reading SAS data into R
Hi Peter, Realized that the log files are generated only when there is an error. Here are my contents of the log file: libname src2rd 'Z:/data'; libname rd xport 'C:\DOCUME~1\SHUBHA~1.AMB\LOCALS~1\Temp\1\RtmpObHuqk\file323b4e45'; proc copy in=src2rd out=rd; select tsubset10 ; Shubha Karanth | Amba Research Ph +91 80 3980 8031 | Mob +91 94 4886 4510 Bangalore * Colombo * London * New York * San José * Singapore * www.ambaresearch.com -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Shubha Vishwanath Karanth Sent: Thursday, May 15, 2008 6:35 PM To: Peter Dalgaard Cc: [EMAIL PROTECTED] Subject: Re: [R] Reading SAS data into R Seems that it gets deleted But lemme try again by providing the arguments... Shubha Karanth | Amba Research Ph +91 80 3980 8031 | Mob +91 94 4886 4510 Bangalore * Colombo * London * New York * San José * Singapore * www.ambaresearch.com -Original Message- From: Peter Dalgaard [mailto:[EMAIL PROTECTED] Sent: Thursday, May 15, 2008 6:30 PM To: Shubha Vishwanath Karanth Cc: [EMAIL PROTECTED] Subject: Re: [R] Reading SAS data into R Shubha Vishwanath Karanth wrote: > Hi R, > > > > Suppose that SAS dataset 'tsubset1' is stored in the path, "Z:/data". > Then I give the below read.ssd() command to read SAS dataset, > 'tsubset1.sas7bat' into R. > > > > >> library(foreign) >> > > >> s=read.ssd("Z:/data","tsubset1",sascmd = "C:/Program Files/SAS/SAS >> > 9.1/sas.exe") > > >> s >> > > A B C > > 1 3 4 5 > > 2 6 7 8 > > 3 3 4 5 > > > > It reads perfect! It reads well for "tsubset1","tsubset2",., > "tsubset9" datasets. But then onwards it gives an error as below: > > > > * s=read.ssd("Z:/data","tsubset10",sascmd = "C:/Program > Files/SAS/SAS 9.1/sas.exe") > > > > SAS failed. SAS program at > C:\DOCUME~1\SHUBHA~1.AMB\LOCALS~1\Temp\1\RtmpObHuqk\file6df11649.sas > > The log file will be file6df11649.log in the current directory > > Warning message: > > In read.ssd("Z:/data", "tsubset1011", sascmd = "C:/Program Files/SAS/SAS > 9.1/sas.exe") : > > SAS return code was 2 > > > > Why is this? Are two numerical digits in a filename of a SAS dataset > cannot be read by R? The error prevails for "tsubset201", "tsubset35462" > etc Can somebody point out to me where actually the error is? > > What is in the SAS log file? -- O__ Peter Dalgaard Øster Farimagsgade 5, Entr.B c/ /'_ --- Dept. of Biostatistics PO Box 2099, 1014 Cph. K (*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918 ~~ - ([EMAIL PROTECTED]) FAX: (+45) 35327907 This e-mail may contain confidential and/or privileged i...{{dropped:10}} __ 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 provide commented, minimal, self-contained, reproducible code. This e-mail may contain confidential and/or privileged i...{{dropped:10}} __ 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 provide commented, minimal, self-contained, reproducible code.
Re: [R] Reading SAS data into R
After running the codes in the log file, I realized that this has something to do with SAS only... Shubha Karanth | Amba Research Ph +91 80 3980 8031 | Mob +91 94 4886 4510 Bangalore * Colombo * London * New York * San José * Singapore * www.ambaresearch.com -Original Message- From: Shubha Vishwanath Karanth Sent: Thursday, May 15, 2008 7:03 PM To: Peter Dalgaard Cc: [EMAIL PROTECTED] Subject: RE: [R] Reading SAS data into R Hi Peter, Realized that the log files are generated only when there is an error. Here are my contents of the log file: libname src2rd 'Z:/data'; libname rd xport 'C:\DOCUME~1\SHUBHA~1.AMB\LOCALS~1\Temp\1\RtmpObHuqk\file323b4e45'; proc copy in=src2rd out=rd; select tsubset10 ; Shubha Karanth | Amba Research Ph +91 80 3980 8031 | Mob +91 94 4886 4510 Bangalore * Colombo * London * New York * San José * Singapore * www.ambaresearch.com -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Shubha Vishwanath Karanth Sent: Thursday, May 15, 2008 6:35 PM To: Peter Dalgaard Cc: [EMAIL PROTECTED] Subject: Re: [R] Reading SAS data into R Seems that it gets deleted But lemme try again by providing the arguments... Shubha Karanth | Amba Research Ph +91 80 3980 8031 | Mob +91 94 4886 4510 Bangalore * Colombo * London * New York * San José * Singapore * www.ambaresearch.com -Original Message- From: Peter Dalgaard [mailto:[EMAIL PROTECTED] Sent: Thursday, May 15, 2008 6:30 PM To: Shubha Vishwanath Karanth Cc: [EMAIL PROTECTED] Subject: Re: [R] Reading SAS data into R Shubha Vishwanath Karanth wrote: > Hi R, > > > > Suppose that SAS dataset 'tsubset1' is stored in the path, "Z:/data". > Then I give the below read.ssd() command to read SAS dataset, > 'tsubset1.sas7bat' into R. > > > > >> library(foreign) >> > > >> s=read.ssd("Z:/data","tsubset1",sascmd = "C:/Program Files/SAS/SAS >> > 9.1/sas.exe") > > >> s >> > > A B C > > 1 3 4 5 > > 2 6 7 8 > > 3 3 4 5 > > > > It reads perfect! It reads well for "tsubset1","tsubset2",., > "tsubset9" datasets. But then onwards it gives an error as below: > > > > * s=read.ssd("Z:/data","tsubset10",sascmd = "C:/Program > Files/SAS/SAS 9.1/sas.exe") > > > > SAS failed. SAS program at > C:\DOCUME~1\SHUBHA~1.AMB\LOCALS~1\Temp\1\RtmpObHuqk\file6df11649.sas > > The log file will be file6df11649.log in the current directory > > Warning message: > > In read.ssd("Z:/data", "tsubset1011", sascmd = "C:/Program Files/SAS/SAS > 9.1/sas.exe") : > > SAS return code was 2 > > > > Why is this? Are two numerical digits in a filename of a SAS dataset > cannot be read by R? The error prevails for "tsubset201", "tsubset35462" > etc Can somebody point out to me where actually the error is? > > What is in the SAS log file? -- O__ Peter Dalgaard Øster Farimagsgade 5, Entr.B c/ /'_ --- Dept. of Biostatistics PO Box 2099, 1014 Cph. K (*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918 ~~ - ([EMAIL PROTECTED]) FAX: (+45) 35327907 This e-mail may contain confidential and/or privileged i...{{dropped:10}} __ 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 provide commented, minimal, self-contained, reproducible code. This e-mail may contain confidential and/or privileged i...{{dropped:10}} __ 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 provide commented, minimal, self-contained, reproducible code.
Re: [R] Reading SAS data into R
Oh!...Got that...A member in the RD library of SAS can contain only 8 characters in its filename. Since the variables 'tsubset1', 'tsubset2','tsubset9' had exactly 8 letters in the name, those files read properly and then onwards, since the number of letters/characters exceeded 8, those were not read! Shubha Karanth | Amba Research Ph +91 80 3980 8031 | Mob +91 94 4886 4510 Bangalore * Colombo * London * New York * San José * Singapore * www.ambaresearch.com -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Shubha Vishwanath Karanth Sent: Thursday, May 15, 2008 6:35 PM To: Peter Dalgaard Cc: [EMAIL PROTECTED] Subject: Re: [R] Reading SAS data into R Seems that it gets deleted But lemme try again by providing the arguments... Shubha Karanth | Amba Research Ph +91 80 3980 8031 | Mob +91 94 4886 4510 Bangalore * Colombo * London * New York * San José * Singapore * www.ambaresearch.com -Original Message- From: Peter Dalgaard [mailto:[EMAIL PROTECTED] Sent: Thursday, May 15, 2008 6:30 PM To: Shubha Vishwanath Karanth Cc: [EMAIL PROTECTED] Subject: Re: [R] Reading SAS data into R Shubha Vishwanath Karanth wrote: > Hi R, > > > > Suppose that SAS dataset 'tsubset1' is stored in the path, "Z:/data". > Then I give the below read.ssd() command to read SAS dataset, > 'tsubset1.sas7bat' into R. > > > > >> library(foreign) >> > > >> s=read.ssd("Z:/data","tsubset1",sascmd = "C:/Program Files/SAS/SAS >> > 9.1/sas.exe") > > >> s >> > > A B C > > 1 3 4 5 > > 2 6 7 8 > > 3 3 4 5 > > > > It reads perfect! It reads well for "tsubset1","tsubset2",., > "tsubset9" datasets. But then onwards it gives an error as below: > > > > * s=read.ssd("Z:/data","tsubset10",sascmd = "C:/Program > Files/SAS/SAS 9.1/sas.exe") > > > > SAS failed. SAS program at > C:\DOCUME~1\SHUBHA~1.AMB\LOCALS~1\Temp\1\RtmpObHuqk\file6df11649.sas > > The log file will be file6df11649.log in the current directory > > Warning message: > > In read.ssd("Z:/data", "tsubset1011", sascmd = "C:/Program Files/SAS/SAS > 9.1/sas.exe") : > > SAS return code was 2 > > > > Why is this? Are two numerical digits in a filename of a SAS dataset > cannot be read by R? The error prevails for "tsubset201", "tsubset35462" > etc Can somebody point out to me where actually the error is? > > What is in the SAS log file? -- O__ Peter Dalgaard Øster Farimagsgade 5, Entr.B c/ /'_ --- Dept. of Biostatistics PO Box 2099, 1014 Cph. K (*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918 ~~ - ([EMAIL PROTECTED]) FAX: (+45) 35327907 This e-mail may contain confidential and/or privileged i...{{dropped:10}} __ 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 provide commented, minimal, self-contained, reproducible code. This e-mail may contain confidential and/or privileged i...{{dropped:10}} __ 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 provide commented, minimal, self-contained, reproducible code.
Re: [R] Reading SAS data into R
By RD library I mean the xport library... Shubha Karanth | Amba Research Ph +91 80 3980 8031 | Mob +91 94 4886 4510 Bangalore * Colombo * London * New York * San José * Singapore * www.ambaresearch.com -Original Message- From: Shubha Vishwanath Karanth Sent: Thursday, May 15, 2008 7:21 PM To: [EMAIL PROTECTED] Cc: Peter Dalgaard Subject: RE: [R] Reading SAS data into R Oh!...Got that...A member in the RD library of SAS can contain only 8 characters in its filename. Since the variables 'tsubset1', 'tsubset2','tsubset9' had exactly 8 letters in the name, those files read properly and then onwards, since the number of letters/characters exceeded 8, those were not read! Shubha Karanth | Amba Research Ph +91 80 3980 8031 | Mob +91 94 4886 4510 Bangalore * Colombo * London * New York * San José * Singapore * www.ambaresearch.com -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Shubha Vishwanath Karanth Sent: Thursday, May 15, 2008 6:35 PM To: Peter Dalgaard Cc: [EMAIL PROTECTED] Subject: Re: [R] Reading SAS data into R Seems that it gets deleted But lemme try again by providing the arguments... Shubha Karanth | Amba Research Ph +91 80 3980 8031 | Mob +91 94 4886 4510 Bangalore * Colombo * London * New York * San José * Singapore * www.ambaresearch.com -Original Message- From: Peter Dalgaard [mailto:[EMAIL PROTECTED] Sent: Thursday, May 15, 2008 6:30 PM To: Shubha Vishwanath Karanth Cc: [EMAIL PROTECTED] Subject: Re: [R] Reading SAS data into R Shubha Vishwanath Karanth wrote: > Hi R, > > > > Suppose that SAS dataset 'tsubset1' is stored in the path, "Z:/data". > Then I give the below read.ssd() command to read SAS dataset, > 'tsubset1.sas7bat' into R. > > > > >> library(foreign) >> > > >> s=read.ssd("Z:/data","tsubset1",sascmd = "C:/Program Files/SAS/SAS >> > 9.1/sas.exe") > > >> s >> > > A B C > > 1 3 4 5 > > 2 6 7 8 > > 3 3 4 5 > > > > It reads perfect! It reads well for "tsubset1","tsubset2",., > "tsubset9" datasets. But then onwards it gives an error as below: > > > > * s=read.ssd("Z:/data","tsubset10",sascmd = "C:/Program > Files/SAS/SAS 9.1/sas.exe") > > > > SAS failed. SAS program at > C:\DOCUME~1\SHUBHA~1.AMB\LOCALS~1\Temp\1\RtmpObHuqk\file6df11649.sas > > The log file will be file6df11649.log in the current directory > > Warning message: > > In read.ssd("Z:/data", "tsubset1011", sascmd = "C:/Program Files/SAS/SAS > 9.1/sas.exe") : > > SAS return code was 2 > > > > Why is this? Are two numerical digits in a filename of a SAS dataset > cannot be read by R? The error prevails for "tsubset201", "tsubset35462" > etc Can somebody point out to me where actually the error is? > > What is in the SAS log file? -- O__ Peter Dalgaard Øster Farimagsgade 5, Entr.B c/ /'_ --- Dept. of Biostatistics PO Box 2099, 1014 Cph. K (*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918 ~~ - ([EMAIL PROTECTED]) FAX: (+45) 35327907 This e-mail may contain confidential and/or privileged i...{{dropped:10}} __ 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 provide commented, minimal, self-contained, reproducible code. This e-mail may contain confidential and/or privileged i...{{dropped:10}} __ 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 provide commented, minimal, self-contained, reproducible code.
Re: [R] Pros and Cons of R
Completely agreed! BR, Shubha Shubha Karanth | Amba Research Ph +91 80 3980 8031 | Mob +91 94 4886 4510 Bangalore * Colombo * London * New York * San José * Singapore * www.ambaresearch.com -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Ruben Roa Ureta Sent: Thursday, May 22, 2008 10:53 PM To: Monica Pisica Cc: r-help@r-project.org Subject: Re: [R] Pros and Cons of R > Hi, > > I am doing a very informal presentation for my office about R capabilities > to deal with and analyze spatial data, display data and maps, and > connections with GIS. I've used in my presentation info from the CRAN, the > spatial Task view, and the more striking graphics examples from > http://addictedtor.free.fr/graphiques/thumbs.php and NCEAS > http://www.nceas.ucsb.edu/scicomp/GISSeminar/UseCases/MapProdWithRGraphics/OneMapProdWithRGraphics.html > together with examples of my own work. > > I am finishing with pros and cons about R and I am wondering if you can > come up with other examples, or comments. Here they are: > > Pros: > > - R is a programming environment well suited for statistical analysis. > - R is open source and cross platforms (Windows, Mac, Linux). > - Fortran, C (C++), and Python wrappers are in place. > - Deals well with spatial data, has a robust graphical interface and has > an active user group list / forum. > - External packages for R are almost daily increasing, most of them based > on published up-to-date books and peer-reviewed articles. > - R related books - quite a few I think you should considering adding the quality of support, as represented by this list and the archives (easily accesible with RSiteSearch). Not many softwares have their creators and best minds answering the cries for help from the most humble users (though these creators and best minds can be rough at times, probably with good reasons). Rubén __ 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 provide commented, minimal, self-contained, reproducible code. This e-mail may contain confidential and/or privileged i...{{dropped:10}} __ 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 provide commented, minimal, self-contained, reproducible code.
[R] Solving 100th order equation
Hi R, I have a 100th order equation for which I need to solve the value for x. Is there a package to do this? For example my equation is: (x^100 )- (2*x^99) +(10*x^50)+.. +(6*x ) = 4000 I have only one unknown value and that is x. How do I solve for this? BR, Shubha Shubha Karanth | Amba Research Ph +91 80 3980 8031 | Mob +91 94 4886 4510 Bangalore * Colombo * London * New York * San José * Singapore * www.ambaresearch.com This e-mail may contain confidential and/or privileged i...{{dropped:13}} __ 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 provide commented, minimal, self-contained, reproducible code.
Re: [R] Solving 100th order equation
To apply uniroot I don't even know the interval values... Does numerical methods help me? Or any other method? Thanks and Regards, Shubha -Original Message- From: Duncan Murdoch [mailto:[EMAIL PROTECTED] Sent: Saturday, May 24, 2008 5:08 PM To: Shubha Vishwanath Karanth Subject: Re: [R] Solving 100th order equation Shubha Vishwanath Karanth wrote: > Hi R, > > > > I have a 100th order equation for which I need to solve the value for x. Is > there a package to do this? > > > > For example my equation is: > > > > (x^100 )- (2*x^99) +(10*x^50)+.. +(6*x ) = 4000 > > > > I have only one unknown value and that is x. How do I solve for this? > > uniroot() will find one root. If you want all of them, I don't know what is available. Duncan Murdoch > > > > > > > BR, Shubha > > Shubha Karanth | Amba Research > > Ph +91 80 3980 8031 | Mob +91 94 4886 4510 > > Bangalore * Colombo * London * New York * San José * Singapore * > www.ambaresearch.com > > > > This e-mail may contain confidential and/or privileged i...{{dropped:13}} > > > > > __ > 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 provide commented, minimal, self-contained, reproducible code. > This e-mail may contain confidential and/or privileged i...{{dropped:10}} __ 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 provide commented, minimal, self-contained, reproducible code.
Re: [R] Solving 100th order equation
Was also wondering which theoretical method is used to solve this problem? Thanks, Shubha Karanth | Amba Research Ph +91 80 3980 8031 | Mob +91 94 4886 4510 Bangalore * Colombo * London * New York * San José * Singapore * www.ambaresearch.com -Original Message- From: Gabor Grothendieck [mailto:[EMAIL PROTECTED] Sent: Saturday, May 24, 2008 6:13 PM To: Peter Dalgaard Cc: Shubha Vishwanath Karanth; [EMAIL PROTECTED]; Duncan Murdoch Subject: Re: [R] Solving 100th order equation On Sat, May 24, 2008 at 8:31 AM, Peter Dalgaard <[EMAIL PROTECTED]> wrote: > Shubha Vishwanath Karanth wrote: >> >> To apply uniroot I don't even know the interval values... Does numerical >> methods help me? Or any other method? >> >> Thanks and Regards, >> Shubha >> >> -Original Message- >> From: Duncan Murdoch [mailto:[EMAIL PROTECTED] Sent: Saturday, May 24, >> 2008 5:08 PM >> To: Shubha Vishwanath Karanth >> Subject: Re: [R] Solving 100th order equation >> >> Shubha Vishwanath Karanth wrote: >> >>> >>> Hi R, >>> >>> >>> I have a 100th order equation for which I need to solve the value for x. >>> Is there a package to do this? >>> >>> >>> For example my equation is: >>> >>> >>> (x^100 )- (2*x^99) +(10*x^50)+.. +(6*x ) = 4000 >>> >>> >>> I have only one unknown value and that is x. How do I solve for this? >>> >>> >> >> uniroot() will find one root. If you want all of them, I don't know what >> is available. >> >> Duncan Murdoch >> > > polyroot() is built for this, but it stops at 48th degree polynomials, at > least as currently implemented. Not sure that it (or anything else) would be > stable beyond that limit. YACAS perhaps? > Unfortunately yacas does not seem to be able to handle it: > library(Ryacas) > x <- Sym("x") > Solve((x^100 )- (2*x^99) +(10*x^50)+(6*x ) - 4000 == 0, x) [1] "Starting Yacas!" expression(list()) Simpler one works ok: > Solve(x^2 - 1, x) expression(list(x == 1, x == -1)) This e-mail may contain confidential and/or privileged i...{{dropped:10}} __ 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 provide commented, minimal, self-contained, reproducible code.
[R] sum of unknown number of matrices
Hi R, I have a list of matrices. I need to get the sum of all the matrices in the list. Example: a=b=c=d=matrix(1:4,2,2) l=list(a,b,c,d) I need: > a+b+c+d [,1] [,2] [1,]4 12 [2,]8 16 Something like do.call("+",l) is not working...why is this? I may not be knowing the number of matrices in the list... Thanks, Shubha This e-mail may contain confidential and/or privileged i...{{dropped:13}} __ 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 provide commented, minimal, self-contained, reproducible code.
Re: [R] sum of unknown number of matrices
Thanks all...Reduce() is the new function I learnt today... Thanks... BR, Shubha Shubha Karanth | Amba Research Ph +91 80 3980 8031 | Mob +91 94 4886 4510 Bangalore * Colombo * London * New York * San José * Singapore * www.ambaresearch.com -Original Message- From: Barry Rowlingson [mailto:[EMAIL PROTECTED] Sent: Wednesday, June 04, 2008 8:49 PM To: Shubha Vishwanath Karanth Cc: [EMAIL PROTECTED] Subject: Re: [R] sum of unknown number of matrices Shubha Vishwanath Karanth wrote: > I need: > >> a+b+c+d > > [,1] [,2] > > [1,]4 12 > > [2,]8 16 > > > > Something like do.call("+",l) is not working...why is this? Because do.call constructs a function call with the elements of l as arguments, so you end up with: "+"(1:4, 1:4, 1:4, 1:4) but "+" only takes two arguments. Use 'Reduce': > Reduce("+",l) [,1] [,2] [1,]4 12 [2,]8 16 Barry This e-mail may contain confidential and/or privileged i...{{dropped:10}} __ 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 provide commented, minimal, self-contained, reproducible code.
[R] Overlaying the matrices
Hi R, I have a matrix, > x1=matrix(NA,6,6,dimnames=list(letters[1:6],LETTERS[1:6])) > x1 A B C D E F a NA NA NA NA NA NA b NA NA NA NA NA NA c NA NA NA NA NA NA d NA NA NA NA NA NA e NA NA NA NA NA NA f NA NA NA NA NA NA > x2=matrix(rpois(9,1),3,3,dimnames=list(c("b","a","f"),c("D","E","F"))) > x2 D E F b 0 3 0 a 2 2 1 f 1 0 0 I need to put the values of x2 in the corresponding elements of x1. So then, x1 would look like: A B C D E F a NA NA NA 2 2 1 b NA NA NA 0 3 0 c NA NA NA NA NA NA d NA NA NA NA NA NA e NA NA NA NA NA NA f NA NA NA 1 0 0 What would be the best way to do this? Many Thanks, Shubha This e-mail may contain confidential and/or privileged i...{{dropped:13}} __ 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 provide commented, minimal, self-contained, reproducible code.
Re: [R] Overlaying the matrices
Suppose if I modify the question as: > x A B C D E a 0 0 0 0 1 b 0 1 0 2 1 c 1 2 0 1 2 d 0 0 0 2 0 e 0 1 2 0 2 > y D E F b 2 1 2 a 4 0 1 f 1 4 1 I need to get a matrix, which has the dimension being the union of the row names and column names of both x and y such that the new matrix 'xx' should contain only the corresponding elements in x, rest all should be NA. Any ideas for this? Thanks, Shubha -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Shubha Vishwanath Karanth Sent: Monday, June 09, 2008 4:57 PM To: [EMAIL PROTECTED] Subject: [R] Overlaying the matrices Hi R, I have a matrix, > x1=matrix(NA,6,6,dimnames=list(letters[1:6],LETTERS[1:6])) > x1 A B C D E F a NA NA NA NA NA NA b NA NA NA NA NA NA c NA NA NA NA NA NA d NA NA NA NA NA NA e NA NA NA NA NA NA f NA NA NA NA NA NA > x2=matrix(rpois(9,1),3,3,dimnames=list(c("b","a","f"),c("D","E","F"))) > x2 D E F b 0 3 0 a 2 2 1 f 1 0 0 I need to put the values of x2 in the corresponding elements of x1. So then, x1 would look like: A B C D E F a NA NA NA 2 2 1 b NA NA NA 0 3 0 c NA NA NA NA NA NA d NA NA NA NA NA NA e NA NA NA NA NA NA f NA NA NA 1 0 0 What would be the best way to do this? Many Thanks, Shubha This e-mail may contain confidential and/or privileged i...{{dropped:13}} __ 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 provide commented, minimal, self-contained, reproducible code. This e-mail may contain confidential and/or privileged i...{{dropped:10}} __ 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 provide commented, minimal, self-contained, reproducible code.
[R] Polynomial Goal Programming
Hello R, Is there a package to perform Polynomial goal programming in R? BR, Shubha Shubha Karanth | Amba Research Ph +91 80 3980 8031 | Mob +91 94 4886 4510 Bangalore * Colombo * London * New York * San José * Singapore * www.ambaresearch.com This e-mail may contain confidential and/or privileged i...{{dropped:13}} __ 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 provide commented, minimal, self-contained, reproducible code.
[R] The log function problem
Hi R, Please see the below commands. The question is I can see the value of log(2) before loading the package fcalendar in R. But after loading the package, the 'log' function doesn't work. How to solve this problem? Also note that the function code differs before and after downloading the packages. > log function (x, base = exp(1)) .Primitive("log") > log(2) [1] 0.6931472 > library(fCalendar) Loading required package: fEcofin Rmetrics, (C) 1999-2006, Diethelm Wuertz, GPL fCalendar: Time, Date and Calendar Tools > library(fCalendar) > log function (x, base = exp(1)) { UseMethod("log") } > log(2) Error in .Internal(log(x)) : no internal function "log" Many Thanks for your help, Shubha This e-mail may contain confidential and/or privileged i...{{dropped:13}} __ 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 provide commented, minimal, self-contained, reproducible code.
[R] wilderSum
Hi, Can somebody tell me the formula for "?wilderSum" in TTR package? I mean how are these calculated? BR, Shubha Shubha Karanth | Amba Research Ph +91 80 3980 8031 | Mob +91 94 4886 4510 Bangalore * Colombo * London * New York * San José * Singapore * www.ambaresearch.com This e-mail may contain confidential and/or privileged i...{{dropped:13}} __ 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 provide commented, minimal, self-contained, reproducible code.
[R] .fortran code
Hi, I need to look/understand what the ".fortran()" doing in say, the source code of the "eigen" command. How do I look into this? Thanks, Shubha This e-mail may contain confidential and/or privileged i...{{dropped:13}} __ 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 provide commented, minimal, self-contained, reproducible code.
Re: [R] .fortran code
Hi Ravi, ...In the same fashion, I was trying to look at wilder.f of 'wilderSum' command of the TTR package. I even googled for the keyword, "wilder.f wilderSum" or " subroutine wilder", but did not find anything useful. Also I did not get when you said " So,you can look at these files if you had installed the source code". Where to look at these files(without going to google)...is there anything which I need to install more? BR, Shubha Shubha Karanth | Amba Research Ph +91 80 3980 8031 | Mob +91 94 4886 4510 Bangalore * Colombo * London * New York * San José * Singapore * www.ambaresearch.com -Original Message- From: Ravi Varadhan [mailto:[EMAIL PROTECTED] Sent: Thursday, February 07, 2008 8:56 PM To: Shubha Vishwanath Karanth; [EMAIL PROTECTED] Subject: RE: [R] .fortran code If you look at the source code for eigen() you will notice that the .Fortran calls a subroutine named either "rs.f" or "rg.f" depending on whether your matrix is real and symmetric or real and asymmetric, respectively. So, you can look at these files if you had installed the source code. Even if you had not installed the full source, you can google using keywrods "rs.f eigenvalue" or "rg.f eigenvalue" to see the Fortran code for these functions available from EISPACK. However, I am not sure how illuminating that would be since rs.f and rg.f are just calling routines that each calls a number of other subroutines. So, unless you are willing to spend a great deal of time, you may not be any wiser at the end of all this. Ravi. --- Ravi Varadhan, Ph.D. Assistant Professor, The Center on Aging and Health Division of Geriatric Medicine and Gerontology Johns Hopkins University Ph: (410) 502-2619 Fax: (410) 614-9625 Email: [EMAIL PROTECTED] Webpage: http://www.jhsph.edu/agingandhealth/People/Faculty/Varadhan.html -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Shubha Vishwanath Karanth Sent: Thursday, February 07, 2008 9:42 AM To: [EMAIL PROTECTED] Subject: [R] .fortran code Hi, I need to look/understand what the ".fortran()" doing in say, the source code of the "eigen" command. How do I look into this? Thanks, Shubha This e-mail may contain confidential and/or privileged i...{{dropped:13}} __ 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 provide commented, minimal, self-contained, reproducible code. This e-mail may contain confidential and/or privileged i...{{dropped:10}} __ 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 provide commented, minimal, self-contained, reproducible code.
[R] Transposing by a group variable
Hi R, Can I transpose a data frame by a particular group variable? For example: d=data.frame(group=c(1,1,2,2,2),val=c(6,4,6,3,5)) And my output should be: data.frame(group=c(1,2),v1=c(6,6),v2=c(4,3),v3=c(NA,5)) Many thanks, Shubha This e-mail may contain confidential and/or privileged i...{{dropped:13}} __ 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 provide commented, minimal, self-contained, reproducible code.
[R] RMysql question
R users, I have a problem in RMysql. The error I get is: > library(RMySQL) > library(RMySQL) >options(expressions=1) > MySQL(max.con = 16, fetch.default.rec = 500, force.reload = FALSE) Error: protect(): protection stack overflow I have no idea of why the error is. Can anyone help on this? Many Thanks, Shubha Shubha Karanth | Amba Research Ph +91 80 3980 8031 | Mob +91 94 4886 4510 Bangalore * Colombo * London * New York * San José * Singapore * www.ambaresearch.com This e-mail may contain confidential and/or privileged i...{{dropped:13}} __ 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 provide commented, minimal, self-contained, reproducible code.
[R] extracting p-value from an lrm object
Hi, How can I extract p-values from an 'lrm' (logistic regression model) oject? Thank you, Shubha This e-mail may contain confidential and/or privileged i...{{dropped:13}} __ 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 provide commented, minimal, self-contained, reproducible code.
[R] Dimensions of a List
Hi R, I have a list, l=list(list(c(1,2),c(4,5),c(6,7)),list(c(11,22,33),c(44,55,66))) > l [[1]] [[1]][[1]] [1] 1 2 [[1]][[2]] [1] 4 5 [[1]][[3]] [1] 6 7 [[2]] [[2]][[1]] [1] 11 22 33 [[2]][[2]] [1] 44 55 66 How do I know the dimensions of this list?... In other words, how many sub-lists, sub-sub-lists etc...are there in l? How do I know this? Thanks in advance Shubha This e-mail may contain confidential and/or privileged i...{{dropped:13}} __ 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 provide commented, minimal, self-contained, reproducible code.
Re: [R] Dimensions of a List
Thanks a lot for your reply...Exactly...I need the same...But can I store these numbers and hence can access further? In other words how do I extract the numbers/dimensions from this class? Shubha Karanth | Amba Research Ph +91 80 3980 8031 | Mob +91 94 4886 4510 Bangalore * Colombo * London * New York * San José * Singapore * www.ambaresearch.com -Original Message- From: jim holtman [mailto:[EMAIL PROTECTED] Sent: Tuesday, March 25, 2008 9:21 PM To: Shubha Vishwanath Karanth Cc: [EMAIL PROTECTED] Subject: Re: [R] Dimensions of a List Is this what you want? > l=list(list(c(1,2),c(4,5),c(6,7)),list(c(11,22,33),c(44,55,66))) > str(l) List of 2 $ :List of 3 ..$ : num [1:2] 1 2 ..$ : num [1:2] 4 5 ..$ : num [1:2] 6 7 $ :List of 2 ..$ : num [1:3] 11 22 33 ..$ : num [1:3] 44 55 66 > On 3/25/08, Shubha Vishwanath Karanth <[EMAIL PROTECTED]> wrote: > Hi R, > > > > I have a list, > > > > l=list(list(c(1,2),c(4,5),c(6,7)),list(c(11,22,33),c(44,55,66))) > > > > > l > > [[1]] > > [[1]][[1]] > > [1] 1 2 > > > > [[1]][[2]] > > [1] 4 5 > > > > [[1]][[3]] > > [1] 6 7 > > > > > > [[2]] > > [[2]][[1]] > > [1] 11 22 33 > > > > [[2]][[2]] > > [1] 44 55 66 > > > > > > How do I know the dimensions of this list?... In other words, how many > sub-lists, sub-sub-lists etc...are there in l? How do I know this? > > > > Thanks in advance > > Shubha > > This e-mail may contain confidential and/or privileged i...{{dropped:13}} > > __ > 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 provide commented, minimal, self-contained, reproducible code. > -- Jim Holtman Cincinnati, OH +1 513 646 9390 What is the problem you are trying to solve? This e-mail may contain confidential and/or privileged i...{{dropped:10}} __ 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 provide commented, minimal, self-contained, reproducible code.
[R] Mode Vs Class
Hi R, Just came across the 'mode' of an object. What is the basic difference between ?class and ?mode...For example: d=data.frame(a=c(1,2),b=c(5,6)) class(d) [1] "data.frame" mode(d) [1] "list" But, c=c(2,3,5,6,7) class(c) [1] "numeric" mode(c) [1] "numeric" Could anyone help me out... Thanks, shubha This e-mail may contain confidential and/or privileged i...{{dropped:13}} __ 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 provide commented, minimal, self-contained, reproducible code.
[R] Number of words in a string
Hi R, A quick question: How do we find the number of words in a string? Example: C="Have a nice day" And the number of words should be 4. any built in function or?... Thanks, Shubha Shubha Karanth | Amba Research Ph +91 80 3980 8031 | Mob +91 94 4886 4510 Bangalore * Colombo * London * New York * San José * Singapore * www.ambaresearch.com This e-mail may contain confidential and/or privileged i...{{dropped:13}} __ 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 provide commented, minimal, self-contained, reproducible code.
Re: [R] Number of words in a string
To put in more general, C=c("My Dog", "Its really good", "Beautiful") And the resultant output should be [1] 2 3 1 ...the number of words Thank you... Shubha Karanth | Amba Research Ph +91 80 3980 8031 | Mob +91 94 4886 4510 Bangalore * Colombo * London * New York * San José * Singapore * www.ambaresearch.com -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Shubha Vishwanath Karanth Sent: Wednesday, April 09, 2008 8:51 PM To: [EMAIL PROTECTED] Subject: [R] Number of words in a string Hi R, A quick question: How do we find the number of words in a string? Example: C="Have a nice day" And the number of words should be 4. any built in function or?... Thanks, Shubha Shubha Karanth | Amba Research Ph +91 80 3980 8031 | Mob +91 94 4886 4510 Bangalore * Colombo * London * New York * San José * Singapore * www.ambaresearch.com This e-mail may contain confidential and/or privileged i...{{dropped:13}} This e-mail may contain confidential and/or privileged i...{{dropped:10}} __ 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 provide commented, minimal, self-contained, reproducible code.
Re: [R] Number of words in a string
Exactly...this is what I wanted... Can we also extract/remove the last word of the strings? Example: > C=c("My Dog", "Its really good", "Beautiful") > sapply(strsplit(C, " "), length) [1] 2 3 1 Shubha Karanth | Amba Research Ph +91 80 3980 8031 | Mob +91 94 4886 4510 Bangalore * Colombo * London * New York * San José * Singapore * www.ambaresearch.com -Original Message- From: Markus Gesmann [mailto:[EMAIL PROTECTED] Sent: Wednesday, April 09, 2008 9:00 PM To: Shubha Vishwanath Karanth; [EMAIL PROTECTED] Subject: RE: [R] Number of words in a string Would this: sapply(strsplit(C, " "), length) work for? Markus Gesmann │Associate Director│Libero Ventures Ltd, One Broadgate, London EC2M 2QS tel: +44 (0)207 826 9080│ dir: +44 (0)207 826 9085│fax: +44 (0)207 826 9090 │www.libero.uk.com A Lehman Brothers Company AUTHORISED AND REGULATED BY THE FINANCIAL SERVICES AUTHORITY -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Shubha Vishwanath Karanth Sent: 09 April 2008 16:21 To: [EMAIL PROTECTED] Subject: [R] Number of words in a string Hi R, A quick question: How do we find the number of words in a string? Example: C="Have a nice day" And the number of words should be 4. any built in function or?... Thanks, Shubha Shubha Karanth | Amba Research Ph +91 80 3980 8031 | Mob +91 94 4886 4510 Bangalore * Colombo * London * New York * San José * Singapore * www.ambaresearch.com This e-mail may contain confidential and/or privileged i...{{dropped:13}} This message is intended for the personal and confidential use for the designated recipient(s) named above. If you are not the intended recipient of this message you are hereby notified that any review, dissemination, distribution or copying of this message is strictly prohibited. This communication is for information purposes only and should not be regarded as an offer to sell or as a solicitation of an offer to buy any financial product, an official confirmation of any transaction or as an official statement of Libero Ventures Ltd. Email transmissions cannot be guaranteed to be secure or error-free. Therefore we do not represent that this information is complete or accurate and it should not be relied upon as such. All information is subject to change without notice. This e-mail may contain confidential and/or privileged information. If you are not the intended recipient (or have received this e-mail in error) please notify the sender immediately and destroy this e-mail. Any unauthorized copying, disclosure or distribution of the material in this e-mail is strictly forbidden. Any views or opinions presented are solely those of the author and do not necessarily represent those of Amba Holdings Inc., and/or its affiliates. Important additional terms relating to this email can be obtained at http://www.ambaresearch.com/disclaimer __ 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 provide commented, minimal, self-contained, reproducible code.
Re: [R] Number of words in a string
Got all the answers using ?strsplit... Is there any way without using string split?... More specifically... How can I just extract the last word in all the strings without using ?strsplit ? Shubha Karanth | Amba Research Ph +91 80 3980 8031 | Mob +91 94 4886 4510 Bangalore * Colombo * London * New York * San José * Singapore * www.ambaresearch.com -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Hans-Joerg Bibiko Sent: Wednesday, April 09, 2008 9:10 PM To: [EMAIL PROTECTED] Subject: Re: [R] Number of words in a string On 9 Apr 2008, at 17:29, Markus Gesmann wrote: > Would this: > > sapply(strsplit(C, " "), length) > > work for? or length(unlist(strsplit(C, " "))) --Hans __ 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 provide commented, minimal, self-contained, reproducible code. This e-mail may contain confidential and/or privileged i...{{dropped:10}} __ 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 provide commented, minimal, self-contained, reproducible code.
Re: [R] Number of words in a string
To put it simple, C=c("My Dog", "Its really good", "Beautiful") Now, SOMEFUNCTION(C) should give: c("My", "Its really", "") Thanks, Shubha Karanth | Amba Research Ph +91 80 3980 8031 | Mob +91 94 4886 4510 Bangalore * Colombo * London * New York * San José * Singapore * www.ambaresearch.com -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Shubha Vishwanath Karanth Sent: Wednesday, April 09, 2008 9:01 PM To: Markus Gesmann; [EMAIL PROTECTED] Subject: Re: [R] Number of words in a string Exactly...this is what I wanted... Can we also extract/remove the last word of the strings? Example: > C=c("My Dog", "Its really good", "Beautiful") > sapply(strsplit(C, " "), length) [1] 2 3 1 Shubha Karanth | Amba Research Ph +91 80 3980 8031 | Mob +91 94 4886 4510 Bangalore * Colombo * London * New York * San José * Singapore * www.ambaresearch.com -Original Message- From: Markus Gesmann [mailto:[EMAIL PROTECTED] Sent: Wednesday, April 09, 2008 9:00 PM To: Shubha Vishwanath Karanth; [EMAIL PROTECTED] Subject: RE: [R] Number of words in a string Would this: sapply(strsplit(C, " "), length) work for? Markus Gesmann │Associate Director│Libero Ventures Ltd, One Broadgate, London EC2M 2QS tel: +44 (0)207 826 9080│ dir: +44 (0)207 826 9085│fax: +44 (0)207 826 9090 │www.libero.uk.com A Lehman Brothers Company AUTHORISED AND REGULATED BY THE FINANCIAL SERVICES AUTHORITY -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Shubha Vishwanath Karanth Sent: 09 April 2008 16:21 To: [EMAIL PROTECTED] Subject: [R] Number of words in a string Hi R, A quick question: How do we find the number of words in a string? Example: C="Have a nice day" And the number of words should be 4. any built in function or?... Thanks, Shubha Shubha Karanth | Amba Research Ph +91 80 3980 8031 | Mob +91 94 4886 4510 Bangalore * Colombo * London * New York * San José * Singapore * www.ambaresearch.com This e-mail may contain confidential and/or privileged i...{{dropped:13}} This message is intended for the personal and confidential use for the designated recipient(s) named above. If you are not the intended recipient of this message you are hereby notified that any review, dissemination, distribution or copying of this message is strictly prohibited. This communication is for information purposes only and should not be regarded as an offer to sell or as a solicitation of an offer to buy any financial product, an official confirmation of any transaction or as an official statement of Libero Ventures Ltd. Email transmissions cannot be guaranteed to be secure or error-free. Therefore we do not represent that this information is complete or accurate and it should not be relied upon as such. All information is subject to change without notice. This e-mail may contain confidential and/or privileged information. If you are not the intended recipient (or have received this e-mail in error) please notify the sender immediately and destroy this e-mail. Any unauthorized copying, disclosure or distribution of the material in this e-mail is strictly forbidden. Any views or opinions presented are solely those of the author and do not necessarily represent those of Amba Holdings Inc., and/or its affiliates. Important additional terms relating to this email can be obtained at http://www.ambaresearch.com/disclaimer __ 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 provide commented, minimal, self-contained, reproducible code. This e-mail may contain confidential and/or privileged information. If you are not the intended recipient (or have received this e-mail in error) please notify the sender immediately and destroy this e-mail. Any unauthorized copying, disclosure or distribution of the material in this e-mail is strictly forbidden. Any views or opinions presented are solely those of the author and do not necessarily represent those of Amba Holdings Inc., and/or its affiliates. Important additional terms relating to this email can be obtained at http://www.ambaresearch.com/disclaimer __ 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 provide commented, minimal, self-contained, reproducible code.
Re: [R] Number of words in a string
So powerful, the gsub... But I really don’t understand the how the regular expressions like " *\\S+$", need to be used and how to make best use of it... Any article/material/links that I can go through? BR, Shubha Shubha Karanth | Amba Research Ph +91 80 3980 8031 | Mob +91 94 4886 4510 Bangalore • Colombo • London • New York • San José • Singapore • www.ambaresearch.com -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Charilaos Skiadas Sent: Thursday, April 10, 2008 3:10 AM To: Hans-Jörg Bibiko Cc: [EMAIL PROTECTED] Subject: Re: [R] Number of words in a string On Apr 9, 2008, at 1:27 PM, Hans-Jörg Bibiko wrote: > > On 09.04.2008, at 17:46, Shubha Vishwanath Karanth wrote: >> To put it simple, >> >> C=c("My Dog", "Its really good", "Beautiful") >> >> Now, >> SOMEFUNCTION(C) should give: c("My", "Its really", "") > > SOMEFUNCTION <- function(x) gsub(" *\\w+$", "", x) > > But be aware that this won't work for instance for combining > diacritics. > If you have this: > > C <- c("My Dog", "Its really good", "Beautiful", "Tuli faŝda") > > in fasda above the s is a combining circumfix ^ > > would give > > [1] "My" "Its really" "" "Tuli faŝ" > > Then one should use the strsplit approach. How about: SOMEFUNCTION <- function(x) gsub(" *\\S+$", "", x) > Cheers, > > --Hans Haris Skiadas Department of Mathematics and Computer Science Hanover College __ 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 provide commented, minimal, self-contained, reproducible code. This e-mail may contain confidential and/or privileged information. If you are not the intended recipient (or have received this e-mail in error) please notify the sender immediately and destroy this e-mail. Any unauthorized copying, disclosure or distribution of the material in this e-mail is strictly forbidden. Any views or opinions presented are solely those of the author and do not necessarily represent those of Amba Holdings Inc., and/or its affiliates. Important additional terms relating to this email can be obtained at http://www.ambaresearch.com/disclaimer __ 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 provide commented, minimal, self-contained, reproducible code.
Re: [R] SAS Data
library(foreign) Rdata=read.ssd("Z:/MyFolder","data1",sascmd = "C:/Program Files/SAS/SAS 9.1/sas.exe") Rdata Y D1 D2 D3 1 100 1 0 0 2 101 1 0 0 3 105 1 0 0 4 200 0 1 0 5 201 0 1 0 6 205 0 1 0 7 300 0 0 1 8 301 0 0 1 9 305 0 0 1 where 'data1' is the SAS datafile to be read, ' Z:\\MyFolder' is the physical path where 'data1.sas7bdat' is situated and 'sascmd' refers to the path where SAS is installed in your system. Please confirm that your SAS is installed in the same path. Also note that you have to install the 'foreign' package to do this. BR, Shubha Shubha Karanth | Amba Research Ph +91 80 3980 8031 | Mob +91 94 4886 4510 Bangalore * Colombo * London * New York * San José * Singapore * www.ambaresearch.com -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Stefo Ratino Sent: Monday, October 13, 2008 5:20 PM To: r-help@r-project.org Subject: [R] SAS Data Hello everybody, I would like to read a SAS Data data1.sas7bdat in R! Is this possible? Thank you a lot in advance ;), Stefo __ 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 provide commented, minimal, self-contained, reproducible code. This e-mail may contain confidential and/or privileged i...{{dropped:10}} __ 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 provide commented, minimal, self-contained, reproducible code.
[R] Row and Column positions
Hi R, m=data.frame(a=c(1,NA,5,5),b=c(4,5,6,7),c=c(NA,NA,NA,5)) I want to know the methods of getting row and column positions of NA in the above dataframe. How do I do this? Thanks, Shubha This e-mail may contain confidential and/or privileged i...{{dropped:13}} __ 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 provide commented, minimal, self-contained, reproducible code.
[R] Mismatch in logical result?
Hi R, I have certain checkings, which gives FALSE, but actually it is true. Why does this happen? Note that the equations that I am checking below are not even the case of recurring decimals... > 1.4^2 == 1.96 [1] FALSE > 1.2^3==1.728 [1] FALSE Thanks in advance, Shubha Shubha Karanth | Amba Research Ph +91 80 3980 8031 | Mob +91 94 4886 4510 Bangalore * Colombo * London * New York * San José * Singapore * www.ambaresearch.com This e-mail may contain confidential and/or privileged i...{{dropped:13}} __ 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 provide commented, minimal, self-contained, reproducible code.
[R] ISIN numbers into Bloomberg tickers
Hi R, Can I convert ISIN numbers into Bloomberg tickers in the RBloomberg package? BR, Shubha [[alternative HTML version deleted]] __ 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 provide commented, minimal, self-contained, reproducible code.
[R] Problem in extracting EQY_DVD_HIST from Bloomberg
Hi R, Again the problem in Bloomberg, I give the below code, > con = blpConnect(show.days="trading",na.action="previous.days",periodicity="da ily")# connecting Bloomberg > div <- blpGetData(con,"IBM US Equity","EQY_DVD_HIST",start=as.chron(as.Date("01/01/2005", "%m/%d/%Y")),end=as.chron(Sys.Date())) > blpDisconnect(con) used (Mb) gc trigger (Mb) max used (Mb) Ncells 480141 12.9 818163 21.9 818163 21.9 Vcells 798590 6.1 1445757 11.1 1441593 11.0 > div EQY_DVD_HIST (09/17/07 19:34:49) NA I get all NA data. What could be the problem? I have the corresponding data in Bloombergbut not able to extract the data from R Thanks in advance, Shubha [[alternative HTML version deleted]] __ 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 provide commented, minimal, self-contained, reproducible code.
[R] FW: ISIN numbers into Bloomberg tickers
Hi David, I tried the following and get the below error messages con = blpConnect(show.days="trading",na.action="previous.days",periodicity="da ily")# connecting Bloomberg > dat <- blpGetData(con,"US4009703799 Equity","PX_LAST",start=as.chron(as.Date("01/01/2005", "%m/%d/%Y"),end=as.chron(Sys.Date()),retval="data.frame") > blpDisconnect(con) used (Mb) gc trigger (Mb) max used (Mb) Ncells 480150 12.9 818163 21.9 818163 21.9 Vcells 797171 6.1 1445757 11.1 1441593 11.0 > dat [DATETIME] PX_LAST day day (09/17/07 19:43:45) NA I don't get the data...but the same statement tried with ticker works. So, any problem with ISIN's? -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Friday, September 14, 2007 10:24 PM To: Shubha Vishwanath Karanth; [EMAIL PROTECTED] Subject: RE: [R] ISIN numbers into Bloomberg tickers You can try > blpGetData(conn, "US912828HA15 Govt", c("ticker", "cpn", "maturity", "market_sector_des"), retval="raw") and paste together the parts. HTH, David L. Reiner Rho Trading Securities, LLC -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Shubha Vishwanath Karanth Sent: Friday, September 14, 2007 8:42 AM To: [EMAIL PROTECTED] Subject: [R] ISIN numbers into Bloomberg tickers Hi R, Can I convert ISIN numbers into Bloomberg tickers in the RBloomberg package? BR, Shubha [[alternative HTML version deleted]] __ 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 provide commented, minimal, self-contained, reproducible code. __ 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 provide commented, minimal, self-contained, reproducible code.
[R] Data manipulations with numbers which are in 'comma' format
Hi R, May be a trivial question, but struggling to find a solution... v=data.frame(a=c("1,234","2,345","5,567")) > v a 11,234 22,345 35,567 I need a column 'b', which is just the addition of column 'a' with 5. How do I do it? And, entries in column 'a' are with commas, always. Also, class(v$a)=factor. BR, Shubha [[alternative HTML version deleted]] __ 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 provide commented, minimal, self-contained, reproducible code.
Re: [R] sum variable as long condition is true
rowsum(c$a,c$b) -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of marcg Sent: Tuesday, October 23, 2007 5:22 PM To: [EMAIL PROTECTED] Subject: [R] sum variable as long condition is true Hello R For expierienced user, the following problem will be easy to solve: a<-c(0,1,0,1,0,2,3,4,3,2) b<-c(3,3,3,4,4,4,7,7,7,10) c<-data.frame(a,b) Data Frame c contains tow colums. I would like to sum up all values in a as long as b stays the same: sum(a[which(b==1)]) does this, but i have to manually put in b then i tryied st like this, but i canno't save it properly for (i in 0:max(b)){ i<-sum(a[which(b==i)]) } i tried to figure out, how tapply works, but neither thanks alot marc -- __ 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 provide commented, minimal, self-contained, reproducible code. __ 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 provide commented, minimal, self-contained, reproducible code.
[R] SavePlot in the Batch mode
Hi R, Does 'savePlot' will not work in the batch mode? I get the below error: > x=c(1,2,3,4,5,6,7) > hist(x) > savePlot("D:\\Test\\histo",type="jpeg") Error in savePlot("D:\\Test\\histo", type = "jpeg") : can only copy from 'windows' devices Execution halted The same works in the interactive mode. What would be the problem? BR, Shubha [[alternative HTML version deleted]] __ 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 provide commented, minimal, self-contained, reproducible code.
[R] Statistics for the Grouped data
Hi R, I have the data, Value 0 1 2 3 4 5 6 Frequency: 258 125 106 94 85 12 5 Say: Value=c(0,1,2,3,4,5,6) Frequency=c(258,125,106,94,85,12,5) In R, how can I find the mean, variance, skewness and kurtosis for this grouped data? Is there a direct way of handling this type of grouped data, instead of writing the code for calculating these statistics? Thanks for your help, Shubha [[alternative HTML version deleted]] __ 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 provide commented, minimal, self-contained, reproducible code.
Re: [R] Have a function like the "_n_" in R ? (Automatic count function)
> temp=data.frame(a=c(4,3,2,6),b=c(7,4,2,4)) > temp a b 1 4 7 2 3 4 3 2 2 4 6 4 > temp$counter=1:nrow(temp) > temp a b counter 1 4 7 1 2 3 4 2 3 2 2 3 4 6 4 4 Shubha Karanth | Amba Research Ph +91 80 3980 8031 | Mob +91 94 4886 4510 Bangalore * Colombo * London * New York * San José * Singapore * www.ambaresearch.com -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of Nash Sent: Wednesday, February 25, 2009 5:55 PM To: r-help Subject: [R] Have a function like the "_n_" in R ? (Automatic count function) Have the counter function in R ? if we use the software SAS /*** SAS Code **/ data tmp(drop= i); retain seed x 0; do i = 1 to 5; call ranuni(seed,x); output; end; run; data new; counter=_n_; * this keyword _n_ ; set tmp; run; /* _n_ (Automatic variables) are created automatically by the DATA step or by DATA step statements. */ /*** Output counter seed x 1 5840432880.27197 2 9359029630.43581 3 3018795230.14057 4 7532125980.35074 5 1607264573 0.74844 / Have a function like the "_n_" in R ? -- Nash - morri...@ibms.sinica.edu.tw __ 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 provide commented, minimal, self-contained, reproducible code. This e-mail may contain confidential and/or privileged i...{{dropped:10}} __ 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 provide commented, minimal, self-contained, reproducible code.
[R] Built-in Code behind SVM
Hi R, I need to see the inner code behind the function "svm" in the package e1071. I enter svm in the console and get the below output. > svm function (x, ...) UseMethod("svm") Is there any way I can look into the code of what svm (support vector machine) is doing? Thanks a lot for your help... Thanks and Regards, Shubha This e-mail may contain confidential and/or privileged i...{{dropped:13}} __ 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 provide commented, minimal, self-contained, reproducible code.
[R] Digitizing the Plot
Hi R, Wanted to check if there are any packages available for getting the (x,y) data points of a graph or a plot, which is in the image format. Say, the plot could be a published report, and I want to get the points of the curve plotted. (I am speaking something related the subject discussed in http://www.uniphiz.com/digitizing.htm) Thanks, Shubha This e-mail may contain confidential and/or privileged i...{{dropped:13}} __ 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 provide commented, minimal, self-contained, reproducible code.