I am quite new to R and I have a problem which requires the use of a text file as data and to create the Normal Probability plot of the data in the text file. I am confused on how to reference to the text file in R and use it as a parameter in the function qqnorm()
If the text file (example.txt) is a table and you want to open it as a data frame, you can open the file with the command df<-read.table("example.txt") and thereafter continue to work in R. Your data is now in df.
Related
I want to create box plot using below excel sheet by importing to R. I want the output and R code as well
excel sheet
I didn't try anything
enter image description hereI imported my inputs from a "Table1.txt" file using read.table, then I worked on my table then I would like to save my outputs in a new text file "Table1Modifed.txt" using write.table and keep everything in the same format
I would like to check if the files "Table1.txt" and "TableModified.txt" are exactly in the same format(Number of digits,Uppercase Lower case...)
If you would like to compare contents of two files in R, you cause diffr() from the diffr package. This will point contents that are different. Is this what you are looking for?
I wanted to extract data from a package in R called Rdota2. However, when trying to use write.csv on my function, it displays
Error in as.data.frame.default(heroes) : cannot coerce class ""dota_api"" to a data.frame.
Is there any way I can convert the file directly using any other package?
The output of my function is displayed on my console. The only thing I am concerned is to save the data in CSV or as text.
The data frame is stored in an element of heroes...
write.csv(heroes$content, "heroes.csv")
I'm using Excel to call a script in R.
R eventually generates a graph, on the basis of which I want the user to be able to see and give an input.
Is there any way to get an input into R from Excel during runtime?
Thanks
So I found a solution.
I ran a shell script that called a vbs that invoked a different workbook that ran a vba code that called the original workbook I wanted to work with while R checked the contents of the new workbook until they were changed(which is when the input box was filled in the original workbook).
I'm new with R in QGIS, I could write a simple script, and I want to obtain the table resulting, the table which R uses to create the plot graphics.
How can I do that?
This is the script:
##Point pattern analysis=group
##Layer=vector
##Titulo=string
##showplots
library("maptools")
library("spatstat")
K <- Kest(as.ppp(Layer))
plot(K, main=Titulo)
Can anyone help me?
The QGIS processing module runs each R script in a separate R session. If you want to save anything created then you need to save it to a file in your script, for example:
save(K,file="K.RData")
Then in another R session you can do:
load("K.RData")
library(spatstat)
and now K is restored.
You might want to pass the save file name as another parameter to your processing script, or you may want to not do this further work in QGIS...
If you want to save this as a DBF file then there's a problem caused by the fact that K is a special kind of data frame - use write.dbf(as.data.frame(K),"/path/to/K.dbf") to convert it to a plain data frame for writing. This will lose some of the information such as labels and names of the various components but you can't store irregular data in a DBF.