I am running the code , getting following error-- Error in x[i, ] : incorrect number of dimensions
On Fri, Jun 15, 2012 at 8:03 PM, Michael Weylandt [via R] < ml-node+s789695n4633507...@n4.nabble.com> wrote: > On Fri, Jun 15, 2012 at 1:48 AM, raishilpa <[hidden > email]<http://user/SendEmail.jtp?type=node&node=4633507&i=0>> > wrote: > > > hello, > > I am using the following code > > > >>s<-"I am very happy, excited, and optimistic.I am very scared, annoyed, > and > > irritated.Iraqâs political crisis entered its second week one step > closer to > > the potential.dissolution of the government, with a call for elections > by a > > vital coalition partner and a suicide attack that extended the spate of > > violence. that has followed the withdrawal.of U.S. troops" > > > >> sentDetect(s, language = "en") > > #getting output in the following way > > > > [1] "I am very happy, excited, and optimistic.I am very scared, annoyed, > and > > irritated.Iraqâs " > > [2] "political crisis entered its second week one step closer to the > > potential.dissolution " > > [3] "of the government, with a call for elections by a vital coalition > > partner and a suicide attack that extended the spate of violence. " > > [4] "that has followed the withdrawal.of " > > [5] "U.S. troops" > > > > I want output in some different way...since sentences [1] [2] [3] [4] > [5] > > are from " s" I want output in following way > > > > [1] -"I am very happy, excited, and optimistic.I am very scared, > annoyed, > > and irritated.Iraqâs political crisis entered its second week one step > > closer to the potential.dissolution of the government, with a call for > > elections by a vital coalition partner and a suicide attack that > extended > > the spate of violence. that has followed the withdrawal.of U.S. troops" > > [1,1] "I am very happy, excited, and optimistic.I am very scared, > annoyed, > > and irritated.Iraqâs " > > [1,2] "political crisis entered its second week one step closer to the > > potential.dissolution " > > [1,3] "of the government, with a call for elections by a vital coalition > > partner and a suicide attack that extended the spate of violence. " > > [1,4] "that has followed the withdrawal.of " > > [1,5] "U.S. troops" > > > > or in some other way that you guys can suggest me...but remember one > thing- > > under the main paragraph all the sentences should come so that it become > > easy to recognize the parent para of the sub-sentences. > > Unfortunately, the structure you're asking for doesn't immediately > lend it self to one of R's main data-structures. Where I'd think of > wedging this in would be in a print method, but I'm not sure if that > fits your particular use case. > > Something like this [un-tested]: > > print.sentiment <- function(x, ...){ > for(i in NROW(x)){ > cat(paste(x[i,]), "\n") > print(x[i,]) > } > } > > with appropriate constructor. > > Hopefully this will get you started, > Michael > > > > > thanking you in anticipation > > Shilpa Rai > > MSc IIT Bombay > > . > > > > > > > > > > > > -- > > View this message in context: > http://r.789695.n4.nabble.com/help-in-sentDetect-fuction-tp4633462.html > > Sent from the R help mailing list archive at Nabble.com. > > > > ______________________________________________ > > [hidden email] > > <http://user/SendEmail.jtp?type=node&node=4633507&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. > > ______________________________________________ > [hidden email] <http://user/SendEmail.jtp?type=node&node=4633507&i=2>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/help-in-sentDetect-fuction-tp4633462p4633507.html > To unsubscribe from help in sentDetect() fuction, click > here<http://r.789695.n4.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=4633462&code=cmFpc2hpbHBhLmJodUBnbWFpbC5jb218NDYzMzQ2MnwxOTAyOTIzNTU5> > . > 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> > -- Shilpa Rai MSc.(2011-2013) Applied Statistics and Informatics Indian Institute of Technology,Bombay -- View this message in context: http://r.789695.n4.nabble.com/help-in-sentDetect-fuction-tp4633462p4633804.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.