Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

R Programming - String getting converted to numbers

Tags:

r

I have a text file with 100 names that I am trying to concatenate to create a large single string using the following code. However, my output is showing me a number for each name instead of the actual names itself.

It seems that when these names are being converted into character using the paste function, they are being converted into numbers. Any help will be greatly appreciated.

input=(read.csv("names.txt"))
final_output1 = paste(input, collapse = '')
like image 444
Neha Mandhani Avatar asked Jun 29 '26 08:06

Neha Mandhani


1 Answers

The read.csv() function has a "stringAsFactors" argument that you can set to FLASE.

input <- read.csv("names.txt", stringsAsFactors=FALSE)
like image 107
keberwein Avatar answered Jun 30 '26 23:06

keberwein