enqto o henrique nao responde, algo como o seguinte pode lhe servir:<div><br></div><div>hi = mapply(seq, 0.1, dados[['ht']], .5)</div><div>idx = mapply(rep, 1:length(hi), sapply(hi, length))</div><div>dados2 = cbind(dados[unlist(idx),], hi=unlist(hi))</div>

<div><br></div><div>b<br><br><div class="gmail_quote">2011/5/31 Samuel Carvalho <span dir="ltr"><<a href="mailto:samukajm@yahoo.com.br">samukajm@yahoo.com.br</a>></span><br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">

<div><div style="color:#000;background-color:#fff;font-family:times new roman, new york, times, serif;font-size:12pt"><div><span>Boa noite caros(a) senhores(as) membros</span></div><div><span>Por gentileza alguém poderia me auxliar em um código que a princípio parece ser simples mas nao consegui uma solução</span></div>

<div><span>Abaixo mostro o codigo e a seguir venho comentando</span></div><div><span>### Codigo R</span></div><div><span>dados<-data.frame(idfuste=seq(1,5), dap=c(8.5, 11.0, 10.5, 17.5, 12.5),<br>ht=c(10, 13, 12.5, 18, 14))<br>

dados<br>dados$hi<-seq(0.1, dados$ht, by=0.5)</span></div><div><span>### <br></span></div><div><span>O que preciso é gerar uma sequencia para cada "idfuste" de 0.1 até a "ht" que corresponde aquele "idfuste", replicando também cada observação</span></div>

<div><span>para cada "idfuste". A sequencia é de 0.5 em 0.5 até a altura total da árvore - 1 pois esta pode nao ser um número inteiro
 dividido por 0.5 sendo que a ultima observação de cada idfuste deve ser igual ao valor de ht<br></span></div><div><span>Em resumo queria um data.frame de saída a partir dos dados de entrada, nesta estrutura</span></div>

