Good Afternoon Everyone,
I have been using R Program, Bioconductor, and GEO Query to analyze some NCBI GEO Microarray Datasets for a few months now.
The current R Program Versions I have been using have been Version 3.4.1 and Version 3.4.4. The Bioconductor Version that has been available for use for this R Program versions on my personal computer and laboratory computer is Bioconductor 3.6.
I have been experiencing a problem with using the "getGEO" command function in the R Program. Whenever I load all of the required packages needed, update all of the sources according to the request of the R program, and then try to use getGEO to upload the microarray expression set (both GDS and GSE Series Matrix/SOFT Family Files), the R Program responds back saying that the "getGEO function" cannot be found.
This problem started yesterday evening and has never happened to me while using GEOQuery, Bioconductor, or R Program.
I have typed out my coding below:
source("http://www.bioconductor.org/biocLite.R")
biocLite()
biocLite("GEOquery")
library(GEOQuery)
getPackageIfNeeded <- function(pkg){if(!require(pkg,character.only = TRUE))biocLite(pkgs=pkg)}
sapply(pkgs,getPackageIfNeeded)
library(Biobase)
library(limma)
library(affy)
gset <- getGEO("GSE69033", GSEMatrix =TRUE)
gse <- getGEO("GSE69033", GSEMatrix =TRUE)
Questions:
Was there some kind of program update with R Program to where the getGEO function does not work anymore with Bioconductor or GEOQuery?
Is there something wrong with my scripting or coding? Is there something missing or is there something that is not supposed to be there?
Is there another way to upload NCBI GEO Microarray Datasets into R Program without the getGEO function?
Do any of you recommend any Gene Expression Analysis Techniques from MATLAB or Python? If so, could you mention a link to a coding script for either of those software programs?
Any help or direction in regards to my questions would be greatly appreciated. Thank you so much and I am very glad to be a part of this forum.
Related
I need to perform an analytic hierarchical process (AHP) on a dataset using R. I have basic understanding of navigation and can follow most guides to perform rudiment analyses. However, I'm not comfortable enough to be sure if I or the guide is wrong.
The guide I've followed is this: https://www.r-bloggers.com/analytic-hierarchy-process-ahp-with-the-ahp-package/.
(I run R version 3.3.2 (2016-10-31) -- "Sincere Pumpkin Patch")
1: I have (successfully) installed and loaded the AHP package using:
devtools::install_github("gluc/ahp", build_vignettes = install.packages("data.tree"))
2: I have (successfully) set working directory using:
setwd("myworkingdirectory")
3: I have attempted (PROBLEM) loaded the file to a variable using:
myahp <- LoadFile("myAHPfile.txt")
Error: could not find function "LoadFile"
3x: As diagnosis I run:
getAnywhere("LoadFile")
no object named ‘LoadFile’ was found
For your information: Step 3x is inspired by this SO answer (Error: could not find function ... in R)
Can someone tell me what I am doing wrong? I greatly appreciate any help.
Both. The guide refers to an old version of the gap package from github. With the latest version from cran (0.2.11), the function is now called Load, and the file format has changed.
If you just want to goof around with the package, I can recommend the online app at ipub.com.
If you insist on following the guide, make sure you get version 0.1.1 from github
I have to work with GAMS and R to extract data however I am a new R user and never have used GAMS before. I need to download a package called CSV_GDX_tools.exe and I have no idea what that is...
When I try to install it in R, I get this error message:
Warning in install.packages :
package ‘CSV_GDX_tools.exe’ is not available (for R version 3.3.2)
Can anyone please help me how and where I can download the package?
First, that does not sound like an R-package, but rather like an outdated utility program for GAMS.
I say outdated, because GAMS now has built-in the functionality to convert GDX (GAMS data files) to CSV files, which can be read by any statistics program including R.
GAMS also gives you the option of exporting your data to an SQLite database file (.db), which can be read by R.
Have a look here:
https://www.gams.com/help/index.jsp?topic=%2Fgams.doc%2Fuserguides%2Fmccarl%2Fgdx_utilities.htm
I usually use spss but needed to use a special stats package in R for the same dataset. I have found ways to read my spss data into r but I need to analyze this data with a statistical package.
The code I have to read the data is:
>RED.data<-read.spss("RED.sav", use.value.labels=TRUE, to.data.frame=TRUE)
The code for the stats package:
>library(twang)
>data(DTA)
>set.seed(1)
>mnps.RED<-mnps(treat~illact+crimjust+subprob, data=RED, estimand="ATT", verbose=FALSE, stop.method=c("es.mean", "ks.mean"), n.trees=3000)
I know I am missing a step between these but can't figure this out so far. I am confused about the formats of the data and their usage. What is the difference between the codes below and how can I use them?
>RED=read.csv("RED.csv")
>attach(RED)
>data(RED)
Thanks for your help!
Why not use the SPSS Statistics R integration apis for this? You would read the data into Statistics and then run R code like this.
begin program r.
dta = spssdata.GetDataFromSPSS()
mnps.RED<-mnps(treat~illact+crimjust+subprob, data=data, estimand...)
print(mnps.RED) # or whateverd else you need from the output.
end program.
You need to install the appropriate version of R and the free R Essentials for your version of Statistics to make this work. More details can be provided if you indicate what version of Statistics and what platform you are using.
Thanks for the help, JKP and Laterow. I'm using R 3.2.3 and SPSS 23.
Also, I made a mistake in the code in the original question. Here is the code again:
This is what I found for reading SPSS data into R :
require(foreign)
RED.data<-read.spss("RED.sav", use.value.labels=TRUE, to.data.frame=TRUE)
but I am not sure it is necessary to do this if I want to analyze the data with the "twang" package code below:
library(twang)
data(RED)
set.seed(1)
mnps.RED<-mnps(treat~illact+crimjust+subprob, data=RED, estimand="ATT", verbose=FALSE, stop.method=c("es.mean", "ks.mean"), n.trees=3000)
JKP, I'm a little confused about the code you provided. Do I need to enter this into SPSS syntax only?
Is there a way to read a Stata version 13 dataset file in R?
I have tried to do the following:
> library(foreign)
> data = read.dta("TEAdataSTATA.dta")
However, I got an error:
Error in read.dta("TEAdataSTATA.dta") :
not a Stata version 5-12 .dta file
Could someone point out if there is a way to fix this?
There is a new package to import Stata 13 files into a data.frame in R.
Install the package and read a Stata 13 dataset with read.dta13():
install.packages("readstata13")
library(readstata13)
dat <- read.dta13("TEAdataSTATA.dta")
Update: readstata13 imports in version 0.8 also files from Stata 6 to 14
More about the package: https://github.com/sjewo/readstata13
There's a new package called Haven, by Hadley Wickham, which can load Stata 13 dta files (as well as SAS and SPSS files)
library(haven) # haven package now available on cran
df <- read_dta('c:/somefile.dta')
See: https://github.com/hadley/haven
If you have Stata 13, then you can load it there and save it as a Stata 12 format using the command saveold (see help saveold). Afterwards, take it to R.
If you have, Stata 10 - 12, you can use the user-written command use13, (by Sergiy Radyakin) to load it and save it there; then to R. You can install use13 running ssc install use13.
Details can be found at http://radyakin.org/transfer/use13/use13.htm
Other alternatives, still with Stata, involve exporting the Stata format to something else that R will read, e.g. text-based files. See help export within Stata.
Update
Starting Stata 14, saveold has a version() option, allowing one to save in Stata .dta formats as old as Stata 11.
In the meanwhile savespss command became a member of the SSC archive and can be installed to Stata with: findit savespss
The homepage http://www.radyakin.org/transfer/savespss/savespss.htm continues to work, but the program should be installed from the SSC now, not from the beta location.
I am not familiar with the current state of R programs regarding their ability
to read other file formats, but if someone doesn't have Stata installed on their computer and R cannot read a specific version of Stata's dta files, Pandas in Python can now do the vast majority of such conversions.
Basically, the data from the dta file are first loaded using the pandas.read_stata function. As of version 0.23.0, the supported encoding and formats can be found in a related answer of mine.
Then one can either save the data as a csv file and import them
using standard R functions, or instead use the pandas.DataFrame.to_feather function, which exports the data using a serialization format built on Apache Arrow. The latter has extensive support in R as it was conceived to promote interoperability with Pandas.
I had the same problem. Tried read.dta13, read.dta but nothing worked. Then tried the easiest and least expected: MS Excel! It opened marvelously. I saved it as a .csv and used in R!!! Hope this helps!!!!
Is there a way to read a Stata version 13 dataset file in R?
I have tried to do the following:
> library(foreign)
> data = read.dta("TEAdataSTATA.dta")
However, I got an error:
Error in read.dta("TEAdataSTATA.dta") :
not a Stata version 5-12 .dta file
Could someone point out if there is a way to fix this?
There is a new package to import Stata 13 files into a data.frame in R.
Install the package and read a Stata 13 dataset with read.dta13():
install.packages("readstata13")
library(readstata13)
dat <- read.dta13("TEAdataSTATA.dta")
Update: readstata13 imports in version 0.8 also files from Stata 6 to 14
More about the package: https://github.com/sjewo/readstata13
There's a new package called Haven, by Hadley Wickham, which can load Stata 13 dta files (as well as SAS and SPSS files)
library(haven) # haven package now available on cran
df <- read_dta('c:/somefile.dta')
See: https://github.com/hadley/haven
If you have Stata 13, then you can load it there and save it as a Stata 12 format using the command saveold (see help saveold). Afterwards, take it to R.
If you have, Stata 10 - 12, you can use the user-written command use13, (by Sergiy Radyakin) to load it and save it there; then to R. You can install use13 running ssc install use13.
Details can be found at http://radyakin.org/transfer/use13/use13.htm
Other alternatives, still with Stata, involve exporting the Stata format to something else that R will read, e.g. text-based files. See help export within Stata.
Update
Starting Stata 14, saveold has a version() option, allowing one to save in Stata .dta formats as old as Stata 11.
In the meanwhile savespss command became a member of the SSC archive and can be installed to Stata with: findit savespss
The homepage http://www.radyakin.org/transfer/savespss/savespss.htm continues to work, but the program should be installed from the SSC now, not from the beta location.
I am not familiar with the current state of R programs regarding their ability
to read other file formats, but if someone doesn't have Stata installed on their computer and R cannot read a specific version of Stata's dta files, Pandas in Python can now do the vast majority of such conversions.
Basically, the data from the dta file are first loaded using the pandas.read_stata function. As of version 0.23.0, the supported encoding and formats can be found in a related answer of mine.
Then one can either save the data as a csv file and import them
using standard R functions, or instead use the pandas.DataFrame.to_feather function, which exports the data using a serialization format built on Apache Arrow. The latter has extensive support in R as it was conceived to promote interoperability with Pandas.
I had the same problem. Tried read.dta13, read.dta but nothing worked. Then tried the easiest and least expected: MS Excel! It opened marvelously. I saved it as a .csv and used in R!!! Hope this helps!!!!