Hello everyone, I am trying to run an R script to generate a heat-map but I keep getting the following error. I have no idea what is wrong with my input file. My input looks like this:
male female juvenile egg blastula
Aub 13.3 34.1 2323 321 3231
piwi 23 34 34 54 534
Ago 35 65 34 34 56
Ago2 0 0 0 0 0
-bash: ./HeatMap.R: cannot execute binary file
my R script look like this.
#!/usr/bin/env Rscript
library("gplots")
Data <- read.csv("input.txt", sep = "\t", header = TRUE)
DataMatrix <- data.matrix(Data)
rownames(DataMatrix) <- c("Aub", "piwi", "Ago", "Ago2")
colnames(DataMatrix) <- c("male", "female", "juvenile", "egg", "blastula")
png('ZscorePlot.png')
DataMap <- heatmap.2(DataMatrix, trace="none", dendrogram ='none', Rowv = FALSE, Colv = FALSE, col = colorRamps::matlab.like2, key=TRUE, keysize=1.0, xlab = "Stage in Development", ylab = "RNAifactor")
dev.off()
Is there something wrong? by the way, this is not my original data, just a sample to show you how it looks like. thanks.
Running R scripts from command line.
I tried to execute the commands one at a time on command line and upon reaching
it gave the error
Your R script has errors then. Please fix them before trying to execute the script from the command line.
You're missing a double quote.
Thats me typing on here. its all good in my R script. I corrected that on the post. In my script its all good. But error persists
Why is your R script binary? Have you tried
Rscripts myscripts.R
? Thecannot execute binary file
typically has something with incompatible architectures.I think it should be
Rscript file.R
, notRscripts
.gave this
sorry for late response, I am limited to ew posts
Of course. Now everybody knows I hardly run any R script. :D
to be honest I am not sure what you mean.
What does it return with the command
file HeatMap.R
?it returns this,
You ran
Eric asked you to run
file Heatmap.R
gave the following and didnt generate anything in folderI apologies for late response. I am limited to few post per certain hours.
The
file
utility tells you what kind of fileHeatmap.R
is, it does nothing else - that's expected. Think of it as a sanity check on the file. It is strange that you getdata
.You shouldn't execute an Rscript with bash.
Please follow up on all your previous posts:
If an answer was helpful you should upvote it, if the answer resolved your question you should mark it as accepted.
You need to run your file as:
You cannot run Rscripts with the
R
binary or with bash. Your shebang line should be taking care of this though.What do you get for
which -a Rscript
?