class - R - solve_LSAP clue package how to write results in txt file? -


i using solve_lsap hungarian/munkres algorithm assignment problem clue package in r. need run several different assigmment problems , save them in separate txt file (or type of file if possible) in loop subsequent processing required problem have. wondering if/how can that.

i use following code:

y <- solve_lsap(costmatrix, maximum = true) str(y) 

it class "solve_lsap" object , when want write in txt file not allow me. gives "cannot coerce class ""solve_lsap"" error.

how can solve problem , write class object in file in r? not seem find solution here far.

thanks help.

this worked me

sol  optimal assignment: 1 => 3, 2 => 13, 3 => 2, 4 => 6, 5 => 9, 6 => 7, 7 => 14, 8 => 10, 9 => 15, 10 => 16, 11 => 12  class(sol)  [1] "solve_lsap"  length(sol)  [1] 11  sink("results.txt", append=true) (i in 1:length(sol)){     cat(sprintf("%i\n", sol[i])) } sink() 

Comments

Popular posts from this blog

sublimetext3 - what keyboard shortcut is to comment/uncomment for this script tag in sublime -

java - No use of nillable="0" in SOAP Webservice -

ubuntu - Laravel 5.2 quickstart guide gives Not Found Error -