<div><br><span></span></div><div>
 </div><table width="256" border="0" cellpadding="0" cellspacing="0"><colgroup><col style="width:48pt" width="64" span="4">
 </colgroup><tbody><tr style="min-height:15pt" height="20">
  <td style="min-height:15pt;width:48pt" width="64" height="20">idfuste</td>
  <td style="width:48pt" width="64">dap</td>
  <td style="width:48pt" width="64">ht</td>
  <td style="width:48pt" width="64">hi</td>
 </tr>
 <tr style="min-height:15pt" height="20">
  <td style="min-height:15pt" height="20">1</td>
  <td>8,5</td>
  <td>10</td>
  <td>0</td>
 </tr>
 <tr style="min-height:15pt" height="20">
  <td style="min-height:15pt" height="20">1</td>
  <td>8,5</td>
  <td>10</td>
  <td>0,5</td>
 </tr>
 <tr style="min-height:15pt" height="20">
  <td style="min-height:15pt" height="20">1</td>
  <td>8,5</td>
  <td>10</td>
  <td>1</td>
 </tr>
 <tr style="min-height:15pt" height="20">
  <td style="min-height:15pt" height="20">1</td>
  <td>8,5</td>
  <td>10</td>
  <td>1,5</td>
 </tr>
 <tr style="min-height:15pt" height="20">
  <td style="min-height:15pt" height="20">1</td>
  <td>8,5</td>
  <td>10</td>
  <td>2</td>
 </tr>
 <tr style="min-height:15pt" height="20">
  <td style="min-height:15pt" height="20">1</td>
  <td>8,5</td>
  <td>10</td>
  <td>2,5</td>
 </tr>
 <tr style="min-height:15pt" height="20">
  <td style="min-height:15pt" height="20">1</td>
  <td>8,5</td>
  <td>10</td>
  <td>3</td>
 </tr>
 <tr style="min-height:15pt" height="20">
  <td style="min-height:15pt" height="20">1</td>
  <td>8,5</td>
  <td>10</td>
  <td>3,5</td>
 </tr>
 <tr style="min-height:15pt" height="20">
  <td style="min-height:15pt" height="20">1</td>
  <td>8,5</td>
  <td>10</td>
  <td>4</td>
 </tr>
 <tr style="min-height:15pt" height="20">
  <td style="min-height:15pt" height="20">1</td>
  <td>8,5</td>
  <td>10</td>
  <td>4,5</td>
 </tr>
 <tr style="min-height:15pt" height="20">
  <td style="min-height:15pt" height="20">1</td>
  <td>8,5</td>
  <td>10</td>
  <td>5</td>
 </tr>
 <tr style="min-height:15pt" height="20">
  <td style="min-height:15pt" height="20">1</td>
  <td>8,5</td>
  <td>10</td>
  <td>5,5</td>
 </tr>
 <tr style="min-height:15pt" height="20">
  <td style="min-height:15pt" height="20">1</td>
  <td>8,5</td>
  <td>10</td>
  <td>6</td>
 </tr>
 <tr style="min-height:15pt" height="20">
  <td style="min-height:15pt" height="20">1</td>
  <td>8,5</td>
  <td>10</td>
  <td>6,5</td>
 </tr>
 <tr style="min-height:15pt" height="20">
  <td style="min-height:15pt" height="20">1</td>
  <td>8,5</td>
  <td>10</td>
  <td>7</td>
 </tr>
 <tr style="min-height:15pt" height="20">
  <td style="min-height:15pt" height="20">1</td>
  <td>8,5</td>
  <td>10</td>
  <td>7,5</td>
 </tr>
 <tr style="min-height:15pt" height="20">
  <td style="min-height:15pt" height="20">1</td>
  <td>8,5</td>
  <td>10</td>
  <td>8</td>
 </tr>
 <tr style="min-height:15pt" height="20">
  <td style="min-height:15pt" height="20">1</td>
  <td>8,5</td>
  <td>10</td>
  <td>8,5</td>
 </tr>
 <tr style="min-height:15pt" height="20">
  <td style="min-height:15pt" height="20">1</td>
  <td>8,5</td>
  <td>10</td>
  <td>9</td>
 </tr>
 <tr style="min-height:15pt" height="20">
  <td style="min-height:15pt" height="20">1</td>
  <td>8,5</td>
  <td>10</td>
  <td>9,5</td>
 </tr>
 <tr style="min-height:15pt" height="20">
  <td style="min-height:15pt" height="20">1</td>
  <td>8,5</td>
  <td>10</td>
  <td>10</td>
 </tr>
 <tr style="min-height:15pt" height="20">
  <td style="min-height:15pt" height="20">2</td>
  <td>11</td>
  <td>13,2</td>
  <td>0</td>
 </tr>
 <tr style="min-height:15pt" height="20">
  <td style="min-height:15pt" height="20">2</td>
  <td>11</td>
  <td>13,2</td>
  <td>0,5</td>
 </tr>
 <tr style="min-height:15pt" height="20">
  <td style="min-height:15pt" height="20">2</td>
  <td>11</td>
  <td>13,2</td>
  <td>1</td>
 </tr>
 <tr style="min-height:15pt" height="20">
  <td style="min-height:15pt" height="20">2</td>
  <td>11</td>
  <td>13,2</td>
  <td>1,5</td>
 </tr>
 <tr style="min-height:15pt" height="20">
  <td style="min-height:15pt" height="20">2</td>
  <td>11</td>
  <td>13,2</td>
  <td>2</td>
 </tr>
 <tr style="min-height:15pt" height="20">
  <td style="min-height:15pt" height="20">2</td>
  <td>11</td>
  <td>13,2</td>
  <td>2,5</td>
 </tr>
 <tr style="min-height:15pt" height="20">
  <td style="min-height:15pt" height="20">2</td>
  <td>11</td>
  <td>13,2</td>
  <td>3</td>
 </tr>
 <tr style="min-height:15pt" height="20">
  <td style="min-height:15pt" height="20">2</td>
  <td>11</td>
  <td>13,2</td>
  <td>3,5</td>
 </tr>
 <tr style="min-height:15pt" height="20">
  <td style="min-height:15pt" height="20">2</td>
  <td>11</td>
  <td>13,2</td>
  <td>4</td>
 </tr>
 <tr style="min-height:15pt" height="20">
  <td style="min-height:15pt" height="20">2</td>
  <td>11</td>
  <td>13,2</td>
  <td>4,5</td>
 </tr>
 <tr style="min-height:15pt" height="20">
  <td style="min-height:15pt" height="20">2</td>
  <td>11</td>
  <td>13,2</td>
  <td>5</td>
 </tr>
 <tr style="min-height:15pt" height="20">
  <td style="min-height:15pt" height="20">2</td>
  <td>11</td>
  <td>13,2</td>
  <td>5,5</td>
 </tr>
 <tr style="min-height:15pt" height="20">
  <td style="min-height:15pt" height="20">2</td>
  <td>11</td>
  <td>13,2</td>
  <td>6</td>
 </tr>
 <tr style="min-height:15pt" height="20">
  <td style="min-height:15pt" height="20">2</td>
  <td>11</td>
  <td>13,2</td>
  <td>6,5</td>
 </tr>
 <tr style="min-height:15pt" height="20">
  <td style="min-height:15pt" height="20">2</td>
  <td>11</td>
  <td>13,2</td>
  <td>7</td>
 </tr>
 <tr style="min-height:15pt" height="20">
  <td style="min-height:15pt" height="20">2</td>
  <td>11</td>
  <td>13,2</td>
  <td>7,5</td>
 </tr>
 <tr style="min-height:15pt" height="20">
  <td style="min-height:15pt" height="20">2</td>
  <td>11</td>
  <td>13,2</td>
  <td>8</td>
 </tr>
 <tr style="min-height:15pt" height="20">
  <td style="min-height:15pt" height="20">2</td>
  <td>11</td>
  <td>13,2</td>
  <td>8,5</td>
 </tr>
 <tr style="min-height:15pt" height="20">
  <td style="min-height:15pt" height="20">2</td>
  <td>11</td>
  <td>13,2</td>
  <td>9</td>
 </tr>
 <tr style="min-height:15pt" height="20">
  <td style="min-height:15pt" height="20">2</td>
  <td>11</td>
  <td>13,2</td>
  <td>9,5</td>
 </tr>
 <tr style="min-height:15pt" height="20">
  <td style="min-height:15pt" height="20">2</td>
  <td>11</td>
  <td>13,2</td>
  <td>10</td>
 </tr>
 <tr style="min-height:15pt" height="20">
  <td style="min-height:15pt" height="20">2</td>
  <td>11</td>
  <td>13,2</td>
  <td>10,5</td>
 </tr>
 <tr style="min-height:15pt" height="20">
  <td style="min-height:15pt" height="20">2</td>
  <td>11</td>
  <td>13,2</td>
  <td>11</td>
 </tr>
 <tr style="min-height:15pt" height="20">
  <td style="min-height:15pt" height="20">2</td>
  <td>11</td>
  <td>13,2</td>
  <td>11,5</td>
 </tr>
 <tr style="min-height:15pt" height="20">
  <td style="min-height:15pt" height="20">2</td>
  <td>11</td>
  <td>13,2</td>
  <td>12</td>
 </tr>
 <tr style="min-height:15pt" height="20">
  <td style="min-height:15pt" height="20">2</td>
  <td>11</td>
  <td>13,2</td>
  <td>12,5</td>
 </tr>
 <tr style="min-height:15pt" height="20">
  <td style="min-height:15pt" height="20">2</td>
  <td>11</td>
  <td>13,2</td>
  <td>13</td>
 </tr>
 <tr style="min-height:15pt" height="20">
  <td style="min-height:15pt" height="20">2</td>
  <td>11</td>
  <td>13,2</td>
  <td>13,2</td>
 </tr>
