R-Studio error "> " signs became "+" - machine-learning

We have a homework on R-studio and while applying steps I've got an error, as shown below:
+ +library(simpleaffy)
+ +>hist(dat)
+ +plotAffyRNAdeg(RNAdeg, col=cols)
+ +end()
+ +options(error = expression(NULL))
+ +>hist(prostate)
+ +>hist(prostate)
+ +source('~/.active-rstudio-document')
These are just some random codes which I wrote while trying to dispose pluses
They must be > to run the steps, but I can't run because of this error.

You have to omit both > and + at the beginning of the lines. Your code has to look like this:
library(simpleaffy)
hist(dat)
plotAffyRNAdeg(RNAdeg, col=cols)
end()
options(error = expression(NULL))
hist(prostate)
hist(prostate)
source('~/.active-rstudio-document')

You probably want to ask programming questions on StackOverflow.
A line starting with + means R is expecting more input. It usually occurs because you haven't closed a parenthesis.

Related

Lua Nvim —— Error loading lua [string ":lua"]:5: '}' expected (to close '{' at line 3) near '['

I have a init.vim file and have some embedded lua that was working perfectly fine until just now. It keeps giving me the error below:
Error loading lua [string ":lua"]:5: '}' expected (to close '{' at line 3) near '['
I have double and triple checked that there are no curly parentheses left opened (or maybe i'm just blind) but it still seems to throw the error. Here is the code:
1 local servers = {'clangd'}
2 require('neorg').setup {
3 load = {
4 ["core.defaults"] = {}
5 ["core.norg.dirman"] = {
6 config = {
7 workspaces = {
8 dev = "~/notes/dev",
9 school = "~/notes/school",
10 }
11 }
12 }
13
14 }
15 }
You forgot a comma on line 4:
4 ["core.defaults"] = {}, -- note the added trailing comma
5 ["core.norg.dirman"] = {
to separate it from line 5.
Lua thinks that rather than forgetting to add a comma you forgot to close the table - it can't tell your intention. In general, when looking for syntax errors, always carefully reread the lines in question - don't limit your search to what the error message says (although you should take the error message as a first hint) since error messages may be inaccurate.

How to get the content between two identical elements

I want to parse the root element of such data as follows
<elementA>
...
...anything
...
</ elementA>
<elementB>
<!--anything such as same element name-->
<elementB>hahahha</elementB>
</elementB>
<
elementC
>
{
”aa“: 11,
}
</
elementC >
If I am successful in parsing, a list will be returned with a structure similar to the following
[
"elementA":"...\n...anything\n...",
"elementB":"<!--anything such as same element name-->\n<elementB>hahahha</elementB>",
"elementC":"{\n\”aa\“: 11,\n}",
]
I also refer to this library dart-xml
Here is my core parsing logic
// 元素:空格 + < 空格 + 名 + 空格 + > + 内容 + </ + 空格 + 名 + 空格 + > + 空格)
Parser element() => ref0(spaceOptional)
.seq(RootToken.openElement.toParser())
.seq(ref0(spaceOptional))
.seq(ref0(wrapName))
.seq(ref0(spaceOptional))
.seq(RootToken.closeElement.toParser())
.seq(ref0(content))
.seq(RootToken.openEndElement.toParser())
.seq(ref0(spaceOptional))
.seq(ref0(wrapName))
.seq(ref0(spaceOptional))
.seq(RootToken.closeElement.toParser())
.seq(ref0(spaceOptional));
But I don't know how to parse the content, because the content contains arbitrary characters, such as the same name as the root element。
Also thanks for this library dart-petitparser and the author, thanks.
Your code looks fine, I assume the question is how to define the content production so that it consumes everything nested into the element?
There are multiple ways depending on your exact requirements. The following code recursively parses other elements OR any other character.
Parser content() => (ref0(element) | any()).star();
If you want to study a full blown example have a look at the XML parser on GitHub.

Qt: how to apply a shortcut( Key_Comma + Key_Return) to action

I tried to set a shortcut by the following code, but it doesn't work. If I change it to ALT + Comma or ALT + Return, it will be fine. but the request is Comma + Return. Does anyone know how to set this special shortcut on Qt?
#shotcut = Qt::Shortcut.new(Qt::KeySequence.new(Qt::Key_Comma +
Qt::Key_Return), self, SLOT('save_by_shortcut()'))
#shotcut.setEnabled(true)
Any help would be appreciated!
You can create it by using the multiple arguments constructor for QKeySequence.
like this:
auto ac = new QAction(this);
ac->setShortcut(Qt::Key_Comma + Qt::Key_Return);

Sublime text 2 Plugin Development - How do I get the language of the current file

== UPDATE ===
So I realized that Sublime already has a command for adding comments. So if I have code inserted like this:
comment = " ----------------------------------------" + '\n'
comment += " " + title + '\n'
comment += " #author " + author + '\n'
comment += " #url " + url + '\n'
comment += " ---------------------------------------" + '\n'
comment = self.view.run_command('toggle_comment')
code = items['code']
layout = comment + code
self.view.replace(edit, sel[0], layout)
How do I get the command to work so that it comments out the comment variable? Thanks.
Initial Question
I am creating a plugin for Sublime Text 2 and want to make sure that when it inserts/replaces code it inserts comments as well, but to do this I need for it to insert the correct comment types for the various languages. I know that I can run the following command:
view.settings().get('syntax')
And that will return something like this:
Packages/Python/Python.tmLanguage
Is there a way to have it return just PHP, Python, C++, etc.
I'm sure I could do a substring command in Python, but since I can see an easy way of seeing all file settings I wanted to make sure there wasn't a quick easy way of doing this. Thanks for the help.
Are you looking for scope_name ?
scope_name(point) | String | Returns the syntax name assigned to the character at the given point.

context menu demo app not working crossrider

I am generating context menu when user selects some text and right click it. I tried implementing it, problem is even sample application is not working.
http://crossrider.com/apps/10565/ide
appAPI.contextMenu.add("key1", "Display data object", function (data) {
var sAlertText = 'pageUrl: ' + data.pageUrl + '\r\n' +
'linkUrl: ' + data.linkUrl + '\r\n' +
'selectedText:' + data.selectedText + '\r\n' +
'srcUrl:' + data.srcUrl;
alert(sAlertText);
}, ["all"]);
Only data.pageUrl is available rest of all are "undefined". I want selectedText.
Disclaimer: I work at Crossrider.
Indeed there was an issue with the contextMenu due to a change in the Chrome API.
We've fixed this and now the demo app works.
Thank you for reporting this and please feel free to let us know if you encounter any issues!
Amir

Resources