error in rstudio
0
0
Entering edit mode
7.1 years ago
Angel ★ 4.1k

Hey dudes,

I have gene_lengths file in /Users/Lenovo/Desktop, I want to read it, I did like so in rstudio

> genes <- as.data.frame(read.table("/Users/Lenovo/Desktop/read.csv("gene_lengths.csv", sep=""))
Error: unexpected symbol in "genes <- as.data.frame(read.table("/Users/Lenovo/Desktop/read.csv("gene_lengths.csv"

What is the fault please?

csv matrix rstudio • 2.5k views
ADD COMMENT
3
Entering edit mode

Hello Fereshteh!

We believe that this post does not fit the main topic of this site.

Not related to bioinformatics

For this reason we have closed your question. This allows us to keep the site focused on the topics that the community can help with.

If you disagree please tell us why in a reply below, we'll be happy to talk about it.

Cheers!

ADD REPLY
1
Entering edit mode

If memory serves me, many years ago I had a similar error, and the cause was particular (or at least more common) to bioinformatics: some gene names use reserved R words, or symbols which R couldn't handle. In my case, it was a tsv file and fields were not quoted, quoting the fields solved the error. As this happened many years ago, I really do not remember the specific cause of the error, nor I have the file to try and repeat it.

ADD REPLY
1
Entering edit mode

Alright, I'll re-open the question and Angel can host the file someplace so we can try and figure out the specific problem.

ADD REPLY
0
Entering edit mode

hello Ram,

ok thank you all biostars...

ADD REPLY
1
Entering edit mode

Please upload the file on Google Drive/DropBox/Github Gist and give us the link, we can try to figure out the underlying cause.

ADD REPLY
1
Entering edit mode
If it's a csv file you're loading into a data frame, shouldn't it be sep=","?
ADD REPLY
0
Entering edit mode

I have an excel file named gene_lengths and a csv file both in the same directory and I want read the excel one, I uploaded csv in the top window but I don know how to read the excel file now

ADD REPLY
1
Entering edit mode

Fereshteh, whereas there is "gene" in the name of the file you need to import, this question is not related to biology at all. Besides this, considering your R question: it is important that you learn the language if you aim to keep it as an analysis companion tool. There are plenty of R tutorials out there.

For the rest, simply try:

genes <- read.csv("/Users/Lenovo/Desktop/gene_lengths.csv")

Dude

ADD REPLY
0
Entering edit mode

Thanks you both, this my duty to be ready with rstudio for Monday but I found it confusing...

ADD REPLY

Login before adding your answer.

Traffic: 1722 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6