</tbody></table><div><br>e assim por diante para todos idfustes<br>Desde já agradeço<br>Para quem é da area florestal estou tentando estruturar uma base de cubagem a partir de dados de parcelas<br>Abraço e boa noite a todos<br>

Att,<br>Samuel<br> <span></span></div><div style="font-family:courier,monaco,monospace,sans-serif"><font size="3"><b>====================================</b></font></div><div style="font-family:courier,monaco,monospace,sans-serif">

<font size="3"><b>Samuel P. C. Carvalho<br></b><font color="#000000" size="2">Mestre em Ciências Florestais [UFLA]</font></font></div><div style="font-family:courier,monaco,monospace,sans-serif"><font color="#000000" size="2">Doutorando em Recursos Florestais [ESALQ/USP]</font></div>

<div style="font-family:courier,monaco,monospace,sans-serif"><font size="2">=============================================</font></div></div></div><br>_______________________________________________<br>
R-br mailing list<br>
<a href="mailto:R-br@listas.c3sl.ufpr.br">R-br@listas.c3sl.ufpr.br</a><br>
<a href="https://listas.inf.ufpr.br/cgi-bin/mailman/listinfo/r-br" target="_blank">https://listas.inf.ufpr.br/cgi-bin/mailman/listinfo/r-br</a><br>
<br></blockquote></div><br><br clear="all"><br>-- <br>Successful people ask better questions, and as a result, they get better answers. (Tony Robbins)<br>
</div>