R programming: Reading a table in R

0 votes

I'm trying to read a table in R:

dat <- read.table("~/data/data.txt",quote="\"",c("com","Type","col1","col2"),header=TRUE). 

I get the following error:

Error in scan(file, what = "", sep = sep, quote = quote, nlines = 1, quiet = TRUE,  : invalid 'sep' value: must be one byte)
May 13, 2019 in Data Analytics by Tyrion anex
• 8,320 points
86 views

1 answer to this question.

0 votes

Try this code:

dat <- read.table("~/data/data.txt", quote="\"", 
                  col.names=c("com", "Type", "col1", "col2"), header=TRUE). 

Hope it helps.

answered May 13, 2019 by Sophie may
• 9,900 points

Related Questions In Data Analytics

0 votes
1 answer

How to convert a sentence to word table in R?

Try the following code: sentence <- c("case sweden", ...READ MORE

answered Jun 21, 2018 in Data Analytics by Sahiti
• 6,290 points
43 views
0 votes
2 answers

What are the rules to define a variable name in R programming language?

The same rules almost follow for all ...READ MORE

answered Aug 26, 2019 in Data Analytics by anonymous
• 32,440 points
146 views
0 votes
1 answer

Check if a matrix is diagonalizable in R Programming Language

On a given matrix, a, the first way ...READ MORE

answered Dec 24, 2018 in Data Analytics by Tyrion anex
• 8,320 points
66 views
+9 votes
3 answers

Which is a better initiative to learn data science: Python or R?

Well it truly depends on your requirement, If ...READ MORE

answered Aug 8, 2018 in Data Analytics by Anmol
• 3,680 points
97 views
0 votes
1 answer

Error saying "vector size cannot be NA" when using R with data mining

You can use the removesparseterm function.  Removes sparse ...READ MORE

answered Nov 15, 2018 in Data Analytics by Maverick
• 10,800 points
671 views
+1 vote
2 answers
0 votes
1 answer

Trying to find frequent itemsets of a data set using arules package

Try replacing ID <- c("A123","A123","A123","A123","B456","B456","B456") item <- c("bread", "butter", "milk", ...READ MORE

answered Nov 15, 2018 in Data Analytics by Maverick
• 10,800 points
52 views
0 votes
1 answer

Can we have an if loop inside a for loop in R programming?

You're If loop doesn't have any condition ...READ MORE

answered Dec 21, 2018 in Data Analytics by Sophie may
• 9,900 points
57 views
0 votes
3 answers

Can a C program be written in R programming language?

If you have a algorithm you can ...READ MORE

answered Apr 9, 2019 in Data Analytics by anonymous
91 views