input - read.table line 15 does not contain 23 elements - R -
here code used:
d = read.table("movies.txt", sep="\t", col.names=c( "id", "name", "date", "link", "c1", "c2", "c3","c4", "c5", "c6","c7", "c8", "c9","c10", "c11", "c12","c13", "c14", "c15","c16", "c17", "c18", "c19"), fill=false, strip.white=true)
and here text file:
1 toy story (1995) 01-jan-95 http://us.imdb.com/m/title-exact?toy%20story%20(1995) 0 0 0 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 2 goldeneye (1995) 01-jan-95 http://us.imdb.com/m/title-exact?goldeneye%20(1995) 0 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 3 4 rooms (1995) 01-jan-95 http://us.imdb.com/m/title-exact?four%20rooms%20(1995) 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 4 shorty (1995) 01-jan-95 http://us.imdb.com/m/title-exact?get%20shorty%20(1995) 0 1 0 0 0 1 0 0 1 0 0 0 0 0 0 0 0 0 0 5 copycat (1995) 01-jan-95 http://us.imdb.com/m/title-exact?copycat%20(1995) 0 0 0 0 0 0 1 0 1 0 0 0 0 0 0 0 1 0 0 6 shanghai triad (yao yao yao dao waipo qiao) (1995) 01-jan-95 http://us.imdb.com/title?yao+a+yao+yao+dao+waipo+qiao+(1995) 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 7 twelve monkeys (1995) 01-jan-95 http://us.imdb.com/m/title-exact?twelve%20monkeys%20(1995) 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 1 0 0 0 8 babe (1995) 01-jan-95 http://us.imdb.com/m/title-exact?babe%20(1995) 0 0 0 0 1 1 0 0 1 0 0 0 0 0 0 0 0 0 0 9 dead man walking (1995) 01-jan-95 http://us.imdb.com/m/title-exact?dead%20man%20walking%20(1995) 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 10 richard iii (1995) 22-jan-96 http://us.imdb.com/m/title-exact?richard%20iii%20(1995) 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 1 0 11 7 (se7en) (1995) 01-jan-95 http://us.imdb.com/m/title-exact?se7en%20(1995) 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 1 0 0 12 "usual suspects, (1995)" 14-aug-95 "http://us.imdb.com/m/title-exact?usual%20suspects,%20the%20(1995)" 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 1 0 0 13 mighty aphrodite (1995) 30-oct-95 http://us.imdb.com/m/title-exact?mighty%20aphrodite%20(1995) 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 14 "postino, il (1994)" 01-jan-94 "http://us.imdb.com/m/title-exact?postino,%20il%20(1994)" 0 0 0 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 15 mr. holland's opus (1995) 29-jan-96 http://us.imdb.com/m/title-exact?mr.%20holland's%20opus%20(1995) 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 16 french twist (gazon maudit) (1995) 01-jan-95 http://us.imdb.com/m/title-exact?gazon%20maudit%20(1995) 0 0 0 0 0 1 0 0 0 0 0 0 0 0 1 0 0 0 0 17 dusk till dawn (1996) 05-feb-96 http://us.imdb.com/m/title-exact?from%20dusk%20till%20dawn%20(1996) 0 1 0 0 0 1 1 0 0 0 0 1 0 0 0 0 1 0 0 18 "white balloon, (1995)" 01-jan-95 http://us.imdb.com/m/title-exact?badkonake%20sefid%20(1995) 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 19 antonia's line (1995) 01-jan-95 http://us.imdb.com/m/title-exact?antonia%20(1995) 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 20 angels , insects (1995) 01-jan-95 http://us.imdb.com/m/title-exact?angels%20and%20insects%20(1995) 0 0 0 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0
it clear line 15 had 23 elements. clearer when in text editor there tabs should be. why getting error message ?
disable quoting adding parameter quote = ""
read.table()
.
i believe issue various single '
, double-quotes "
throughout file.
look @ ?read.table
more information. per documentation, can @ ?scan
how behavior of quotes embedded in quotes handled.
Comments
Post a Comment