Hi A.K
I modified and got the results
thanks A.K

library(XML)
URL <-  "
http://money.securebank.in/index.php?option=com_dashboard&view=history&Itemid=56&startdate=01/01/2014&enddate=02/07/2014&exchange=MCX&sid=1
"
doc <- htmlParse(URL)
tableNodes <- getNodeSet(doc, "//table")
l=length(tableNodes)
dat1 <- readHTMLTable(tableNodes[[l]], colClasses=c("numeric","character",
"character", "numeric", "character", "numeric", "numeric", "character",
"numeric"),stringsAsFactors=FALSE)
dat1$DATE <- as.Date(dat1$DATE, "%d-%m-%Y")
str(dat1)


On Thu, Jul 3, 2014 at 10:14 AM, Velappan Periasamy <veepsi...@gmail.com>
wrote:

> Hi A.K
>
> -----------------------------
> library(XML)
> URL <-  "
> http://money.securebank.in/index.php?option=com_dashboard&view=history&Itemid=56&startdate=01/01/2013&enddate=6/9/2014&exchange=MCX&sid=1";
>
> doc <- htmlParse(URL)
> tableNodes <- getNodeSet(doc, "//table")
> dat1 <- readHTMLTable(tableNodes[[4]], colClasses=c("numeric","character",
> "character", "numeric", "character", "numeric", "numeric", "character",
> "numeric"),stringsAsFactors=FALSE)
> dat1$DATE <- as.Date(dat1$DATE, "%d-%m-%Y")
> str(dat1)
> ------------------------------
>
>
> I got this error,while running the above code under RStudio.,
> how to correct it?.
>
> > dat1 <- readHTMLTable(tableNodes[[4]],
> colClasses=c("numeric","character", "character", "numeric", "character",
> "numeric", "numeric", "character", " ..." ... [TRUNCATED]
> Error in readHTMLTable(tableNodes[[4]], colClasses = c("numeric",
> "character",  :
>   error in evaluating the argument 'doc' in selecting a method for
> function 'readHTMLTable': Error in tableNodes[[4]] : subscript out of
> bounds
>
>
> On Thu, Jul 3, 2014 at 12:42 AM, arun kirshna [via R] <
> ml-node+s789695n4693407...@n4.nabble.com> wrote:
>
>>
>> Hi veepsirtt,
>>
>>
>> If `dat` is the dataset
>>
>> library(dplyr)
>>  dat %>%
>>
>> group_by(DATE) %>%
>>
>> summarize(PROFIT=sum(PROFIT)) %>%
>>  arrange(desc(as.Date(DATE,format="%d/%m/%Y")))
>> Source: local data frame [4 x 2]
>>
>>         DATE PROFIT
>> 1 02/07/2014  -1350
>> 2 01/07/2014   9400
>> 3 30/06/2014  11325
>> 4 27/06/2014   6850
>>
>>
>> If you just wanted to have a new variable subTotalPROFIT and not
>> summarize the dataset
>>
>>
>>  dat %>%
>>
>>  group_by(DATE) %>%
>>
>>  mutate(subTotalPROFIT=sum(PROFIT)) %>%
>>
>> arrange(desc(as.Date(DATE,format="%d/%m/%Y")))
>>
>> A.K.
>>
>>
>>
>> On Wednesday, July 2, 2014 4:03 AM, Velappan Periasamy <[hidden email]
>> <http://user/SendEmail.jtp?type=node&node=4693407&i=0>> wrote:
>>
>>
>>
>> Hi A.K,
>> How to Sort the  given data.frame date wise in a descending order
>>  and getting date wise subtotal
>>
>> SLNO.        DATE        SCRIP        PROFIT
>> 6006302/07/2014Aluminium       -1000
>> 6005702/07/2014Copper  900
>> 6005602/07/2014LEAD       -1250
>> 6002901/07/2014Crude Oil6400
>> 6003401/07/2014LEAD        1500
>> 6002501/07/2014Nickel        1500
>> 5998030/06/2014Nickel          475
>> 5998430/06/2014Natural Gas3000
>> 5997230/06/2014Crude Oil2600
>> 5997130/06/2014Copper3750
>> 5997030/06/2014Natural Gas1500
>> 5992427/06/2014Aluminium    500
>> 5992227/06/2014LEAD        2250
>> 5992027/06/2014Copper1100
>> 5991827/06/2014Natural Gas3000
>>
>> Thanks
>> veepsirtt
>>
>> ______________________________________________
>> [hidden email] <http://user/SendEmail.jtp?type=node&node=4693407&i=1>
>> 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.
>>
>>
>> ------------------------------
>>  If you reply to this email, your message will be added to the
>> discussion below:
>>
>> http://r.789695.n4.nabble.com/Sorting-data-frame-datewise-in-a-descending-order-and-geting-datewise-subtotl-tp4693384p4693407.html
>>  To unsubscribe from Sorting data.frame datewise in a descending order
>> and geting datewise subtotl, click here
>> <http://r.789695.n4.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=4693384&code=dmVlcHNpcnR0QGdtYWlsLmNvbXw0NjkzMzg0fDY5NzkzMTE3Nw==>
>> .
>> NAML
>> <http://r.789695.n4.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml>
>>
>
>




--
View this message in context: 
http://r.789695.n4.nabble.com/Sorting-data-frame-datewise-in-a-descending-order-and-geting-datewise-subtotl-tp4693384p4693431.html
Sent from the R help mailing list archive at Nabble.com.
        [[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.

Reply via email to