[R] Interpolation between 2 vectors

Dani Valverde daniel.valverde at uab.cat
Wed Feb 20 09:05:08 CET 2008


Hello,
I tried the approx() and it worked. Now, I have a list named "interpol" 
resulting from the interpolation. I would like to append the values in 
interpol$y in the position specified by interpol$x in a existing vector 
"spect1". I tried with append() and the following code:

spect1 <- c(1:10909)
for(i in 1:length(interpol$x)){
append(spect1,interpol$y[i],interpol$x[i])
}

but it didn't work. Any idea?
Best,

Dani

Daniel Valverde Saubí

Grup de Biologia Molecular de Llevats
Facultat de Veterinària de la Universitat Autònoma de Barcelona
Edifici V, Campus UAB
08193 Cerdanyola del Vallès- SPAIN

Centro de Investigación Biomédica en Red
en Bioingeniería, Biomateriales y
Nanomedicina (CIBER-BBN)

Grup d'Aplicacions Biomèdiques de la RMN
Facultat de Biociències
Universitat Autònoma de Barcelona
Edifici Cs, Campus UAB
08193 Cerdanyola del Vallès- SPAIN
+34 93 5814126



En/na jim holtman ha escrit:
> check out the 'approx' function.
>
> On Feb 19, 2008 12:44 PM, Dani Valverde <daniel.valverde at uab.cat> wrote:
>   
>> Hello,
>> I have two vectors, one with 13112 points and the other one with 10909.
>> I wonder if there is a way to interpolate the data so the shorter
>> vectors has the same number of points as the longer one.
>> Best,
>> Dani
>>
>> --
>> Daniel Valverde Saubí
>>
>> Grup de Biologia Molecular de Llevats
>> Facultat de Veterinària de la Universitat Autònoma de Barcelona
>> Edifici V, Campus UAB
>> 08193 Cerdanyola del Vallès- SPAIN
>>
>> Centro de Investigación Biomédica en Red
>> en Bioingeniería, Biomateriales y
>> Nanomedicina (CIBER-BBN)
>>
>> Grup d'Aplicacions Biomèdiques de la RMN
>> Facultat de Biociències
>> Universitat Autònoma de Barcelona
>> Edifici Cs, Campus UAB
>> 08193 Cerdanyola del Vallès- SPAIN
>> +34 93 5814126
>>
>> ______________________________________________
>> R-help at r-project.org mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-help
>> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
>> and provide commented, minimal, self-contained, reproducible code.
>>
>>     
>
>
>
>



More information about the R-help mailing list