I am reading a text file containing a table so I have used read.table
function in R and getting the problem.
Error in FUN(left) : invalid argument type
This is the command I have used for reading table.
data = read.table("intensity.txt", header=T, stringsAsFactors=F)
The format of text file is as (Intensity value)
control.drought control.heat drought.control control.combined
1 -0.5817744498 -10.0890279047 0.5817744498 -11.0284839686
2 -0.3181022766 -9.0243890594 0.3181022766 -10.2859574516
3 -0.2690112456 -8.0796832998 0.2690112456 -9.0171546861
4 -0.1847218231 -3.7873259884 0.1847218231 -4.3059746476
5 -0.2024207047 -3.8210416657 0.2024207047 -4.3258501175
6 -0.6141010588 -4.4140746914 0.6141010588 -5.0397997135
7 -2.2505578122 -10.1398011434 2.2505578122 -10.1410584892
8 -0.3309324672 -4.0731881207 0.3309324672 -4.238998183
9 -0.4096105152 -3.8298292653 0.4096105152 -4.0147223178
10 -0.0036240574 -2.8959797594 0.0036240574 -3.0966125001
There is no probable reason, that you should have this error. Try labelling the first column (rowname/serial numbercol) with a name and read again?
Can't reproduce the error. Upload sample data if still you are in trouble.
I believe it will not be produced if you are trying to reproduce it in vi editor or nano, if you try to do it local machine with any text editor sometimes the file encoding changes. Probably the OP was trying to use text editor in local machine rather than in terminal and then run R locally in their machine. I did not have any problems when I ran it in through terminal while it was reproducible when I simply copied the data and pasted in the .txt file, only to find out that the file had different encoding and that the local R was unable to figure that out so the error. If you edit the .txt file to standard encoding it works of ask the local R to recognize it as the standard encoding.
Thanks @ Sukhdeep, BioM, vchris_ngs for your valuable time.
I have tried as suggested by vchris_ngs but still getting the same error as before.
Can you share the file with us (dropbox/drive/gist)? and in R type :
sessionInfo()
and paste the output here.Can you tell me what is the file encoding of your
intensity.txt
, I checked it again. I just copied the data from your question and pasted in a text editor and checked the file encoding to UTF-8 and it simply working with the below commands. It is only the problem of encoding. If you are working on mac then use text wrangler to see the file encoding else see notepad++ for windows. This happens if you use mostly excel or convert a file from one format to another by simply copy pasting its contents and changing the extensions. So just open the .txt in any of the above above mentioned text editor to do the needful and use any of the below commandsI just put the data in this way
Thanks you all I have started another session of R and now its working fine.
But here comes the new problem
Please help me solve this problem.
Thanks all for helping me in getting the results.
Finally I got heat map of DE genes in a microarray experiment.