It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 9 years ago.
How do we find the solution of x
say in
2*x=6
using R?
It must be very trivial but I cant find out the appropriate answer.
You can use the solve() function, which can actually handle multiple equations:
solve(2, 6)
The first argument is the left side of the equation, the second is the right side.
It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 10 years ago.
I have a huge csv file of sports (EPL) data which encompasses player performance in every game for their respective teams. I would like to run a loop to compare the amount of times a team has scored first in a match (the data is called First.Goal).
I know how to calculate them individually, e.g for Liverpool from a csv called Prem1112:
Prem<-read.csv("Prem1112.csv")
sum(subset(Prem,Team=='Liverpool',First.Goal))
Ideally I'd like to run the loop so I wouldn't have to calculate all 20 teams individually. Any ideas?
What about this:
aggregate(First.Goal ~ Team, Prem, sum)
It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 10 years ago.
In many programming problems (e.g. some Project Euler problems) we are asked to report the answer as the remainder left after dividing the answer by 1,000,000,007.
Why not any other number?
Edit:
2 years later, here's what I know: the number is a big prime, and any answer to such a question is so large that it makes sense to report a remainder instead (as the number may be too large for a native datatype to handle).
Let me play a telepathist. 1000...7 are prime numbers and 1000000007 is the biggest one that fits in 32-bit integer. Since prime numbers are used to calculate hash (by finding the remainder of the division by prime), 1000000007 is good for calculating 32-bit hash.
It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 10 years ago.
Tiles = {
{0,0,0,0,0,0,0,0,0,0},
{0,2,2,2,2,2,2,2,2,0},
{0,3,0,0,2,4,2,2,2,0},
{0,0,2,0,0,0,2,2,2,0},
{0,0,2,2,2,0,2,2,2,0},
{0,0,0,0,2,0,2,2,2,0},
{0,0,2,2,2,0,2,2,2,0},
{0,0,0,0,0,0,0,0,0,0}
}
0 is not clickable, other is clickable, otherways 0 is walkable an other is not, weh i click Tiles[3][2] (number 3) then Tiles[3][6] (number 4), i want to connect that 2 tile through walkable tile, the problem is i dont need a shortest solution, instead i need solution that have 2 or less corner (turning), i have spent 3 days to imagine and googling the algorithm, but no luck, can someone give me a clue or article about that, and i use lua but other language is still i appreciate.
Transform your grid into a graph using the following rules:
Every walkable tile in the grid corresponds to a node in the graph.
Two nodes are connected (with weight 1) in the graph if they are in the same row or column in the grid and every tile between them in the grid is walkable.
The shortest path in the graph corresponds to the path with fewest corners in the grid.
It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 11 years ago.
i assume that we have 2 labeled graphs G and T and the algorithm determine if G a subgraph of T and the corresponding vertices in the main graphT and the subgraph G should have same label
That problem is called "subgraph isomorphism" and it is NP-complete (and so likely to be hard). Do you need a general solution for this, or just for a particular graph G? The second case is much easier. There is some general information about algorithms here. There is a version of one of the algorithms (actually, for a more general problem) in the Boost Graph Library (see documentation here).
A general answer for a general question: the problem you want to solve is known as 'subgraph isomorphism.' Have a look here for further references: http://en.wikipedia.org/wiki/Subgraph_isomorphism_problem .