R Programming Issue: Passing characters to matrix converts them to a number -
i'm trying write pretty simple loop i'm passing name top row of 1 data frame space in matrix. i'm having issue when try this, name trying pass matrix instead showing number in matrix (which turns out number in cell down 4 rows name in original data frame).
here's of code results get:
mock_board 8x14 matrix trying pass names to
adpsort large data frame kinds of names , statistics sorted category name want pull @ top row of data frame.
all i'm trying is: mock_board[1,1] <- adpsort[1,1] (there's more in actual program, when breaking down far still gives me error)
here getting (commands in regular, computer response in italics):
adpsort[1,1] - player name
mock_board[1,1] - na
but after
mock_board[1,1] <- adpsort[1,1]
mock_board[1,1] - 4
so reason instead of passing player name mock_board[1,1], r passing 4 instead. tried changing matrix data frame did make mock_board[1,1] = "4" after attempting pass "player name" it. i've been stuck on while , hoping point me in right direction fixing it. in advance!
turns out name column of factor class - used as.character convert column character class , works fine now
Comments
Post a Comment