0

I'm trying to assign a certain quantity of computers from one big portion to a smaller portion of computers.

If I increase the number of computer types I don't get an error, but I want to have only one type of computers.

If a run the command below with number_of_computer_types=1 (I get the error) if the number_of_computer_types >1 (I do not get the error) command:

quantity_computers[nodeCount,] <- quantity_maincomputers[computerNode,]

When running a function in R:

computer_status <- initliaze_computer_status(num_nodes,number_of_computer_types)

I expect to be able to input one type of computers in my code and assign it to another portion of computers. for example, assign 5 Dell PC's from a total of 30 Dell PC's to a certain customer.

How can I solve this error?

MrFlick
  • 195,160
  • 17
  • 277
  • 295
Gal
  • 1
  • 1
  • 2
  • 2
    Here is how to format code on stackoverflow.https://stackoverflow.com/editing-help . Also, With logical, you need to use == instead of just a = . It is same in almost all programming languages . Maybe that is the issue here – R.S. May 25 '19 at 19:23
  • 4
    When asking for help, you should include a simple [reproducible example](https://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example) with sample input and desired output that can be used to test and verify possible solutions. – MrFlick May 25 '19 at 19:39
  • I tried to use == but it did not solve the problem, The code I wrote is: if(n == computerNode){ computerNet <- computerNet %>% add_edges(c(nodeCount,computerNode)) quantity_computer[nodeCount,] <- quantity_computer[computerNode,] } – Gal May 26 '19 at 18:26

0 Answers0