Traduções desta página:

Ferramentas do usuário

Ferramentas do site


05_curso_antigo:r2011:alunos:trabalho_final:ac.mazzuco:start

Ana Carolina Mazzuco

(mais conhecida como: Nervo)

Doutorado em Oceanografia, Instituto Oceanográfico, USP.

Orientador: Áurea M. Ciotti.

Título da tese: “Variabilidade espaço-temporal da relação entre potencial reprodutivo e recrutamento ao longo da zona de influência da Ressurgência do Cabo Frio para dois grupos de invertebrados de costões rochosos” (REAL)

Proposta de Trabalho Final

Principal

Uma função que realize uma análise de variância de 4 vias, com fatores fixos e aleatórios, aninhados e ortogonais, que me possibilite que eu avalie o contraste do suprimento de larvas em função de diversos fatores avaliados.

(foi aconselhado que fosse deixada para uma outra hora pois era muito complexa)

Plano B

Uma função que me dê o número de horas que eu ainda precisaria surfar, se quisesse ao fim do ano, completar um total de 3 dias de surf (de 3 horas cada) por semana, ou seja, para ser uma pesquisadora mais feliz!!!

(foi aconselhado que fosse deixada para uma outra hora pois era muito simples)

Plano C

Uma função que: 1. crie um data.frame a partir 2 vetores: vetor 1, dados de direção de vento (a cada 2 horas); vetor 2, dados de velocidade de vento (a cada 2 horas).

2. crie um gráfico a parti deste data.frame: eixo x: tempo (horas) eixo y: intensidade do vento (m/s)

cada valor x será um vetor no gráfico (ou seja, uma seta) - mas cada vetor deve ter o comprimento relativo a sua velocidade, mas seu ângulo em relação ao eixo x deve ser de acordo com sua direção. (ex: um vetor de vento Norte, teria um ângulo de 90o, um vetor de vento Sul, teria um ângulo de 270o)

PLANO C - FINAL

Meus Exercícios

Exercício 1

Exercício 2

Exercício 3

Exercício 4

Exercício 5

Exercício 6

Exercício 7

Exercício 8

TRABALHO FINAL ===== MINHA FUNCAO

<code>

wind.plot <- function(direction,velocity,title)
	{
	wind = data.frame(direction,velocity)
	wind$x = c(seq(1:length(direction)))
	wind$y = c(rep(0,length(wind$x)))
	wind$angle = wind$direction
	wind[which(wind[,5]<=90),5]<- 90-wind[which(wind[,5]<=90),5]
	wind[which(wind[,5]>90&wind[,5]<=180),5]<-wind[which(wind[,5]>90&wind[,5]<=180),5]-90
	wind[which(wind[,5]>180&wind[,5]<=270),5]<- 90 - (wind[which(wind[,5]>180&wind[,5]<=270),5]-180)
	wind[which(wind[,5]>270&wind[,5]<=360),5]<- (wind[which(wind[,5]>270&wind[,5]<=360),5]-270)
	wind$direction.rad <- (wind$angle*pi)/180
	wind$x.2.<- (cos(wind$direction.rad))*wind$velocity
	wind$y.2.<- (sin(wind$direction.rad))*wind$velocity
	wind[which(wind[,1]>0&wind[,1]<=90),7]<- (wind[which(wind[,1]>0&wind[,1]<=90),7])+(wind[which(wind[,1]>0&wind[,1]<=90),3])
	wind[which(wind[,1]>90&wind[,1]<=180),7]<- (wind[which(wind[,1]>90&wind[,1]<=180),7])+(wind[which(wind[,1]>90&wind[,1]<=180),3])
	wind[which(wind[,1]>90&wind[,1]<=180),8]<- (wind[which(wind[,1]>90&wind[,1]<=180),8])*(-1)
	wind[which(wind[,1]>180&wind[,1]<=270),7]<- (wind[which(wind[,1]>180&wind[,1]<=270),3])-(wind[which(wind[,1]>180&wind[,1]<=270),7])
	wind[which(wind[,1]>180&wind[,1]<=270),8]<- (wind[which(wind[,1]>180&wind[,1]<=270),8])*(-1)
	wind[which(wind[,1]>270&wind[,1]<=360),7]<- (wind[which(wind[,1]>270&wind[,1]<=360),3])-(wind[which(wind[,1]>270&wind[,1]<=360),7])
	limite <- (max(wind$x.2.))+5
	limite.y <- ((max(wind$y.2.))+3)
	limite.neg <- ((max(wind$y.2.))+3)*(-1)
	plot(wind$y~wind$x,xlim=c(0,limite),ylim=c(limite.neg,limite.y),cex=0.5,xlab="Time",ylab="Velocity(m/s)",main=title)
	par(new=TRUE)
	plot(wind$y.2.~wind$x.2.,xlim=c(0,limite),ylim=c(limite.neg,limite.y),cex=0.5,axes = TRUE,ann = FALSE)
	par(new=TRUE)
	arrows(wind$x,wind$y,wind$x.2.,wind$y.2., col="black")
	return(wind)
	}

<code>

HELP PAGE (function="wind.plot")

modelo package:unknown R Documentation

   ~~function to do build a Wind stickplot ("wind.plot")~~

Description:

   ~~ This function builds a stickplot of arrows to represents wind direction and velocity. Each arrow has the size equivalent to its velocity and the slope respective to tis direction of origin (e.g. 0o North, 90o East, 180o South, 270o West). The tip of the arroz always points to the origin of the wind respective to the cardinal points and the standard. It also builds a data.frame of the data required to build the stickplot and the function calculares the coordinates used to build the arrows inside the plot. ~~

Usage:

   ~~ wind.function(direction,velocity,title) ~~

Arguments:

 ~~direction~~ (it must be a vector of wind direction data(measurements) using degredes as unit)
 ~~velocity~~ (it must be a vector of wind velocity data(measurements) using m/s as uni)

~~title~~ (title of plot, it must come between “”)

Details:

   ~~ If necessary, more details than the description above ~~

Value:

   ~~ wind.function returns a plot and a data.frame
plot : stick plot describing the variable (wind) and the characteristics (direction and velocity)
data.frame : describe the steps and values used to build the plot

Warning:

   ~~ Be careful about the units used (degrees and m/s) and the number of elements of each vector, they must be the same

Note:

   ~~This function does not allow you to chance the graphical formar~~ 

Author(s):

   ~~Ana Carolina de Azevedo Mazzuco. PhD student of Instituto Oceanográfico, Universidade de São Paulo~~

References:

   ~ www.r-project.org ~

See Also:

   ~~plot,arrows,data.frame,function,par~~~

Examples: (test wind.plot using the following example and data)

~~Sample Data - test

~~teste1 ← c(1:360)

~~teste2 ← c(rep(8,360))

~~wind.plot(teste1,teste2,“TESTE”)

~~Real Data - test (wind direction and velocity at Arraial do Cabo, Brazil, April 11th 2011)

~~direction ← c(69,64,60,67,70,75,71,68,63,56,60,60,63,61,56,56,72,81,85,73,75,70,75,71)

~~velocity ← c(7.9,5.9,6.1,4.1,3.8,5.6,5.1,4.6,4.9,6.3,6.0,5.9,6.8,6.2,5.5,5.9,5.5,5.3,4.9,6.3,6.0,7.3,6.0,6.5)

~~wind.plot(direction,velocity,“Wind at Arraial do Cabo - April 11th 2011”)

05_curso_antigo/r2011/alunos/trabalho_final/ac.mazzuco/start.txt · Última modificação: 2020/08/12 06:04 (edição externa)