This question already has answers here:
Erlang: What does question mark syntax mean?
(3 answers)
Closed 2 years ago.
I see alot of code in erlang with a question mark before it, what does it mean? Is it Macros or can it be used in another way? Example:
{Total, Pids} = run(10, 20),
?assertEqual(200, Total),
?assert(processes_stopped(Pids)).
or:
?MODULE
When you try call macros, you need add in start of name ‘?’. Notes: the macros can create with or without arguments.
Related
This question already has an answer here:
grepl not searching correctly in R
(1 answer)
Closed 6 years ago.
I want to know if there is a certain string contained in another string. This works fine here:
grepl("a","a")
However, what I actually want to test is the following and this one doesn't work:
grepl("is.na(x)","is.na(x)")
Can anyone help?
You can escape the special characters like this:
grepl("is\\.na\\(x\\)","is.na(x)")
[1] TRUE
This question already has answers here:
grepl for a period "." in R?
(2 answers)
Closed 6 years ago.
I am trying to grep all the records of a dataframe which has a full stop in it. But it returns all the records in the dataframe no matter it has a full stop or not.
dot=e[grep(".", e$e1),]
View(dot)
Can anyone help me to do this in the correct way please?
You can either use the fixed=True argument, or use "\."
dot=e[grep(".", e$e1, fixed=T),]
or
dot=e[grep("\\.", e$e1),]
The first option is probably preferable.
This question already has answers here:
How can I reverse the order of lines in a file?
(24 answers)
Closed 7 years ago.
I need to print a file, but from the last line to the first.
I think I can append a number to the beginning of each line, sort descending, and then remove the line numbers, but there's probably some more elegant way to do that. is there?
You can use tac command
(tac- cat spelled backwards...)
This question already has answers here:
How can I paste 100000 without it being shortened to 1e+05? [duplicate]
(3 answers)
Closed 9 years ago.
The result of function was displayed in scientific notation, I want to change it back to normal, but only for that function, I don't want to change the global setting. Can anyone help?
You can do:
format(functionResult, scientific=FALSE);
or:
as.integer(functionResult);
This question already has answers here:
Comma separator for numbers in R?
(4 answers)
Closed 4 years ago.
I often use RStudio for a simple calculations, something like the following
> (3.456+4.008)*13000+1000000
[1] 1097032
And my question (rather stupid, I assume, but I haven't find an answer) is if it's possible to make the output more friendly? E.g.:
> (3.456+4.008)*13000+1000000
[1] 1'097'032
At the prompt:
?format
As an example
format(12345.6789, digits=9, decimal.mark=",");