Soluzione esercizi su Array - 1 - PowerPoint PPT Presentation

About This Presentation
Title:

Soluzione esercizi su Array - 1

Description:

Title: Soluzione esercizi sui Vettori Author: Giorgio Valentini Last modified by: Giorgio Created Date: 11/1/2004 9:00:17 AM Document presentation format – PowerPoint PPT presentation

Number of Views:16
Avg rating:3.0/5.0
Slides: 5
Provided by: Giorg92
Category:

less

Transcript and Presenter's Notes

Title: Soluzione esercizi su Array - 1


1
Soluzione esercizi su Array - 1
  • Array -------------------------
  • Es.1
  • gt m lt- matrix (runif(100), nrow10)
  • gt m lt- matrix (runif(100), ncol10)
  • gt m lt- array(runif(100), c(10,10))
  • Es.2
  • gt x lt- matrix (rep(c("T","A","C"),c(4,5,3)),
    nrow3)
  • gt y lt- matrix (rep(c("A","G","C"),c(4,9,2)),
    nrow5)
  • gt x,12 lt- t(y),45
  • Es.3
  • gt a lt-array(160, c(3,4,5))
  • gt b lt-array(round(runif(60)9), c(3,4,5))
  • gt c lt- ab
  • gt v lt-160
  • gt x lt- av si ottiene un array
  • gt is.array(x)
  • 1 TRUE
  • gt dim(a) lt- c(3,5,2,2)
  • gt attributes(a)

2
Soluzione esercizi su Array -2
  • Array -------------------------
  • Es.4
  • gt M lt- matrix(120,ncol5)
  • gt N lt- matrix(115,ncol5)
  • gt MN lt- rbind(M,N)
  • gt MN2 lt- cbind(M,N)
  • Error in cbind(...) number of rows of matrices
    must match (see arg 2)
  • Es.5
  • gt A lt- matrix(runif(9),nrow3)
  • gt B lt- matrix(runif(9),nrow3)
  • gt Pel lt- AB
  • gt P lt- AB
  • gt b lt- runif(3)
  • gt x lt- solve(A,b)

3
Soluzione esercizi sulle Liste -1
  • Es.1
  • lilt-list(matrix(116,nrow4),rep(NO",times32),"
    topo",list(110,TRUE))
  • Es.2
  • gt lim,2 opp. li1,2
  • gt lislis"G"
  • gt li3 lt- list(runif(10))
  • Es.3
  • gt li2 lt- list(15, matrix(14,nrow2),vc(TRUE,FAL
    SE))
  • gt li3 lt- list(factor(rep(c("Q","T"),times3)),
    matrix(14,nrow2), vc(TRUE,FALSE))
  • gt vect lt- c(li,li2,li3)
  • gt is.vector(vect)
  • 1 TRUE
  • gt is.list(vect)
  • 1 TRUE
  • Es.4
  • gt li2
  • 1 "T" "T" "T" "G" "G" "G" "G" "G"
  • gt lis
  • 1 "T" "T" "T" "G" "G" "G" "G" "G"

4
Soluzione esercizi sulle Liste - 2
  • Es.5
  • gt diag(li1)
  • 1 -0.7145504 1.2088036 0.5635183 0.5549922
    -0.5632107 -1.9878782 0.8712786 -0.3021831
  • gt diag(li1)
  • Error in as.integer.default(x) (list) object
    cannot be coerced to integer
Write a Comment
User Comments (0)
About PowerShow.com