Giter Site home page Giter Site logo

thealgorithms / r Goto Github PK

View Code? Open in Web Editor NEW
776.0 66.0 280.0 1.04 MB

Collection of various algorithms implemented in R.

License: MIT License

R 100.00%
algorithms r education machine-learning practice learning preprocessing regression data-mining clustering

r's Introduction

The Algorithms - R

Gitpod Ready-to-Code

build license prs

R is a programming language and free software environment for statistical computing and graphics supported by the R Foundation for Statistical Computing. The R language is widely used among statisticians and data miners for developing statistical software and data analysis. Polls, data mining surveys and studies of scholarly literature databases show substantial increases in popularity in recent years. As of November 2019, R ranks 16th in the TIOBE index, a measure of popularity of programming languages. (Wikipedia)

All algorithms can be found in the DIRECTORY.md file ordered by folder.

Contribution Guidelines

Please ensure to follow the points stated below if you would like to contribute:

  • If your proposing a new algorithm or making changes to an existing one, make sure your code works. Reviewers or the general user must be able to directly emplace it in an R environment and get the desired output.
  • Add an example to showcase the use of an algorithm proposed. It can be commented.
  • Follow proper naming convention for variables (use . or _ to seperate terms, such as results.df for a data frame containing some results) and filenames (follow the convention that has been followed for files under the directory your committing to).
  • Feel free to add links here to the newly added file(s), but ensure that they do not result in a merge conflict with different versions of this readme under previous pull requests.

r's People

Contributors

aakashkotha avatar akshat111111 avatar alexgarland avatar andyc1997 avatar anirban166 avatar aybarsnazlica avatar bszmolke avatar da505819 avatar dynamitechetan avatar eshom avatar eurus-holmes avatar i-vishi avatar imeet07 avatar khandelwal05 avatar kkulma avatar manimbe avatar mertcandav avatar msaf9 avatar nikhil-wani avatar panquesito7 avatar paras-2407 avatar rafaeldev2016 avatar rohitkbc avatar ronlee12355 avatar saurav-iiitu avatar shikokuchuo avatar siriak avatar snishal avatar stepfenshawn avatar tlentali avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

r's Issues

Missing dependencies in .R files?

Hello,

I am having problems running some of the algorithms because they seem to expect me to have certain variables or methods loaded that I do not have.

For example, for DecisionTree.R:

library(rpart)
x <- cbind(x_train,y_train)
# grow tree 
fit <- rpart(y_train ~ ., data = x,method="class")
summary(fit)
# Predict Output 
predicted= predict(fit,x_test)

When I attempt to run this script in RStudio, I get the following errors:

Error in cbind(x_train, y_train) : object 'x_train' not found
> # grow tree 
> fit <- rpart(y_train ~ ., data = x,method="class")
Error in is.data.frame(data) : object 'x' not found
> summary(fit)
Error in object[[i]] : object of type 'closure' is not subsettable
> # Predict Output 
> predicted= predict(fit,x_test)
Error in UseMethod("predict") : 
  no applicable method for 'predict' applied to an object of class "function"
> predicted= predict(fit,x_test)
Error in UseMethod("predict") : 
  no applicable method for 'predict' applied to an object of class "function"

Are there other R files or packages that the user is expected to have installed, aside from the packages already included?

I am using a fresh RStudio install (version 1.1.463) on Ubuntu 16.04 with R version 3.2.3.

Where are the sample datasets?

I want to run the code in Rstudio, but all the data are not found.
Anyone can tell me where to download the datasets?

Thank you

Duplicate files in documentation directory, only differing in case

When cloning the repo to my Windows machine, I received the following warning message:

Cloning into 'Algorithms-in-R'...
remote: Enumerating objects: 984, done.
remote: Counting objects: 100% (984/984), done.
remote: Compressing objects: 100% (424/424), done.
remote: Total 984 (delta 532), reused 984 (delta 532), pack-reused 0
Receiving objects: 100% (984/984), 927.20 KiB | 27.27 MiB/s, done.
Resolving deltas: 100% (532/532), done.
warning: the following paths have collided (e.g. case-sensitive paths
on a case-insensitive filesystem) and only one from the same
colliding group is in the working tree:

  'documentation/ANN.md'
  'documentation/ann.md'
  'documentation/K_Folds.md'
  'documentation/k_folds.md'
  'documentation/kmeans_raw_R.md'
  'documentation/kmeans_raw_r.md'
  'documentation/KNN.md'
  'documentation/knn.md'
  'documentation/linearRegressionRawR.md'
  'documentation/linearregressionrawr.md'
  'documentation/SVM.md'
  'documentation/svm.md'

Peter@bolide MINGW64 /c/repos/Learn/Algorithms
$

So it seems to me these files are duplicated and only differing in case. However from each pair, one of them has a newer commit. So you might want to check these changes to see whether they have been applied to the right files, or correct the case of the most recent file and delete the older other one.

These changes are mostly from #88 it seems.

Multiple sequence alignment using R

myAlignment<- msaClustalW("mydata", type = "dna")
use default substitution matrix
Error in convertAlnRows(result$msa, type) : There is an invalid aln file!

I'm facing issue using the above code. I want to perform multiple sequence alignment on csv or fasta file. but getting this error. please help me to solve it.

Add Gitpod Setup

Description

Setup Gitpod environment for running the repository in Gitpod.

Add Gitpod ready to code Badge to the README.md file.

Other repos like Python and Java in TheAlgorithms use gitpod.

Screenshots

image
image

I have worked on silimar issue TheAlgorithms/PHP#130

I would like to work on this issue

Create searching algorithm in R

We can create a folder for searching algorithm in R language, and add certain searching algorithms such as linear search and binary search.

Reproducible code

I think as a standard all scripts should be completely independent and reproducible. I.e. people should be able to copy and paste code in their R REPL session without errors. This is currently not the case with many scripts in this repo. Instead of supplying example data, many algorithms are written as "templates" where one has to input their own data. However, there's no information what the data structure should even be.

R has many built in datasets, so these can be used to run algorithms with. If the script is just a function definition, then there should be an example usage of the function.

I could list here all scripts that need to be written this way.

What do you think?

Add more algorithms

Everyone is welcome to add more algorithms to this project. This repo is new so we need contributions from all.

MSA problem in R Studio

Hi! I'm working for my midterms and I need answers ASAP

I downloaded sequences from NCBI (Complete Record > Fasta) and I installed necessary packages. By the time I reached using msa, the error appears. I don't know what to do anymore. Help! This is the codes by the way.

AlignNeeded = TRUE # The program reads fasta file and aligns it
if (AlignNeeded) {

file <- readDNAStringSet(fname)#for reading multiple DNA sequences from msa package
file
}

cb<- msa(file) # multiple sequence alignment from msa package
cb # aligned the 120 sequences in the file

use default substitution matrix
Error in convertAlnRows(result$msa, type) : There is an invalid aln file!

AFTER READING A SOLUTION HERE, I TRIED IT OUT, HERE'S THE PROBLEM

cb<- msa(file) # multiple sequence alignment from msa package
use default substitution matrix
Error in convertAlnRows(result$msa, type) : There is an invalid aln file!
library(Biostrings)
file_path <- "sequence-5.fasta"
cb <- msa(file_path, filetype = "sequence-5.fasta", type = "DNA")
Error in msaFun(inputSeqs = inputSeqs, cluster = cluster, gapOpening = gapOpening, :
The following parameters are not known
(or have been specifiedmore often than once):
filetype

PLEASE HELP ME

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.