Giter Site home page Giter Site logo

project's People

Contributors

nicosegoviac avatar

Watchers

 avatar

project's Issues

Counting data in R

Counting data in R

Count occurrences in a column.

##read csv (or txt)
data<-read.csv("qDOD_Cgigas_GOslim_DISTINCT.csv",sep=",")
data

Make sure that the data are read.

Count lines and see the name of each column.

nrow(data)
names(data)
> nrow(data)
[1] 5734
> names(data)
[1] "CGI_ID"     "GOslim_bin" "aspect" 

Use plyr library (is in the basic package of R)
Or you can install it with:

install.packages("plyr")
library(plyr)

Use the function "count" in the plyr library. To count in all dataset, set from 1 to X. Where x is number of lines in your data set and the name of the column in "vars".

count(data[1:5734,],vars="GOslim_bin")
                         GOslim_bin freq
1                    DNA metabolism   84
2                    RNA metabolism  485
3                     cell adhesion  128
4      cell cycle and proliferation  229
5  cell organization and biogenesis  454
6               cell-cell signaling   63
7                             death  238
8           developmental processes  487
9        other biological processes  919
10        other metabolic processes  779
11               protein metabolism  583
12              signal transduction  473
13                  stress response  294
14                        transport  518

You can make an object with that for graphics:

CountCGigas<-count(data[1:5734,],vars="GOslim_bin")

CountCGigas

attach(CountCGigas)

Counting data in R

Counting data in R

Count occurrences in a column.

Red the file. Make sure that the working directory is propiely set it.

##read csv (or txt)
data<-read.csv("qDOD_Cgigas_GOslim_DISTINCT.csv",sep=",")
data

Make sure that the data are properly readed.

Count lines and see the name of each column.

nrow(data)
names(data)

Use plyr library (is in the basic package of R)
Or you can install it with:

install.packages("plyr")
library(plyr)

Use the function "count" in the plyr library. To count in all dataset, set from 1 to X. Where x is number of lines in your data set and the name of the column in "vars".

count(data[1:5734,],vars="GOslim_bin")
                         GOslim_bin freq
1                    DNA metabolism   84
2                    RNA metabolism  485
3                     cell adhesion  128
4      cell cycle and proliferation  229
5  cell organization and biogenesis  454
6               cell-cell signaling   63
7                             death  238
8           developmental processes  487
9        other biological processes  919
10        other metabolic processes  779
11               protein metabolism  583
12              signal transduction  473
13                  stress response  294
14                        transport  518

You can make an object with that for graphics:

CountCGigas<-count(data[1:5734,],vars="GOslim_bin")

CountCGigas

attach(CountCGigas)

![image](/Users/nicosegovia/Desktop/Project/output/Rplot count.pdf/)

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.