[R] Is there anyone in charge of package wmtsa ?
Here is another occurrence of wmTSA internal error. My time series is a short breathing cycle (2425-Cyle_9.txt). Since wmtsa functions that extract extrema seem to expect longer series than I have, I tried the folowing two tricks: 1) I prolong the 1-cycle series on both ends through duplicating the first value (on the left end( and the last value on the right end as any ties as the 1-cycle series length. Then I apply CWT to such prolonged series and then obtain the maxima trees and the peaks as follows: aal <- rep (aa[1], length(aa)) aar <- rep (aa[length(aa)], length(aa)) aa3 <- c(aal,aa,aar) aa3ts <- create.signalSeries(aa3, pos=list(from=0.0, by=0.033))#CONVERT AMPLITUDE INTO TIME-SERIES aa3.cwt <- wavCWT(aa3ts) #CWT aa3.maxtree <- wavCWTTree (aa3.cwt, type="maxima") # GENERATE CWT MAXIMA TREE aa3.maxpeak <- wavCWTPeaks (aa3.maxtree)#GET MAXIMUM PEAKS Notice that in this case the generated tree (Bad-Tree-Configuration) has only 4 branches. I believe this may cause the error I get when I try to get the maxime: > aa3.maxpeak <- wavCWTPeaks (aa3.maxtree) Error in `row.names<-.data.frame`(`*tmp*`, value = c("1", "0")) : invalid 'row.names' length 2) I prolong the 1-cycle series on both ends through replicating the series 3 times. Then I apply CWT to such prolonged series and then obtain the maxima trees and the peaks as follows: aa3 <- c(aa,aa,aa) aa3ts <- create.signalSeries(aa3, pos=list(from=0.0, by=0.033))#CONVERT AMPLITUDE INTO TIME-SERIES aa3.cwt <- wavCWT(aa3ts) #CWT aa3.maxtree <- wavCWTTree (aa3.cwt, type="maxima") # GENERATE CWT MAXIMA TREE aa3.maxpeak <- wavCWTPeaks (aa3.maxtree)#GET MAXIMUM PEAKS Notice that in this case the generated tree (Good-Tree-Configuration) has 6 branches. This way the peaks are regularly found. No error is printed out: > aa3.maxpeak <- wavCWTPeaks (aa3.maxtree) Any comment on the above weird behavour is welcome. Thank you so much. Maura Alice Messenger ;-) chatti anche con gli amici di Windows Live Messenger e tutti i telefonini TIM! Vai su http://maileservizi.alice.it/alice_messenger/index.html?pmk=footer c(-1.7693803934301, -1.79611069128061, -1.81517746069223, -1.82670965566891, -1.83087810080908, -1.82789267608574, -1.81799919307179, -1.8014759899165, -1.77863029149271, -1.74979438113458, -1.715321646769, -1.67558250144069, -1.63096029291499, -1.58184719143613, -1.52864015940256, -1.47173698930672, -1.41153251097017, -1.34841498718826, -1.28276272782059, -1.21494099059151, -1.14529915767847, -1.07416827546639, -1.00185892470139, -0.92865947565509, -0.854834731030223, -0.780624983913237, -0.706245458006967, -0.631886160179746, -0.55771213713919, -0.483864111655527, -0.410459476489888, -0.337593651488704, -0.26534174650219, -0.193760513197372, -0.122890565559422, -0.052758793491, 0.016619034092944, 0.0852355374082596, 0.153088911047142, 0.220180064836256, 0.2865097718006, 0.352075869053914, 0.416870559447205, 0.480877842919462, 0.544071153733498, 0.606411207146701, 0.667844101663334, 0.728299738033216, 0.787690533152205, 0.845910508051074, 0.902834719936486, 0.958319098356665, 1.01220064999431, 1.06429807031477, 1.11441275660834, 1.16233017873755, 1.20782165400904, 1.25064645517539, 1.29055424883608, 1.3272878396626, 1.36058619860303, 1.39018767676553, 1.41583346505341, 1.43727115483125, 1.45425841873631, 1.46656673244844, 1.47398509646004, 1.47632371142625, 1.47341753063947, 1.4651296923586, 1.45135470092568, 1.43202139762852, 1.40709560662514, 1.37658245866075, 1.34052831885175, 1.29902231580615, 1.25219742839135, 1.20023108919059, 1.14334532376212, 1.08180637655081, 1.01592383437448, 0.946049244754336, 0.872574218167288, 0.795928063370392, 0.716574928491733, 0.635010494307459, 0.55175825520241, 0.467365404197774, 0.382398365734926, 0.297438048029497, 0.213074807350078, 0.129903235628895, 0.0485167862888156, -0.0304976865051694, -0.106565423641361, -0.179129226602023, -0.247654838998002, -0.311636176572969, -0.370600352548544, -0.42411244476, -0.471779942425696, -0.513256821187934, -0.548247203783219, -0.57650857716989, -0.597854489684654, -0.612156732769792, -0.619346968394209, -0.619417769401452, -0.612423083706985, -0.598478073194431, -0.57775837646107, -0.550498757184587, -0.516991187261369, -0.477582329218914, -0.432670513472378, -0.382702177658387, -0.328167833579868, -0.269597619103885, -0.207556421359651, -0.142638702304154, -0.0754630072683562, -0.0026161098824, 0.063102108285374, 0.13318616302267, 0.202929484478916, 0.27168119426245, 0.338801899396421, 0.403669490606997, 0.465684767029092) __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the po
[R] How-To capture and handle errors with R
The following error occurs every now and then by calling a function of wmTSA package: Error in `row.names<-.data.frame`(`*tmp*`, value = c("1", "0")) : invalid 'row.names' length I would greatly appreciate some guidelines about how to catch such an error upon its occurrence and have it handled by my own routine rather than letting R stop the currently run script. I had a look a the R on-line documentation about errors handler and also ran some provided examples that confused my mind. The error is in textual form. I do not know whether I have to pass the whole message to the handler. When such an exception occurs the execution control is not transferred to my routine. I would like to see a working example. Thank you so much, Maura Alice Messenger ;-) chatti anche con gli amici di Windows Live Messenger e tutti i telefonini TIM! Vai su http://maileservizi.alice.it/alice_messenger/index.html?pmk=footer [[alternative HTML version deleted]] __ R-help@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.
[R] Eror handling with R
Is there any way to handle errors retuened by R functions ... something like the exception handling in C++ ? Thank you so much, Maura Alice Messenger ;-) chatti anche con gli amici di Windows Live Messenger e tutti i telefonini TIM! Vai su http://maileservizi.alice.it/alice_messenger/index.html?pmk=footer [[alternative HTML version deleted]] __ R-help@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.
[R] R: Eror handling with R
Thank you. I got tryCatch working ... Maura -Messaggio originale- Da: Sarah Goslee [mailto:sarah.gos...@gmail.com] Inviato: ven 12/12/2008 16.24 A: mau...@alice.it Cc: r-h...@stat.math.ethz.ch Oggetto: Re: [R] Eror handling with R Is try() what you're looking for? Sarah On Fri, Dec 12, 2008 at 5:43 AM, wrote: > Is there any way to handle errors retuened by R functions ... something like > the exception handling in C++ ? > > Thank you so much, > Maura > > Alice Messenger ;-) chatti anche con gli amici di Windows Live Messenger e > tutti i telefonini TIM! > Vai su http://maileservizi.alice.it/alice_messenger/index.html?pmk=footer > -- Sarah Goslee http://www.functionaldiversity.org Alice Messenger ;-) chatti anche con gli amici di Windows Live Messenger e tutti i telefonini TIM! Vai su http://maileservizi.alice.it/alice_messenger/index.html?pmk=footer [[alternative HTML version deleted]] __ R-help@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.
[R] how to calculate DWT maximum decomposition level
Given a time series of length N, I am trying to figure out its maximum DWT decomposition level. With reference to "dwt" function of R package "wavelets", running the provided example I get the following and wonder how the maximum decomposition level (which is not an integer number) is calculated. I tried myself the formula in the on-line documentation but could not get the printed threshold in the error message. > X1 <- c(.2,-.4,-.6,-.5,-.8,-.4,-.9,0,-.2,.1,-.1,.1,.7,.9,0,.3) > X2 <- c(.2,-.4,-.6,-.5,-.8,-.4,-.9,0,-.2,.1,-.1,.1,-.7,.9,0,.3) > newX <- cbind(X1,X2) > wt <- dwt(newX, n.levels=5, boundary="periodic", fast=FALSE) > wt <- dwt(newX,filter="la8",n.levels=6, boundary="periodic", fast=FALSE) Error in dwt(newX, filter = "la8", n.levels = 6, boundary = "periodic", : Invalid argument value: 'n.levels' cannot be greater than 5 > newX <- newX[-32] > wt <- dwt(newX,filter="la8",n.levels=5, boundary="periodic", fast=FALSE) Error in dwt(newX, filter = "la8", n.levels = 5, boundary = "periodic", : Invalid argument value: 'n.levels' cannot be greater than 4.95419631038688 > newX <- newX[-31] > length(newX) [1] 30 > wt <- dwt(newX,filter="la8",n.levels=5, boundary="periodic", fast=FALSE) Error in dwt(newX, filter = "la8", n.levels = 5, boundary = "periodic", : Invalid argument value: 'n.levels' cannot be greater than 4.90689059560852 Generally speaking, is there a formula or rule to calculate the highest scale level when applying the Discrete Wavelet Transform to a time series of known length ? Thank you very much in advance for your assistance. Best regards, Maura Monville tutti i telefonini TIM! [[alternative HTML version deleted]] __ R-help@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.
[R] how to calculate the DWT maximum decomposition level
Given a time series of length N, I am trying to figure out its maximum DWT decomposition level. With reference to "dwt" function of R package "wavelets", running the provided example I get the following and wonder how the maximum decomposition level (which is not an integer number) is calculated. I tried myself the formula in the on-line documentation but could not get the printed threshold in the error message. > X1 <- c(.2,-.4,-.6,-.5,-.8,-.4,-.9,0,-.2,.1,-.1,.1,.7,.9,0,.3) > X2 <- c(.2,-.4,-.6,-.5,-.8,-.4,-.9,0,-.2,.1,-.1,.1,-.7,.9,0,.3) > newX <- cbind(X1,X2) > wt <- dwt(newX, n.levels=5, boundary="periodic", fast=FALSE) > wt <- dwt(newX,filter="la8",n.levels=6, boundary="periodic", fast=FALSE) Error in dwt(newX, filter = "la8", n.levels = 6, boundary = "periodic", : Invalid argument value: 'n.levels' cannot be greater than 5 > newX <- newX[-32] > wt <- dwt(newX,filter="la8",n.levels=5, boundary="periodic", fast=FALSE) Error in dwt(newX, filter = "la8", n.levels = 5, boundary = "periodic", : Invalid argument value: 'n.levels' cannot be greater than 4.95419631038688 > newX <- newX[-31] > length(newX) [1] 30 > wt <- dwt(newX,filter="la8",n.levels=5, boundary="periodic", fast=FALSE) Error in dwt(newX, filter = "la8", n.levels = 5, boundary = "periodic", : Invalid argument value: 'n.levels' cannot be greater than 4.90689059560852 Thank you very much in advance for your explanation. Best regards, Maura Monville tutti i telefonini TIM! [[alternative HTML version deleted]] __ R-help@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.
[R] How to cluster the elements of a binary vector
I would appreciate some suggestions with clustering the rows of a binary matrix. Basically given a binary vector (a generic row from matrix Bb) which contains an unknown number of 1s mixed with 0s, the problem is to define clusters according to the vague and incomplete description given in a paper:. " Determine the clusters U1 ,U2 ,,U c for each scale (matrix row) in the binary matrix Bb separately. The clustering is performed scale by scale without overlapping across the scales (rows) such that each cluster contains 0s and a 1 positioned near the center of the cluster. If the whole row of the matrix Bb doesn't have any 1s, then all coefficients in that scale are assumed to form just one cluster. The end result of all this is a cluster template that is used for feature extraction in .." They ignore cases like: 1. a row of matrix Be containing a 1 on either end (first and/or last row element) 2. a row of matrix Be containing two or more adjacent 1s (no 0 in-between) Thak you so much in advance, Maura tutti i telefonini TIM! [[alternative HTML version deleted]] __ R-help@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.
[R] I would appreciate some help with clustering
I have a binary vector whose length is known. Such a vector contains an unspecified number of 1s. My goal is 1. to generate as many clusters as the number of 1s 2. to place the 1 as much as possible at the center of its own cluster Example. Say I have the following binary vector: v <- c(0,0,1,0,0,0,0,1,0,1,0,0) Then I have to get 3 clusters. I can generate a matrix containing the distance of each element from each one of the clusters center (the 1s): 1st_12nd_1 3rd_1 ---|--- 0 | 2 7 9 0 | 16 8 1 | 0 5 7 0 | 1 4 6 0 | 2 3 5 0 | 3 2 4 0 | 4 1 3 1 | 5 0 2 0 | 6 1 1 1 | 7 2 0 0 | 8 3 1 0 | 9 4 2 Should I input such matrix to R function "dist" and then use for instance PAM or KMEAN to get the expected 3 clusters ? I would greatly appreciate some help. Thank you so much. Maura tutti i telefonini TIM! [[alternative HTML version deleted]] __ R-help@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.
[R] R: I would appreciate some help with clustering
-Messaggio originale- Da: Sarah Goslee [mailto:sarah.gos...@gmail.com] Inviato: mar 30/12/2008 13.42 A: mau...@alice.it Cc: r-help@r-project.org Oggetto: Re: [R] I would appreciate some help with clustering Is this homework? If so, you should discuss it with the instructor, not us. Regardless, the methods you suggested are a reasonable place to start, and you perhaps should have done so first before asking here. You may well have gotten the results you needed without the delay of waiting for an answer on the list. Sarab On Tue, Dec 30, 2008 at 6:59 AM, wrote: > I have a binary vector whose length is known. > Such a vector contains an unspecified number of 1s. > My goal is > 1. to generate as many clusters as the number of 1s > 2. to place the 1 as much as possible at the center of its own cluster > > Example. Say I have the following binary vector: > v <- c(0,0,1,0,0,0,0,1,0,1,0,0) > Then I have to get 3 clusters. > I can generate a matrix containing the distance of each element from each one > of the > clusters center (the 1s): > > 1st_12nd_1 3rd_1 > ---|--- > 0 | 2 7 9 > 0 | 16 8 > 1 | 0 5 7 > 0 | 1 4 6 > 0 | 2 3 5 > 0 | 3 2 4 > 0 | 4 1 3 > 1 | 5 0 2 > 0 | 6 1 1 > 1 | 7 2 0 > 0 | 8 3 1 > 0 | 9 4 2 > > Should I input such matrix to R function "dist" and then use for instance PAM > or KMEAN > to get the expected 3 clusters ? > I would greatly appreciate some help. > > Thank you so much. > Maura > -- Sarah Goslee http://www.functionaldiversity.org It is no homework. It is part of a project where a binary matrix, whose 1s represent the position of the highest DWT coefficients energy, is used as a template to extract signal features. The approach I am following requires each row of the binary matrix (correspondent to a DWT scale level) to be clustered separately subject to the requirements of generating as many clusters as the numbers of 1s and having the 1s a the centers of the respective clusters. I simply do not know how to organize a binary vector data and which function to feed it to, in order to achieve my goal. I tried to input the matrix I posted to R function "dist" and got a 3x3 distance matrix. I wonder what is the meanong of doing that since I already calculated the distances of each 0 from each 1. Although I cannot call this a "distance matrix" because it is not symmatrical and not square. I tried calling both KMEANS and PAM passing the 3x3 distance matrix and got no more than 2 clusters whereas I need 3 ones. I tried calling both KMEANS and PAM passing the matrix I posted. Again I only got 2 clusters. I do not know how to specify the cluster centers, which is accepted by KMEANS but there is no example showing how to do that. I deduce that my approach is wrong rather than a reasonable starting place. Best regards, Maura tutti i telefonini TIM! [[alternative HTML version deleted]] __ R-help@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.
[R] segfault while running an R script
> MS <- floor (log2 (MinFileLen)) #NUMBER OF DECOMPOSITION LEVELS *** caught segfault *** address 0x31343142, cause 'memory not mapped' Possible actions: 1: abort (with core dump, if enabled) 2: normal R exit 3: exit R without saving workspace 4: exit R saving workspace Any idea ? Thank you in advance. Maura tutti i telefonini TIM! [[alternative HTML version deleted]] __ R-help@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.
Re: [R] segfault while running an R script
I have installed R-2.8.1 right now and will proceed with my tests. So far I haven't used it. The fault is presumably caused by a sort of misuse of the memory on my part. The attached R script (whose last Step is not debugged yet) implements the algorithm for signal features extraction described in the attached paper. Needless to say, to get good statistics we need plenty of data.Therefore I started out with a minimum of 30 signals (please find attached 48 detrended, denoised, centralized, standardized, and compressed signals I am using with the script). The algorithm generates many big matrices and vectors. Roughly a matrix is generated at each step. Of course in my last script version I will remove the useless data structures dynamically. At the time being, though, I keep them all because I have to trace back each data elaboration step. Between successive runs I clear the console but rarely I clear the workspace. Even if the data structures are generated again at each run, maybe the system memory stack gets fragmented ? ... just my worthless guess ... I am afraid I cannot prune the code without changing the algorithm. The detected fault seems to be a memory problem. Therefore, the allocation of big data structures over and over again is suspicious ... About the algorithm... my implementation seems to perform according to the prescription. However, I am not enthusiastic with results depending on vague choices of the parameters. Basically the number of signal features extracted depends on an arbitrary input threshold. Maybe someone in the R-help list might suggest a better, more robust, way to extract features from mono-channel signals ... Kind regards, Maura E Benvenuto in Alice Giga Mail! mau...@alice.it tramite il servizio Giga Mail ha messo a tua disposizione i seguenti allegati: * Archive.zip ( 5980513 bytes ) * Signals-Features-Extraxtion-through-DWT-Coefficients.txt ( 10148 bytes ) * wave.pdf ( 256758 bytes ) per scaricarli, fai click sul seguente link che ti portera' su una pagina dove troverai i comandi per visualizzare o scaricare gli allegati sul tuo PC: http://gigamail.rossoalice.alice.it/messages/readMessageFrameset.aspx?De liveryID=19412684-adf5-4e53-a1fe-a8e58848cb8e Ti ricordiamo che gli allegati saranno a tua disposizione fino al 08-01-2009 alle ore 11.35.04 e che il mittente potrebbe ricevere le informazioni relative alla tua apertura della Giga Mail e all'avvenuto download degli allegati. GigaMail è il nuovo servizio gratuito di Alice che ti permette di inviare a chi vuoi, allegati di grandi dimensioni, fino a 2GB, in modo semplice e veloce, senza occupare spazio utile nella tua casella di posta. Per saperne di più visita il sito www.alice.it Ti ringraziamo per aver utilizzato il servizio Alice GIGA MAIL. [[alternative HTML version deleted]] __ R-help@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.
[R] passing parameters to an R script
I knowf R functions ca be called passing some parameters. My first question is: how are parameters passed to R functions ? Browsing through R archives I found an answer confirming taht parameters can be passed to the called function by value. I wonder whether passing the parameter address is possible somehow to allow the function to actually change its value. My second question is about running R scripts with parameters. Something similar to the s/w device (argc, argv) which is used to run a C program with initial parameters. Is this possible at all ? Thank you very much. Maura tutti i telefonini TIM! [[alternative HTML version deleted]] __ R-help@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.
[R] R: passing parameters to an R script
Thank you. You're right. I come from C and C++ programming. I wonder whether to pass parameters to an R script I have to set environment variables ... ? Best regards, Maura -Messaggio originale- Da: jim holtman [mailto:jholt...@gmail.com] Inviato: sab 03/01/2009 21.12 A: mau...@alice.it Cc: r-h...@stat.math.ethz.ch; r-help@r-project.org Oggetto: Re: [R] passing parameters to an R script No you can not pass an address to a function. If you want to change the value of something, then return it as a value and assign it to the object so you can see what is going on. Must be coming from the "C" environment where such things are allowed and lead to a number of problems. If you really have your heart set to do it, look at the '<<-' operator (or 'assign'), but use it with care. To retrieve environment values, use "Sys.getenv". On Sat, Jan 3, 2009 at 1:32 PM, wrote: > I knowf R functions ca be called passing some parameters. > My first question is: how are parameters passed to R functions ? > Browsing through R archives I found an answer confirming taht parameters can > be passed to the called function by value. I wonder whether passing the > parameter > address is possible somehow to allow the function to actually change its > value. > > My second question is about running R scripts with parameters. Something > similar to the > s/w device (argc, argv) which is used to run a C program with initial > parameters. > Is this possible at all ? > > Thank you very much. > Maura > > > > tutti i telefonini TIM! > > >[[alternative HTML version deleted]] > > __ > R-help@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. > -- Jim Holtman Cincinnati, OH +1 513 646 9390 What is the problem that you are trying to solve? tutti i telefonini TIM! [[alternative HTML version deleted]] __ R-help@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.
[R] How can pairs of values be stored in a 2D matrix ?
My question is motivated by dealing with pairs of values, like (3,12.5), (16,2.98), and so on that are mapped to a cartesian plain (Time, Frequence) I miss C multidimensional arrays. I am trying to simulate the 3rd dimension by declaring a matrix of lists. R seems to accept the definition of such a matrix. But I'm experiencing some difficulty at storing pairs of data in it. In the following are some of my attempts. I would greatly appreciate some help. > A <- matrix(data ="list", nrow=2, ncol=4) > A [,1] [,2] [,3] [,4] [1,] "list" "list" "list" "list" [2,] "list" "list" "list" "list" > A[[1]] <- list(data="12.3",variable="d1") Error in A[[1]] <- list(data = "12.3", variable = "d1") : more elements supplied than there are to replace > A[1,2] <- list(data="12.3",variable="d1") Error in A[1, 2] <- list(data = "12.3", variable = "d1") : number of items to replace is not a multiple of replacement length > A[[1,2]] <- list(data="12.3",variable="d1") Error in A[[1, 2]] <- list(data = "12.3", variable = "d1") : more elements supplied than there are to replace > A[[1,1]] <- list(data="12.3",variable="d1") Error in A[[1, 1]] <- list(data = "12.3", variable = "d1") : more elements supplied than there are to replace > A[[1]][1] <- 10 > A[[1]][2] <- "f1-t1" Error in A[[1]][2] <- "f1-t1" : more elements supplied than there are to replace > A[[1]][2] <- "d1" Error in A[[1]][2] <- "d1" : more elements supplied than there are to replace Regards, Maura tutti i telefonini TIM! [[alternative HTML version deleted]] __ R-help@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.
[R] How-To extract data from a matrix of lists subject to a set of given constraints
My goal is to store the DWT coefficients from a number of time series in such a way to be able to extract subsets satisfying giben conditions. I have defined the following 11 matrices whose x-axis represent time intervals and y-axis represent the number of time series: MS <- 11 d1.mat <- matrix (data=list(), nrow=TotNumCycles, ncol=2^(MS-1)) d2.mat <- matrix (data=list(), nrow=TotNumCycles, ncol=2^(MS-3)) d3.mat <- matrix (data=list(), nrow=TotNumCycles, ncol=2^(MS-3)) d4.mat <- matrix (data=list(), nrow=TotNumCycles, ncol=2^(MS-4)) d5.mat <- matrix (data=list(), nrow=TotNumCycles, ncol=2^(MS-5)) d6.mat <- matrix (data=list(), nrow=TotNumCycles, ncol=2^(MS-6)) d7.mat <- matrix (data=list(), nrow=TotNumCycles, ncol=2^(MS-7)) d8.mat <- matrix (data=list(), nrow=TotNumCycles, ncol=2^(MS-8)) d9.mat <- matrix (data=list(), nrow=TotNumCycles, ncol=2^(MS-9)) d10.mat <- matrix (data=list(), nrow=TotNumCycles, ncol=2^(MS-10)) d11.mat <- matrix (data=list(), nrow=TotNumCycles, ncol=2^(MS-11)) Each di.mat (i=1,2,...,11) matrix slot is assigned a DWT coefficient modulus and the signal and cycle number it belongs to: coef <- abs (as.numeric (aa.dwt$data[[n]])) #GET DWT COEFFICIENTS .. for (k in 1:length(coef)) { d7.mat [[nCycle ,k]] <- list (data=coef [k],variable=paste(insig,":",cyc,sep="")) } As a consequence d7.mat contains the following: [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [1,] List,2 List,2 List,2 List,2 NULL NULL NULL NULL NULL NULL My goal is to store the DWT coefficients from a number of time series in such a way to be able to extract subsets satisfying giben conditions. I have defined the following 11 matrices whose x-axis represent time intervals and y-axis represent the number of time series: MS <- 11 d1.mat <- matrix (data=list(), nrow=TotNumCycles, ncol=2^(MS-1)) d2.mat <- matrix (data=list(), nrow=TotNumCycles, ncol=2^(MS-3)) d3.mat <- matrix (data=list(), nrow=TotNumCycles, ncol=2^(MS-3)) d4.mat <- matrix (data=list(), nrow=TotNumCycles, ncol=2^(MS-4)) d5.mat <- matrix (data=list(), nrow=TotNumCycles, ncol=2^(MS-5)) d6.mat <- matrix (data=list(), nrow=TotNumCycles, ncol=2^(MS-6)) d7.mat <- matrix (data=list(), nrow=TotNumCycles, ncol=2^(MS-7)) d8.mat <- matrix (data=list(), nrow=TotNumCycles, ncol=2^(MS-8)) d9.mat <- matrix (data=list(), nrow=TotNumCycles, ncol=2^(MS-9)) d10.mat <- matrix (data=list(), nrow=TotNumCycles, ncol=2^(MS-10)) d11.mat <- matrix (data=list(), nrow=TotNumCycles, ncol=2^(MS-11)) Each di.mat (i=1,2,...,11) matrix slot is assigned a DWT coefficient modulus and the signal and cycle number it belongs to: coef <- abs (as.numeric (aa.dwt$data[[n]])) #GET DWT COEFFICIENTS .. for (k in 1:length(coef)) { d7.mat [[nCycle ,k]] <- list (data=coef [k],variable=paste(insig,":",cyc,sep="")) } As a consequence d7.mat contains the following: [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [1,] List,2 List,2 List,2 List,2 NULL NULL NULL NULL NULL NULL [2,] List,2 List,2 List,2 List,2 NULL NULL NULL NULL NULL NULL [3,] List,2 List,2 List,2 List,2 NULL NULL NULL NULL NULL NULL [4,] List,2 List,2 List,2 List,2 NULL NULL NULL NULL NULL NULL [5,] List,2 List,2 List,2 List,2 NULL NULL NULL NULL NULL NULL [6,] List,2 List,2 List,2 List,2 NULL NULL NULL NULL NULL NULL [7,] List,2 List,2 List,2 List,2 NULL NULL NULL NULL NULL NULL [8,] List,2 List,2 List,2 NULL NULL NULL NULL NULL NULL NULL [9,] List,2 List,2 List,2 List,2 NULL NULL NULL NULL NULL NULL > d5.mat[[3,4]] $data [1] 0.6290917 $variable [1] "10146:3" > d5.mat[[6,4]] $data [1] 1.187133 $variable [1] "10146:6" > d5.mat[[8,4]] NULL > d5.mat[[10,4]] $data [1] 0.7789786 $variable [1] "10146:10" > d5.mat[[50,4]] $data [1] 0.8909976 $variable [1] "10146:50" How can I extract, for instance, all the data from the i_th column of the matrix that satisfy a given conditon? In the case of a matrix A made up of numbers I would write : which (A [,i] > 0.1) ...? Thank you in advance for your help. Maura tutti i telefonini TIM! [[alternative HTML version deleted]] __ R-help@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.
[R] PSF Clustering Method
Does R implements Pseudo-F-Statistics Clustering ? Vogel and Wong derived a formula to evaluate the best clusters number through such a method. Silhouette metod only provides an average evaluation. Thank you very much. Maura tutti i telefonini TIM! [[alternative HTML version deleted]] __ R-help@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.
[R] Pseudo-F-Statistics Clustering
Is there any R package which implements Pseudo-F-Statistics Clustering ? Vogel and Wong derived a formula to evaluate the best clusters number through such a method. Silhouette metod only provides an average evaluation. Thank you very much. Maura tutti i telefonini TIM! [[alternative HTML version deleted]] __ R-help@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.
[R] package clusterSim
I am interested in familiarizing with the functions belonging to paclage clusterSim. This package on-line documentation indicates a file pathname which is clear to me on Linux systems where $VAR identifies VAR as an environment variable. But what if I am using a Windows system ? I do not know how to make Windows or DOS resolve the following address: $R_HOME\library\clusterSim\pdf\indexG1_details.pdf I wonder whether such a package implements the Pseudo F-statistics method for clustering as described in the following paper: IEEE Transactions on Pattern Analysis and Machine Intelligence, volume 1 (1979), number 3 * Vogel, M.A. and A.K.C. Wong, PFS clustering method, pp. 237-245. Any suggestion and/or comment is welcome. Thank you so much. Maura tutti i telefonini TIM! [[alternative HTML version deleted]] __ R-help@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.
[R] Help with clustering
I am going to try out a tentative clustering of some feature vectors. The range of values spanned by the three items making up the features vector is quite different: Item-1 goes roughly from 70 to 525 (integer numbers only) Item-2 is in-between 0 and 1 (all real numbers between 0 and 1) Item-3 goes from 1 to 10 (integer numbers only) In order to spread out Item-2 even further I might try to replace Item-2 with Log10(Item-2). My concern is that, regardless the distance measure used, the item whose order of magnitude is the highest may carry the highest weight in the process of calculating the similarity matrix therefore fading out the influence of the items with smaller variation in the resulting clusters. Should I normalize all feature vector elements to 1 in advance of generating the similarity matrix ? Thank you so much. Maura tutti i telefonini TIM! [[alternative HTML version deleted]] __ R-help@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.
[R] plot Ticks
Is there a way to force the number of ticks along an axis ? I read the on-line documentation and tried many combinations of all available parameters from functions par(), axTicks(), axis(), plot() ... but no luck ! Thank you very much, Maura tutti i telefonini TIM! [[alternative HTML version deleted]] __ R-help@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.
[R] How-to-rotate-plot-title
I wonder whether it is possible to rotate the title of the barplot on the top right corner of the attached layout. It would be more readable if the whole string were rotated by 180 degrees (mirrored). Thank you very much. Maura Benvenuto in Alice Giga Mail! mau...@alice.it tramite il servizio Giga Mail ha messo a tua disposizione i seguenti allegati: * How-to-rotate-plot-title.bmp ( 3832374 bytes ) per scaricarli, fai click sul seguente link che ti portera' su una pagina dove troverai i comandi per visualizzare o scaricare gli allegati sul tuo PC: http://gigamail.rossoalice.alice.it/messages/readMessageFrameset.aspx?De liveryID=bd345f9d-178c-49cf-846d-44a1fb4ad645 Ti ricordiamo che gli allegati saranno a tua disposizione fino al 02-02-2009 alle ore 01.13.20 e che il mittente potrebbe ricevere le informazioni relative alla tua apertura della Giga Mail e all'avvenuto download degli allegati. GigaMail è il nuovo servizio gratuito di Alice che ti permette di inviare a chi vuoi, allegati di grandi dimensioni, fino a 2GB, in modo semplice e veloce, senza occupare spazio utile nella tua casella di posta. Per saperne di più visita il sito www.alice.it Ti ringraziamo per aver utilizzato il servizio Alice GIGA MAIL. [[alternative HTML version deleted]] __ R-help@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.
[R] help with plot layout
It takes a lot of sweat to generate a composite plot with R ... sigh. I though I was almost done when I met the umpteenth hurdle. I cannot place a nice title on the 2nd plot (raw signal) on the layout. I do not have control on where either the "main" option of "plot" function, or "title", place the text string which keeps dysplaying chopped from above. I also tried "text", changing many times the string coordinates, but could not see any text anywhere on the canvas . By the way, since the layout breaks the canvas into 4 parts, are the text coordinates absolute (referred to the canvas) or relative (referred to the part) ? Please, find attached the generated drawing. The generating script is i the following. Thank you so much, Maura ## WavMaxNumCoef <- 30 setwd("C:/Documents and Settings/Monville/SpAn-Tests/16440-Raw-Dir") xx <- read.table("Interp-Amp-PhasePlus16440.txt",header=TRUE, sep=" ") NumCycles <- max(xx[,"cycle"]) TickPos <- vector(length=NumCycles) TickCoord <- vector(length=NumCycles) for(i in 1:NumCycles) { TickPos[i] <- xx[min(which(xx[,"cycle"] == i)),1] } aa <- read.table( "16440-Alpha.txt" ) xaa <- seq(1:length(t(aa))) vv <- read.table("16440-Vanishing-Moments") vvLab <- seq(1,WavMaxNumCoef/2,1) vvCounts <- vector(length=WavMaxNumCoef/2) for(k in 1:(WavMaxNumCoef/2)) { vvCounts[k] <- length(which(vv[] == k)) } yyLab <- seq(1,length(t(vv)),2) bb <- read.table("16440-Length") bbLab <- seq(min(bb),max(bb),1) bb <- sort(t(bb)) bbCounts <- as.numeric(vector(length=(max(bb)-min(bb)+1))) for(k in 1:length(bbCounts)) { bbCounts[k] <- length(which(bb[] == (k +min(bb) -1))) } zzLab <- seq(1,max(bbCounts),1) # DEFINE LAYOUT x11(width=22,height=14) nf <- layout(matrix(c(1,3,2,4),2,2,byrow=TRUE), c(3,1), c(2,2),FALSE) layout.show(nf) # PLOT DONOHO ALPHA par(mar=c(10,4,2,5),xaxt="n",cex.axis=1,pty="m") plot(xaa,t(aa),type="h") par (xaxt="s",xaxp=c(0,95.964,24),xaxs="i") axis(1,at=TickPos,labels=as.character(TickPos),col="red",col.axis="red",font.axis=1) # PLOT RAW SIGNAL par(mar=c(3,4,0,5),xaxt="n",cex.axis=1,pty="m") plot(xx[,1],xx[,2],pch=3,type="l",frame.plot=FALSE,xpd=TRUE) title("Raw Signal 16440",cex.main=1.0,font=2) par (xaxt="s",xaxp=c(0,95.964,24),xaxs="i") axis(1,at=TickPos,labels=as.character(TickPos),col="red",col.axis="red", font.axis=1) # PLOT VANISHING MOMENT DISTRIBUTION par(mar=c(1,0,2,3),xaxt="n",yaxt="n",cex.axis=0.7,pty="m") barplot(vvCounts,width=1,space=0,horiz=TRUE,axes=FALSE) par(xaxt="s",yaxt="s",crt=180,srt=270,adj=1,las=3,xpd=TRUE) text(x=25.5,y=15.3,pos=4,"Wavelet Vanishing Moments Distribution",cex=1.0,font=2) axis(2,at=vvLab-1,labels=as.character(vvLab),col="red",col.axis="red",font.axis=1,xpd=TRUE, cex.lab=1) axis(3,at=yyLab-1,labels=as.character(yyLab),col="red",col.axis="red",font.axis=1,xpd=TRUE, cex.lab=0.8,cex.axis=0.8) # PLOT CYCLES LENGTH par(mar=c(0,0,1,3),xaxt="n",yaxt="n",cex.axis=1) barplot(bbCounts,width=1,axes=FALSE,space=0,horiz=TRUE) par(xaxt="s",yaxt="s",crt=180,srt=270,adj=1,las=3,cex.lab=0.1,xpd=TRUE) text(x=15.5,y=65.3,pos=4,"Cycles Length Distribution",cex=1.0,font=2) axis(2,at=as.numeric(bbLab)-41,labels=bbLab,col="red",col.axis="red",font.axis=1, lab=c(10,10,15),cex.lab=0.7,cex.axis=0.6) axis(3,at=zzLab,labels=as.character(zzLab),col="red",col.axis="red",font.axis=1,xpd=TRUE, cex.lab=1,cex.axis=0.8) # cords <-locator(n=3) e tutti i telefonini TIM! Vai su __ R-help@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.
[R] Equivalent of Hold On MatLab Command
Does R have a graphic command equivalent of MatLab Hold On ? I am trying to sabve on a pdf file a composite drawing. I first declare the canvas size, then I define the layout, finally I generate the 4 plots according to layout order. Eventually I close the pdf file (dev.off()). The resulting PDF file contains 2 pages. The first one shows only the layout. The second one shows the whole composite drawing. MatLab has the command Hold On to work around similar synchronization problems. Does R have have an equivalent command ? Thank you so much, Maura tutti i telefonini TIM! [[alternative HTML version deleted]] __ R-help@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.
[R] R: R: Hidden Markov Models
Thank you for your prompt answer. The breathing signal observations are the amplitude values as a function of time and phase. According to our model the hidden states are the different breathing types. Subjects, whose respiratiion process is regular, are likely to breathe, keeping the same cycle pattern/type, for many consecutive cycles. therefore dwelling in the same hidden state. The more regular the breathing process is, the more predictive its signal becomes the higher its amplitude autocorrelation order. I guess my question is: can msm implement an AutoRegressive HMM ? It seems that depmixS4 can but it has a time series length constraint that I don't quite understand. Thank you in advance for your attention. Kind regards, Maura Edelweiss -Messaggio originale- Da: Walter Zucchini [mailto:[EMAIL PROTECTED] Inviato: mar 11/11/2008 11.32 A: [EMAIL PROTECTED] Oggetto: Re: R: Hidden Markov Models Dear Ms Monville, Hidden Markov models (HMMs), and that includes the msm implementation, are not based on the assumption that the observations are independent. Indeed HMMs are specifically designed to model serially dependent observations. Of course that doesn't mean that they can accommodate every type of serial dependence. It might turn out that HMMs are not useful for modelling whatever aspect of breathing you are investigating. HMMs are based on the assumption that the observations are "conditionally independent, given the states". This is a somewhat technical assumption that I won't try to explain by email, except to say that "conditional independence" does not imply independence of the observations themselves. Regards, Walter Zucchini -- Prof. Walter Zucchini, Institut fuer Statistik und Oekonometrie, Georg-August-Universitaet, Platz der Goettinger Sieben 5, 37073 Goettingen, Germany - Tel +49-551-397286 FAX +49-551-397279 = [EMAIL PROTECTED] wrote: > Dear Prof. Zucchini, > > I am reading the comprehensive on-line documentation about msm. > The positive side is that it seems it has been designed for biomedical > statistics, > like Clinical Trials. > The bad side is that it does not seem to model observations sequences that > are not > independent but instead are autocorrelated, as it is my case. I did not find > any mention to > correlated observations therefore I assume the authors did not have to face > this problem. > Did I get it wrong ? > > Since the breathing signals amplitude is an autocorrelated function of time > and phase, I would > greatly appreciate your comments about the possibility to use msm eventually > after carring out > some modifications if the source code is available. > > Thank you in advance for your attention. > >Kind regards, >Maura Edelweiss > > > -Messaggio originale- > Da: Walter Zucchini [mailto:[EMAIL PROTECTED] > Inviato: lun 20/10/2008 12.50 > A: [EMAIL PROTECTED] > Oggetto: Re: Hidden Markov Models > > Dear Ms Monville, > >> something in R that implements continuous HMMs > > The R-library "msm", "Multi-state Markov and hidden Markov models in > continuous time", might do what you want. > > Regards, > > Walter Zucchini > > > -- > Prof. Walter Zucchini, > Institut fuer Statistik und Oekonometrie, > Georg-August-Universitaet, > Platz der Goettinger Sieben 5, > 37073 Goettingen, > Germany > - > Tel +49-551-397286 FAX +49-551-397279 > = > > > [EMAIL PROTECTED] wrote: >> Dear Prof. Zucchini, >> >> My name is Maura Edelweiss. >> I am a physicist (just graduated from Washington University) with a genuine >> interest in Statistical Signal Processing. >> Dr. Lamb and I are trying to build a model of human breathing from some >> breathing signals. >> SSA and some extra analysis (R and C++ code ) show that there are only a few >> breathing cycle types. >> That is, humans breathe switching from one cycle type to another. >> The breathing process seems to be well modeled by a Continuous output >> Density Hidden Markov Model. >> Since neither of us has previous experience with HMMs, we wonder if there is >> something in R that implements continuous HMMs and is reasonably well >> documented. That might make it easier to get started. >> >> Thank you in advance for your attention and help. >> Kind regards, >> > > > > Alice Messenger ;-) chatti anche con gli amici di Windows Live Messenger e > tutti i telefonini TIM! > Vai su http://maileservizi.alice.it/alice_messenger/index.html?pmk=footer > Alice Messenger ;-) chatti anche con gli amici di Windows Live Messenger e tutti i telefonini TIM! Vai su http://maileservizi.alice.it/alice_messenger/index.html?pmk=footer [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-hel
[R] R: choice of an HMM package
How can I access the depmix-intro vignette ? I have displayed thhttp://cat.inist.fr/?aModele=afficheN&cpsidt=18787092e R vignette but depmix does no appear in the list. I do need to go throusg some worked out example to see if it can be used for the respiraton model. Why I get the following messages when I type : > library(depmix) Warning messages: 1: dependency Rdonlp2 is not available 2: dependency Rdonlp2 is not available 3: dependency Rdonlp2 is not available Thank you in advance, Maura http://cat.inist.fr/?aModele=afficheN&cpsidt=18787092 -Messaggio originale- Da: [EMAIL PROTECTED] per conto di Ingmar Visser Inviato: mer 12/11/2008 15.10 A: Maura E Monville Cc: r-help@r-project.org Oggetto: Re: [R] choice of an HMM package Dear Maura, On 9 Nov 2008, at 02:24, Maura E Monville wrote: > We are trying to build a human respiration model. > Preliminary analysis of some breathing signals has shown that > humans breathe > through switching among > a finite number of patterns. > Hidden Markov seems to be the right approach. Since most of our > code is > written in R scripting language, finding an R package implementing > an HMM > that we can use for our prototype would be very helpful. > I have been suggested both *msm* and *depmixS4.* > I have no previous experience with HMMs and feel at a loss about > making a > sensible choice. > As a novice I am more attracted by msm because of the comprehensive > documentation, with worked out examples, that I am printing out. > Whereas I > could not find anything but the usual R function call description for > depmixS4. ?depmixS4 provides a brief overvied of the package ?depmix tells you how to specify models ?fit tells you how to fit specified models The package also includes a vignette depmix-intro.pdf with some worked examples. > Moreover, I cannot make a sense of depmixS4 documentation > mentioning time > series of length 1 ... Does it mean depmixS4 models time series > made up of > one single observation ? Sorry for my trivial question. As the documentation says depmixS4 also fits non-dependent mixtures, however that does not seem applicable in your case as you want to model time series with HMMs. There is no principled limitation in the lengths of timeseries depmixS4 can handle. > In my case I have to model a variable which is an autocorrelated > continuous > function of time. The transition probabilities may as well depend > on time. > Therefore I believe we need an AutoRegressive Continuous Density HMM, > possibly also non-stationary. Can you provide a reference for this kind of model as that will make your question much more clear. > Any suggestion from HMM experts is welcome. > > Best regards, > > -- > Maura E.M > > [[alternative HTML version deleted]] > > __ > R-help@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. Ingmar Visser Department of Psychology, University of Amsterdam Roetersstraat 15 1018 WB Amsterdam The Netherlands t: +31-20-5256723 [[alternative HTML version deleted]] __ R-help@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. Alice Messenger ;-) chatti anche con gli amici di Windows Live Messenger e tutti i telefonini TIM! Vai su http://maileservizi.alice.it/alice_messenger/index.html?pmk=footer [[alternative HTML version deleted]] __ R-help@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.
[R] How to enable R on-line search in HTML help
I use FireFox as my favourite web browser on my Mac OS/X 10.5 I double-checked that Java and Java scripts are enabled for FireFox. Nevertheless, I cannot use R on-line search help. I called Apple Tech Assistance but they do not support FireFox. We tried to set Saphari as the favourite browser but evidently R does not support it. Does any one knw of a workaround this annoying problem ? Thanks a lot, Maura Alice Messenger ;-) chatti anche con gli amici di Windows Live Messenger e tutti i telefonini TIM! Vai su http://maileservizi.alice.it/alice_messenger/index.html?pmk=footer [[alternative HTML version deleted]] __ R-help@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.
[R] R: How to enable R on-line search in HTML help
-Messaggio originale- Da: Prof Brian Ripley [mailto:[EMAIL PROTECTED] Inviato: ven 14/11/2008 18.27 A: [EMAIL PROTECTED] Cc: r-help@r-project.org Oggetto: Re: [R] How to enable R on-line search in HTML help First, there is a R-sig-mac list for Mac OS questions. I will try the channel you suggest if I cannot get this problem fixed soon. On Fri, 14 Nov 2008, [EMAIL PROTECTED] wrote: > I use FireFox as my favourite web browser on my Mac OS/X 10.5 Which version of Firefox? There is a known issue with all released versions >= 3, discussed in the R-admin manual (and R has had a workarounf in place for a while now). In fact I am running version 3.0.4 I saw the suggestion: "This is a bug in the way Firefox is interpreting relative URLs, and can be circumvented by opening the HTML search page (.../doc/html/SearchEngine.html) directly rather than from .../doc/html/index.html as shown by help.start()." But I have no control on where OS generates the link to R help-search started from the top bar menu. > I double-checked that Java and Java scripts are enabled for FireFox. > Nevertheless, I cannot use R on-line search help. How are you trying to use it? And what exactly happens? I click on the Help item in the top menu bar which appears as R GUI is loaded. As a result a new window pops up which contains three sections named "Manuals", "Reference", "Miscellaneous Material". I click on the link "Search Engine & Keyword" in the Reference section. Another page pops up with a number of links to R main topics. None of such links works for me no matter how many time I click on any of them. The only lik that works is "R Installation and Administration" even if I double-checked that mybrowser (FireFox) has all Java boxes checked (flags enabled). In fact I do not see any Applet SearchEngine started anywhere on the browser window. The help.search utility works fine when started on R command line. There is no difference if I replace FireFox with Safari as the main web browser. You might be using help.start (in which case check its help page for the workaround). Or are you referring to help in the R.app GUI (in which case this is the wrong list)? Actually this problam arises when I click on the Help item of the top menu bar which is loaded with R GUI > I called Apple Tech Assistance but they do not support FireFox. We tried to > set Saphari as the favourite browser but > evidently R does not support it. In what sense? I've used search in help.start() with Safari in the past: I even tested it on Windows. With reference to the Hep item in the top menu bar, the behaviour is the same regardless of choosing either FireFox or Safari > Does any one knw of a workaround this annoying problem ? We need to understand the problem first: see the footer to this and every R-help message. There may be a mailing list where these GUI-related issues are discussed. I would be happy to redirect my question to the pertinent channel. Best regrds, Maura E. > Thanks a lot, > Maura > > Alice Messenger ;-) chatti anche con gli amici di Windows Live Messenger e > tutti i telefonini TIM! > Vai su http://maileservizi.alice.it/alice_messenger/index.html?pmk=footer > > [[alternative HTML version deleted]] > > __ > R-help@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. > -- Brian D. Ripley, [EMAIL PROTECTED] Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UKFax: +44 1865 272595 Alice Messenger ;-) chatti anche con gli amici di Windows Live Messenger e tutti i telefonini TIM! Vai su http://maileservizi.alice.it/alice_messenger/index.html?pmk=footer [[alternative HTML version deleted]] __ R-help@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.
[R] signal features extraction
I wonder whether a package for signal (not image) features extraction has ever been contributed to CRAN. We have a very crude signal classifier based on the absolute difference of the area subtended by the two signals being compared. We miss by far a lot of possibly important features. Thank you very much. Maura Alice Messenger ;-) chatti anche con gli amici di Windows Live Messenger e tutti i telefonini TIM! Vai su http://maileservizi.alice.it/alice_messenger/index.html?pmk=footer [[alternative HTML version deleted]] __ R-help@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.
[R] a trous wavelet transform in R ?
There may be some chance that a proper wavelet transform may help me with signal features extraction. I know R contains a number of packages implementing wavelett filters and/or transforms. Is there an implementation of a trous wavelet transform ? Thank you so much, Maura Alice Messenger ;-) chatti anche con gli amici di Windows Live Messenger e tutti i telefonini TIM! Vai su http://maileservizi.alice.it/alice_messenger/index.html?pmk=footer [[alternative HTML version deleted]] __ R-help@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.
[R] examples of usage of Rwave functions
I would like to try the Continuous Wavelet Transform to extract the features of non-linear and non stationary 1D signals. I can remove the noise and the trend so make them easier to analyze. I am not sure the CWT will work. To the purpose of trying it out I have downloaded the Rwave package. To my dismay, no example is provided for any of the functions making up such a package. The on-line documentation (so to speak) does not even describe the input file (vector) format. My signals are all in ascii format. They are made up of amplitude, time, phase which are all real numbers. I wonder if I can feed any of my signal to Rwave functions ??? I would appreciate seeing some usage example. Thank you in advance, Maura Alice Messenger ;-) chatti anche con gli amici di Windows Live Messenger e tutti i telefonini TIM! Vai su http://maileservizi.alice.it/alice_messenger/index.html?pmk=footer [[alternative HTML version deleted]] __ R-help@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.
[R] help with package Rwave
I am looking for some explanations about the usage of the poorely documented R paclkage Rwave. Has anyone ever tried out its functions for Wavelet Analysis ? Thank you so much. Maura Alice Messenger ;-) chatti anche con gli amici di Windows Live Messenger e tutti i telefonini TIM! Vai su http://maileservizi.alice.it/alice_messenger/index.html?pmk=footer [[alternative HTML version deleted]] __ R-help@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.
[R] Help with wavCWTPeaks
I cannot understand the following error printed out when I try to get the extrema of my time series. I would appreciate some suggestion as I really cannot interpret the error. I might not be using a proper set of parameters in calling such functions. I am learning by doing ... > aa.peak <- wavCWTPeaks (aa.tree) Error in `row.names<-.data.frame`(`*tmp*`, value = c("1", "0")) : invalid 'row.names' length My data vector is as follows: > aa [1] -0.852625404 -0.886941142 -0.920699269 -0.953858240 -0.986377090 [6] -1.018215725 -1.049335086 -1.079697274 -1.109265628 -1.138004782 [11] -1.165880733 -1.192860894 -1.218914146 -1.244010899 -1.268123116 [16] -1.291224432 -1.313290096 -1.334297111 -1.354224193 -1.373051833 [21] -1.390762317 -1.407339716 -1.422769965 -1.437040775 -1.450141701 [26] -1.462064157 -1.472801336 -1.482348272 -1.490701780 -1.497860461 [31] -1.503824640 -1.508596384 -1.512179425 -1.514579128 -1.515802478 [36] -1.515858035 -1.514755845 -1.512507449 -1.509125815 -1.504625250 [41] -1.499021421 -1.492331231 -1.484572809 -1.475765432 -1.465929450 [46] -1.455086269 -1.443258266 -1.430468724 -1.416741774 -1.402102340 [51] -1.386576077 -1.370189287 -1.352968891 -1.334942359 -1.316137624 [56] -1.296583049 -1.276307350 -1.255339556 -1.233708931 -1.211444912 [61] -1.188577082 -1.165135088 -1.141148591 -1.116647219 -1.091660532 [66] -1.066217945 -1.040348675 -1.014081694 -0.987445689 -0.960469010 [71] -0.933179631 -0.905605109 -0.82541 -0.849708278 -0.821438088 [76] -0.792987122 -0.764379898 -0.735640266 -0.706791393 -0.677855738 [81] -0.648855033 -0.619810274 -0.590741693 -0.561668758 -0.532610156 [86] -0.503583784 -0.474606745 -0.445695338 -0.416865062 -0.388130609 [91] -0.359505865 -0.331003918 -0.302637056 -0.274416782 -0.246353810 [96] -0.218458088 -0.190738802 -0.163204394 -0.135862573 -0.108720337 [101] -0.081783987 -0.055059152 -0.028550808 -0.002263304 0.023799613 [106] 0.049634774 0.075239551 0.100611836 0.125750005 0.150652886 [111] 0.175319722 0.199750141 0.223944116 0.247901927 0.271624125 [116] 0.295111492 0.318365000 0.341385774 0.364175049 0.386734130 [121] 0.409064353 0.431167045 0.453043480 0.474694850 0.496122212 [126] 0.517326465 0.538308303 0.559068185 0.579606300 0.599922532 [131] 0.620016432 0.639887183 0.659533578 0.678953988 0.698146340 [136] 0.716367156 0.734459833 0.752428741 0.770277372 0.788008310 [141] 0.805623188 0.823122667 0.840506396 0.857773019 0.874920094 [146] 0.891944162 0.908840641 0.925603903 0.942227205 0.958702728 [151] 0.975021541 0.991173645 1.007147946 1.022932278 1.038513449 [156] 1.053877190 1.069008243 1.083890313 1.098506181 1.112837647 [161] 1.126865608 1.140570088 1.153930270 1.166924526 1.179530477 [166] 1.191725035 1.203484451 1.214784382 1.225599912 1.235905642 [171] 1.245675755 1.254884072 1.263504095 1.271509107 1.278872248 [176] 1.285566555 1.291565077 1.296840902 1.301367293 1.305117743 [181] 1.308066011 1.310186290 1.311453212 1.311841963 1.311328350 [186] 1.309888930 1.307500999 1.304142758 1.299793348 1.294432925 [191] 1.288042752 1.280605267 1.272104143 1.262524364 1.251852272 [196] 1.240075658 1.227183764 1.213167403 1.198018950 1.181732402 [201] 1.164303440 1.145729407 1.126009401 1.105144212 1.083136426 [206] 1.059990384 1.035712188 1.010309729 0.983792617 0.956172242 [211] 0.927461713 0.897675875 0.866831225 0.834945955 0.802039881 [216] 0.768134393 0.733252445 0.697418506 0.660658502 0.622999781 [221] 0.584471057 0.545102363 0.504924994 0.463971453 0.422275398 [226] 0.379871580 0.336795792 0.293084805 0.248776314 0.203908880 [231] 0.158521870 0.112655403 0.066350293 0.019647991 -0.027409468 [236] -0.074779520 -0.122419124 -0.170284817 -0.218332766 -0.266518818 [241] -0.314798550 I convert it into a time series and then I get the CWT coefficients. Then I build the tree that exhibits only 3 branches (see attached plot) aats <- ts (aa, deltat =1/30, start = 0.0) aa.cwt <- wavCWT(aats) aa.tree <- wavCWTTree (aa.cwt) I can get the data for each of the 3 branches: > aa.tree[[1]] $itime [1] 135 135 134 133 132 130 128 126 123 122 122 122 122 123 126 $iscale [1] 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 $time [1] 4.47 4.47 4.43 4.40 4.37 4.30 4.23 4.17 [9] 4.07 4.03 4.03 4.03 4.03 4.07 4.17 $scale [1] 0.0333 0.0667 0.1000 0.1333 0.1667 0.2000 [7] 0.2333 0.2667 0.3000 0. 0.3667 0.4000 [13] 0.4333 0.4667 0.5000 $extrema [1] 0.001143350 0.004153357 0.009778222 0.018315375 0.030294895 0.046225772 [7] 0.066645451 0.092064228 0.122788334 0.158757578 0.199797960 0.245925327 [13] 0.297235272 0.354056031 0.417519487 > aa.tree[[2]] $itime [1] 202 202 202 202 202 202 202 202 202 202 205 $iscale [1] 1 2 3 4 5 6 7 8
[R] I: Help with wavCWTPeaks
-Messaggio originale- Da: [EMAIL PROTECTED] per conto di [EMAIL PROTECTED] Inviato: ven 05/12/2008 18.15 A: r-help@r-project.org Oggetto: [R] Help with wavCWTPeaks I cannot understand the following error printed out when I try to get the extrema of my time series. I would appreciate some suggestion as I really cannot interpret the error. I might not be using a proper set of parameters in calling such functions. I am learning by doing ... > aa.peak <- wavCWTPeaks (aa.tree) Error in `row.names<-.data.frame`(`*tmp*`, value = c("1", "0")) : invalid 'row.names' length My data vector is as follows: > aa [1] -0.852625404 -0.886941142 -0.920699269 -0.953858240 -0.986377090 [6] -1.018215725 -1.049335086 -1.079697274 -1.109265628 -1.138004782 [11] -1.165880733 -1.192860894 -1.218914146 -1.244010899 -1.268123116 [16] -1.291224432 -1.313290096 -1.334297111 -1.354224193 -1.373051833 [21] -1.390762317 -1.407339716 -1.422769965 -1.437040775 -1.450141701 [26] -1.462064157 -1.472801336 -1.482348272 -1.490701780 -1.497860461 [31] -1.503824640 -1.508596384 -1.512179425 -1.514579128 -1.515802478 [36] -1.515858035 -1.514755845 -1.512507449 -1.509125815 -1.504625250 [41] -1.499021421 -1.492331231 -1.484572809 -1.475765432 -1.465929450 [46] -1.455086269 -1.443258266 -1.430468724 -1.416741774 -1.402102340 [51] -1.386576077 -1.370189287 -1.352968891 -1.334942359 -1.316137624 [56] -1.296583049 -1.276307350 -1.255339556 -1.233708931 -1.211444912 [61] -1.188577082 -1.165135088 -1.141148591 -1.116647219 -1.091660532 [66] -1.066217945 -1.040348675 -1.014081694 -0.987445689 -0.960469010 [71] -0.933179631 -0.905605109 -0.82541 -0.849708278 -0.821438088 [76] -0.792987122 -0.764379898 -0.735640266 -0.706791393 -0.677855738 [81] -0.648855033 -0.619810274 -0.590741693 -0.561668758 -0.532610156 [86] -0.503583784 -0.474606745 -0.445695338 -0.416865062 -0.388130609 [91] -0.359505865 -0.331003918 -0.302637056 -0.274416782 -0.246353810 [96] -0.218458088 -0.190738802 -0.163204394 -0.135862573 -0.108720337 [101] -0.081783987 -0.055059152 -0.028550808 -0.002263304 0.023799613 [106] 0.049634774 0.075239551 0.100611836 0.125750005 0.150652886 [111] 0.175319722 0.199750141 0.223944116 0.247901927 0.271624125 [116] 0.295111492 0.318365000 0.341385774 0.364175049 0.386734130 [121] 0.409064353 0.431167045 0.453043480 0.474694850 0.496122212 [126] 0.517326465 0.538308303 0.559068185 0.579606300 0.599922532 [131] 0.620016432 0.639887183 0.659533578 0.678953988 0.698146340 [136] 0.716367156 0.734459833 0.752428741 0.770277372 0.788008310 [141] 0.805623188 0.823122667 0.840506396 0.857773019 0.874920094 [146] 0.891944162 0.908840641 0.925603903 0.942227205 0.958702728 [151] 0.975021541 0.991173645 1.007147946 1.022932278 1.038513449 [156] 1.053877190 1.069008243 1.083890313 1.098506181 1.112837647 [161] 1.126865608 1.140570088 1.153930270 1.166924526 1.179530477 [166] 1.191725035 1.203484451 1.214784382 1.225599912 1.235905642 [171] 1.245675755 1.254884072 1.263504095 1.271509107 1.278872248 [176] 1.285566555 1.291565077 1.296840902 1.301367293 1.305117743 [181] 1.308066011 1.310186290 1.311453212 1.311841963 1.311328350 [186] 1.309888930 1.307500999 1.304142758 1.299793348 1.294432925 [191] 1.288042752 1.280605267 1.272104143 1.262524364 1.251852272 [196] 1.240075658 1.227183764 1.213167403 1.198018950 1.181732402 [201] 1.164303440 1.145729407 1.126009401 1.105144212 1.083136426 [206] 1.059990384 1.035712188 1.010309729 0.983792617 0.956172242 [211] 0.927461713 0.897675875 0.866831225 0.834945955 0.802039881 [216] 0.768134393 0.733252445 0.697418506 0.660658502 0.622999781 [221] 0.584471057 0.545102363 0.504924994 0.463971453 0.422275398 [226] 0.379871580 0.336795792 0.293084805 0.248776314 0.203908880 [231] 0.158521870 0.112655403 0.066350293 0.019647991 -0.027409468 [236] -0.074779520 -0.122419124 -0.170284817 -0.218332766 -0.266518818 [241] -0.314798550 I convert it into a time series and then I get the CWT coefficients. Then I build the tree that exhibits only 3 branches (see attached plot) aats <- ts (aa, deltat =1/30, start = 0.0) aa.cwt <- wavCWT(aats) aa.tree <- wavCWTTree (aa.cwt) I can get the data for each of the 3 branches: > aa.tree[[1]] $itime [1] 135 135 134 133 132 130 128 126 123 122 122 122 122 123 126 $iscale [1] 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 $time [1] 4.47 4.47 4.43 4.40 4.37 4.30 4.23 4.17 [9] 4.07 4.03 4.03 4.03 4.03 4.07 4.17 $scale [1] 0.0333 0.0667 0.1000 0.1333 0.1667 0.2000 [7] 0.2333 0.2667 0.3000 0. 0.3667 0.4000 [13] 0.4333 0.4667 0.5000 $extrema [1] 0.001143350 0.004153357 0.009778222 0.018315375 0.030294895 0.046225772 [7] 0.066645451 0.092064228 0.122788334 0.15875757
[R] R: Morlet wavelet not supportd by wavCWTPeaks
Sure. Now it works ... but it is a different signal ! I could not understand how the signal I sent was modified. So I plotted yours version of the signal and mine (see attachments). My signal represent a single breathing cycle extracted from a breathing signal. It shows that the individual completed one respiratory cycle in about 8 seconds, so he/she is breathing very deeply and slowly. Whereas you transformed it into the breathing pattern of someone who can complete almost 5 respiratory cycles within 8 seconds, therefore breathing at a much higher rate ... maybe short of breath. The whole original signal can be seen on my web site: http://trusoftdev.za.net/maura/Breathing-Signals-Dir/Signals-Dir/3570-Dir/Plots-Dir/3570-Original-PureSignal.pdf Bottomline: I need a package that helps me shed light onto the original signals I was given. I cannot alter the signals in order to make the package work. I need to analyze true signals not fake ones. If wmTSA cannot work on non-periodic signals then it should be stated in the on-line documentation. Any suggestion ? Thank you very much. Maura -Messaggio originale- Da: stephen sefick [mailto:[EMAIL PROTECTED] Inviato: sab 06/12/2008 8.25 A: [EMAIL PROTECTED] Cc: R-help Oggetto: Re: Morlet wavelet not supportd by wavCWTPeaks aa <- (structure(list(X.0.85 = c(-1.02, -1.17, -1.29, -1.39, -1.46, -1.5, -1.52, -1.5, -1.46, -1.39, -1.3, -1.19, -1.07, -0.93, -0.79, -0.65, -0.5, -0.36, -0.22, -0.08, 0.05, 0.18, 0.3, 0.41, 0.52, 0.62, 0.72, 0.81, 0.89, 0.98, 1.05, 1.13, 1.19, 1.25, 1.29, 1.31, 1.31, 1.29, 1.24, 1.16, 1.06, 0.93, 0.77, 0.58, 0.38, 0.16, -0.07, -0.31, -0.89, -1.05, -1.19, -1.31, -1.41, -1.47, -1.51, -1.51, -1.49, -1.44, -1.37, -1.28, -1.17, -1.04, -0.91, -0.76, -0.62, -0.47, -0.33, -0.19, -0.06, 0.08, 0.2, 0.32, 0.43, 0.54, 0.64, 0.73, 0.82, 0.91, 0.99, 1.07, 1.14, 1.2, 1.25, 1.29, 1.31, 1.31, 1.28, 1.23, 1.15, 1.04, 0.9, 0.73, 0.55, 0.34, 0.11, -0.12, -0.92, -1.08, -1.22, -1.33, -1.42, -1.48, -1.51, -1.51, -1.48, -1.43, -1.35, -1.26, -1.14, -1.01, -0.88, -0.74, -0.59, -0.45, -0.3, -0.16, -0.03, 0.1, 0.22, 0.34, 0.45, 0.56, 0.66, 0.75, 0.84, 0.93, 1.01, 1.08, 1.15, 1.21, 1.26, 1.3, 1.31, 1.3, 1.27, 1.21, 1.13, 1.01, 0.87, 0.7, 0.5, 0.29, 0.07, -0.17, -0.95, -1.11, -1.24, -1.35, -1.44, -1.49, -1.51, -1.51, -1.48, -1.42, -1.33, -1.23, -1.12, -0.99, -0.85, -0.71, -0.56, -0.42, -0.27, -0.14, 0, 0.13, 0.25, 0.36, 0.47, 0.58, 0.68, 0.77, 0.86, 0.94, 1.02, 1.1, 1.17, 1.23, 1.27, 1.3, 1.31, 1.3, 1.26, 1.2, 1.11, 0.98, 0.83, 0.66, 0.46, 0.25, 0.02, -0.22, -0.99, -1.14, -1.27, -1.37, -1.45, -1.5, -1.52, -1.5, -1.47, -1.4, -1.32, -1.21, -1.09, -0.96, -0.82, -0.68, -0.53, -0.39, -0.25, -0.11, 0.02, 0.15, 0.27, 0.39, 0.5, 0.6, 0.7, 0.79, 0.87, 0.96, 1.04, 1.11, 1.18, 1.24, 1.28, 1.31, 1.31, 1.29, 1.25, 1.18, 1.08, 0.96, 0.8, 0.62, 0.42, 0.2, -0.03, -0.27)), .Names = "X.0.85", class = "data.frame", row.names = c(NA, -240L))) library(wmtsa) library(fields) aats <- ts (aa, deltat =1/30, start = 0.0) aa.cwt <- wavCWT(aats) aa.tree <- wavCWTTree (aa.cwt) aa.peak <- wavCWTPeaks(aa.tree) sorry I didn't realize that only the mexican hat wavelet could be used for the peak function. This should work fine. and Use the tim.colors argument in the plot() function. I hope this helps This reason I suggested the morlet wavelet is that it is compactly suppoted On Sat, Dec 6, 2008 at 1:39 AM, <[EMAIL PROTECTED]> wrote: > aa.cwt <- wavCWT(aats,wavelet="morlet") >> aa.cwt > Continuous Wavelet Transform of aats > > Wavelet : Morlet > Wavelet frequency shift : 5 (rad/sec) > Length of series: 241 > Sampling interval : 0.0333 > Number of scales: 65 > Range of scales : 0.0333 to 8.03 >> aa.cwt.coef <- as.matrix (aa.cwt) >>plot (aa.cwt, series=TRUE) >> plot (aa.cwt, type="persp") > >> aa.tree <- wavCWTTree (aa.cwt) >> aa.peak <- wavCWTPeaks (aa.tree) > Error in wavCWTPeaks(aa.tree) : > Only CWT developed using the Mexican hat (gaussian2) filter are supported >> > > Alice Messenger ;-) chatti anche con gli amici di Windows Live Messenger e > tutti i telefonini TIM! > Vai su http://maileservizi.alice.it/alice_messenger/index.html?pmk=footer -- Stephen Sefick Let's not spend our time and resources thinking about things that are so little or so large that all they really do for us is puff us up and make us feel like gods. We are mammals, and have not exhausted the annoying little problems of being mammals. -K. Mullis Alice Messenger ;-) chatti anche con gli amici di Windows Live Messenger e tutti i telefonini TIM! Vai su http://maileservizi.alice.it/alice_messenger/index.html?pmk=footer __ R-help@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.h
[R] R: R: Morlet wavelet not supportd by wavCWTPeaks
I have compressed and attached the 1st cycle of signal 3570. I did not realize the difficulties arising from copying the signal data from the email text. I did not understand how you were reading such data into a vector. When I plotted the signal, the way you read it, it looked periodic, whereas the original is not. Since wmTSA functions worked fine with your signal version, I inferred that wavCWTPeaks expects a periodic input series. Consequently I generated a signal through duplicating the original 1-cycle data. So my new signal contains two consecutive cycles which are equal. This way wavCWTPeaks worked and fund the extrema. I realized I modified the original 1-cycle signal myself. I did not alter the breathing rate or the cycle pattern in any way. Since the goal is to find the extrema, all what I expected is to see a set of replicated extrema at corresponding time points. But wavCWTPeaks is probably smart enough as to dispose of duplicated extrema. I sent you a detailed description of this experiment from another account. I am still concerned about wavCWTPeaks working on a duplicated version of the original 1-cycle signal that it cannot process. If periodicity is not the key reason then I don't get it. Can you suggest a better procedure to get the 1-cycle extrema without using the trick I resorted to ? Best regards, Maura -Messaggio originale- Da: stephen sefick [mailto:[EMAIL PROTECTED] Inviato: sab 06/12/2008 18.14 A: [EMAIL PROTECTED] Cc: R-help Oggetto: Re: R: Morlet wavelet not supportd by wavCWTPeaks Now, wavelet analysis works with non-stationary signals the package is an implememtation of wavelet analysis. The signal that I used was the one that you provided. I did copy it out of an email and put it together into a vector so that I could read it in. If the original data is wrong that is probably my fault, but you need to provide data that can be just read into R without the potential of screwing up the content- see dput(). That way you get the best help possible with the least amount of work on the lists part. Please send me the real signal and maybe we can work it out. If wmtsa is not going to work then it is not going to work. Find something else that work or write your own package. Stephen On Sat, Dec 6, 2008 at 4:57 AM, <[EMAIL PROTECTED]> wrote: > Sure. Now it works ... but it is a different signal ! > I could not understand how the signal I sent was modified. So I plotted > yours version of the signal and mine (see attachments). > My signal represent a single breathing cycle extracted from a breathing > signal. It shows that the individual completed one respiratory cycle > in about 8 seconds, so he/she is breathing very deeply and slowly. > Whereas you transformed it into the breathing pattern of someone who can > complete almost 5 respiratory cycles within 8 seconds, therefore breathing > at a much higher rate ... maybe short of breath. > The whole original signal can be seen on my web site: > http://trusoftdev.za.net/maura/Breathing-Signals-Dir/Signals-Dir/3570-Dir/Plots-Dir/3570-Original-PureSignal.pdf > > Bottomline: I need a package that helps me shed light onto the original > signals I was given. I cannot alter the signals in order to make the package > work. > I need to analyze true signals not fake ones. > If wmTSA cannot work on non-periodic signals then it should be stated in the > on-line documentation. > Any suggestion ? > > Thank you very much. > Maura > > -Messaggio originale- > Da: stephen sefick [mailto:[EMAIL PROTECTED] > Inviato: sab 06/12/2008 8.25 > A: [EMAIL PROTECTED] > Cc: R-help > Oggetto: Re: Morlet wavelet not supportd by wavCWTPeaks > > aa <- (structure(list(X.0.85 = c(-1.02, -1.17, -1.29, -1.39, -1.46, > -1.5, -1.52, -1.5, -1.46, -1.39, -1.3, -1.19, -1.07, -0.93, -0.79, > -0.65, -0.5, -0.36, -0.22, -0.08, 0.05, 0.18, 0.3, 0.41, 0.52, > 0.62, 0.72, 0.81, 0.89, 0.98, 1.05, 1.13, 1.19, 1.25, 1.29, 1.31, > 1.31, 1.29, 1.24, 1.16, 1.06, 0.93, 0.77, 0.58, 0.38, 0.16, -0.07, > -0.31, -0.89, -1.05, -1.19, -1.31, -1.41, -1.47, -1.51, -1.51, > -1.49, -1.44, -1.37, -1.28, -1.17, -1.04, -0.91, -0.76, -0.62, > -0.47, -0.33, -0.19, -0.06, 0.08, 0.2, 0.32, 0.43, 0.54, 0.64, > 0.73, 0.82, 0.91, 0.99, 1.07, 1.14, 1.2, 1.25, 1.29, 1.31, 1.31, > 1.28, 1.23, 1.15, 1.04, 0.9, 0.73, 0.55, 0.34, 0.11, -0.12, -0.92, > -1.08, -1.22, -1.33, -1.42, -1.48, -1.51, -1.51, -1.48, -1.43, > -1.35, -1.26, -1.14, -1.01, -0.88, -0.74, -0.59, -0.45, -0.3, > -0.16, -0.03, 0.1, 0.22, 0.34, 0.45, 0.56, 0.66, 0.75, 0.84, > 0.93, 1.01, 1.08, 1.15, 1.21, 1.26, 1.3, 1.31, 1.3, 1.27, 1.21, > 1.13, 1.01, 0.87, 0.7, 0.5, 0.29, 0.07, -0.17, -0.95, -1.11, > -1.24, -1.35, -1.44, -1.49, -1.51, -1.51, -1.48, -1.42, -1.33, > -1.23, -1.12, -0.99, -0.85, -0.71, -0.56, -0.42, -0.27, -0.14, > 0, 0.13, 0.25, 0.36, 0.47, 0.58, 0.68, 0.77, 0.86, 0.94, 1.02, > 1.1, 1.17, 1.23, 1.27, 1.3, 1.31, 1.3, 1.26, 1.2, 1.11, 0.98, > 0.83, 0.66, 0.46, 0.25, 0.02, -0.22, -0.99, -1.14, -1.27
[R] package "wmtsa": wavCWTPeaks error
I keep getting the following error when I look for minima in the series: > aa.peak <- wavCWTPeaks (aa.tree) Error in `row.names<-.data.frame`(`*tmp*`, value = c("1", "0")) : invalid 'row.names' length How can I work it around ? Thank you. Regards, Maura Alice Messenger ;-) chatti anche con gli amici di Windows Live Messenger e tutti i telefonini TIM! Vai su http://maileservizi.alice.it/alice_messenger/index.html?pmk=footer __ R-help@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.
[R] Sorry, I have attached the data - Here is the code that causes wavCWTPeaks error
-Messaggio originale- Da: [EMAIL PROTECTED] Inviato: mar 09/12/2008 13.52 A: stephen sefick; Francesco Masulli; Stefano Rovetta Cc: [EMAIL PROTECTED]; [EMAIL PROTECTED]; [EMAIL PROTECTED] Oggetto: Here is the code that causes wavCWTPeaks error aats <- create.signalSeries(aa, pos=list(from=0.0, by=0.033)) aa.cwt <- wavCWT(aats) x11 (width=10,height=12) plot (aats,main=paste(insig," Cycle: ",j,sep="")) aa.maxtree <- wavCWTTree (aa.cwt, type="maxima") aa.mintree <- wavCWTTree (aa.cwt, type="minima") aa.maxpeak <- wavCWTPeaks (aa.maxtree) aa.minpeak <- wavCWTPeaks (aa.mintree) Error in `row.names<-.data.frame`(`*tmp*`, value = c("1", "0")) : invalid 'row.names' length bb <- -aa #EXCHANGE MAXIMA WITH MINIMA bbts <- create.signalSeries(bb, pos=list(from=0.0, by=0.033)) plot (bbts,main=paste(insig," Cycle: ",j,sep="")) plot (bbts,main=paste(insig," Cycle: ",j,sep="")) bb.cwt <- wavCWT(bbts) bb.maxtree <- wavCWTTree (bb.cwt, type="maxima") bb.mintree <- wavCWTTree (bb.cwt, type="minima") bb.maxpeak <- wavCWTPeaks (bb.maxtree) Error in `row.names<-.data.frame`(`*tmp*`, value = c("1", "0")) : invalid 'row.names' length bb.minpeak <- wavCWTPeaks (bb.mintree) Error in `row.names<-.data.frame`(`*tmp*`, value = c("1", "0")) : invalid 'row.names' length Attached are "aa" breathing cycle amplitude values (zip compressed) I'd like to figure out what is wrong with my data. wmTSA documentation does not mention any time series constraint. Thank you in advance. Kind regards, Maura -Messaggio originale- Da: stephen sefick [mailto:[EMAIL PROTECTED] Inviato: mar 09/12/2008 8.11 A: [EMAIL PROTECTED] Cc: [EMAIL PROTECTED]; [EMAIL PROTECTED]; [EMAIL PROTECTED] Oggetto: Re: [R] package "wmtsa": wavCWTPeaks error Are the names of the rows the same as the time series that you are using? I know that I am not being that helpful, but this seems like a mismatch in the time series object. look at length(rowname(your.data)) length(your.data[,1]) again it is always helpful to have reproducible code. On Tue, Dec 9, 2008 at 1:39 AM, <[EMAIL PROTECTED]> wrote: > I keep getting the following error when I look for minima in the series: > >> aa.peak <- wavCWTPeaks (aa.tree) > Error in `row.names<-.data.frame`(`*tmp*`, value = c("1", "0")) : > invalid 'row.names' length > > How can I work it around ? > > Thank you. > > Regards, > Maura > > > Alice Messenger ;-) chatti anche con gli amici di Windows Live Messenger e > tutti i telefonini TIM! > Vai su http://maileservizi.alice.it/alice_messenger/index.html?pmk=footer > > __ > R-help@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. > > -- Stephen Sefick Let's not spend our time and resources thinking about things that are so little or so large that all they really do for us is puff us up and make us feel like gods. We are mammals, and have not exhausted the annoying little problems of being mammals. -K. Mullis Alice Messenger ;-) chatti anche con gli amici di Windows Live Messenger e tutti i telefonini TIM! Vai su http://maileservizi.alice.it/alice_messenger/index.html?pmk=footer Alice Messenger ;-) chatti anche con gli amici di Windows Live Messenger e tutti i telefonini TIM! Vai su http://maileservizi.alice.it/alice_messenger/index.html?pmk=footer __ R-help@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.
[R] R: Sorry, I have attached the data - Here is the code that causes wavCWTPeaks error
Maxima are found if I prolong the 1-cycle time series on both sides, appaently no matter which values I use. The following sequence works fine: aal <- rep (aa[1], length(aa)) aar <- rep (aa[length(aa)], length(aa)) aa3 <- c(aal,aa,aar) #APPEND CYCLE TO ITSELF TWICE aa3ts <- create.signalSeries(aa3, pos=list(from=0.0, by=0.033)) #CONVERT AMPLITUDE INTO TIME-SERIES plot (aa3ts, main=paste(insig," Cycle: ",j,sep="")) aa3.cwt <- wavCWT(aa3ts) #CWT aa3.maxtree <- wavCWTTree (aa3.cwt, type="maxima")# GENERATE CWT MAXIMA TREE aa3.maxpeak <- wavCWTPeaks (aa3.maxtree)#GET MAXIMUM PEAK Since the minima of aa are the maxima of -aa I reverse the sign and then repeat the above procedure. The following sequence works fine: ## EXCHANGE MAXIMA WITH MINIMA bb <- -aa #REVERSE SIGN bbl <- rep (bb[1], length(bb))\ bbr <- rep (bb[length(bb)], length(bb)) bb3 <- c(bbl,bb,bbr) #APPEND CYCLE TO ITSELF TWICE bb3ts <- create.signalSeries(bb3, pos=list(from=0.0, by=0.033)) #CONVERT AMPLITUDE INTO TIME-SERIES plot (bb3ts, main=paste(insig," Cycle: ",j,sep="")) bb3.cwt <- wavCWT(bb3ts) #CWT bb3.maxtree <- wavCWTTree (bb3.cwt, type="maxima") #GENERATE CWT MAXIMA TREE bb3.maxpeak <- wavCWTPeaks (bb3.maxtree)#GET MAXIMUM PEAKS It looks like wmTSA functions work like the Moving Average algorithm which uses a portion of the time series for kind of self-training Best regards, Maura -Messaggio originale- Da: stephen sefick [mailto:[EMAIL PROTECTED] Inviato: mar 09/12/2008 16.15 A: [EMAIL PROTECTED] Cc: Francesco Masulli; Stefano Rovetta; [EMAIL PROTECTED]; [EMAIL PROTECTED]; [EMAIL PROTECTED] Oggetto: Re: Sorry, I have attached the data - Here is the code that causes wavCWTPeaks error I'm stumped. On Tue, Dec 9, 2008 at 7:53 AM, <[EMAIL PROTECTED]> wrote: > > -Messaggio originale- > Da: [EMAIL PROTECTED] > Inviato: mar 09/12/2008 13.52 > A: stephen sefick; Francesco Masulli; Stefano Rovetta > Cc: [EMAIL PROTECTED]; [EMAIL PROTECTED]; > [EMAIL PROTECTED] > Oggetto: Here is the code that causes wavCWTPeaks error > > aats <- create.signalSeries(aa, pos=list(from=0.0, by=0.033)) > aa.cwt <- wavCWT(aats) > x11 (width=10,height=12) > plot (aats,main=paste(insig," Cycle: ",j,sep="")) > aa.maxtree <- wavCWTTree (aa.cwt, type="maxima") > aa.mintree <- wavCWTTree (aa.cwt, type="minima") > aa.maxpeak <- wavCWTPeaks (aa.maxtree) > aa.minpeak <- wavCWTPeaks (aa.mintree) > Error in `row.names<-.data.frame`(`*tmp*`, value = c("1", "0")) : > invalid 'row.names' length > bb <- -aa #EXCHANGE MAXIMA WITH MINIMA > bbts <- create.signalSeries(bb, pos=list(from=0.0, by=0.033)) > plot (bbts,main=paste(insig," Cycle: ",j,sep="")) > plot (bbts,main=paste(insig," Cycle: ",j,sep="")) > bb.cwt <- wavCWT(bbts) > bb.maxtree <- wavCWTTree (bb.cwt, type="maxima") > bb.mintree <- wavCWTTree (bb.cwt, type="minima") > bb.maxpeak <- wavCWTPeaks (bb.maxtree) > Error in `row.names<-.data.frame`(`*tmp*`, value = c("1", "0")) : > invalid 'row.names' length > bb.minpeak <- wavCWTPeaks (bb.mintree) > Error in `row.names<-.data.frame`(`*tmp*`, value = c("1", "0")) : > invalid 'row.names' length > > Attached are "aa" breathing cycle amplitude values (zip compressed) > I'd like to figure out what is wrong with my data. > wmTSA documentation does not mention any time series constraint. > > Thank you in advance. > Kind regards, > Maura > > -Messaggio originale- > Da: stephen sefick [mailto:[EMAIL PROTECTED] > Inviato: mar 09/12/2008 8.11 > A: [EMAIL PROTECTED] > Cc: [EMAIL PROTECTED]; [EMAIL PROTECTED]; > [EMAIL PROTECTED] > Oggetto: Re: [R] package "wmtsa": wavCWTPeaks error > > Are the names of the rows the same as the time series that you are > using? I know that I am not being that helpful, but this seems like a > mismatch in the time series object. look at > length(rowname(your.data)) > length(your.data[,1]) > > again it is always helpful to have reproducible code. > > On Tue, Dec 9, 2008 at 1:39 AM, <[EMAIL PROTECTED]> wrote: >> I keep getting the following error when I look for minima in the series: >> >>> aa.peak <- wavCWTPeaks (aa.tree) >> Error in `row.names<-.data.frame`(`*tmp*`, value = c("1", "0")) : >> invalid 'row.names' length >> >> How can I work it around ? >> >> Thank you. >> >> Regards, >> Maura >> >> >> Alice Messenger ;-) chatti anche con gli amici di Windows Live Messenger e >> tutti i telefonini TIM! >> Vai su http://maileservizi.alice.it/alice_messenger/index.html?pmk=footer >>
[R] Here is the code that causes wavCWTPeaks error
aats <- create.signalSeries(aa, pos=list(from=0.0, by=0.033)) aa.cwt <- wavCWT(aats) x11 (width=10,height=12) plot (aats,main=paste(insig," Cycle: ",j,sep="")) aa.maxtree <- wavCWTTree (aa.cwt, type="maxima") aa.mintree <- wavCWTTree (aa.cwt, type="minima") aa.maxpeak <- wavCWTPeaks (aa.maxtree) aa.minpeak <- wavCWTPeaks (aa.mintree) Error in `row.names<-.data.frame`(`*tmp*`, value = c("1", "0")) : invalid 'row.names' length bb <- -aa #EXCHANGE MAXIMA WITH MINIMA bbts <- create.signalSeries(bb, pos=list(from=0.0, by=0.033)) plot (bbts,main=paste(insig," Cycle: ",j,sep="")) plot (bbts,main=paste(insig," Cycle: ",j,sep="")) bb.cwt <- wavCWT(bbts) bb.maxtree <- wavCWTTree (bb.cwt, type="maxima") bb.mintree <- wavCWTTree (bb.cwt, type="minima") bb.maxpeak <- wavCWTPeaks (bb.maxtree) Error in `row.names<-.data.frame`(`*tmp*`, value = c("1", "0")) : invalid 'row.names' length bb.minpeak <- wavCWTPeaks (bb.mintree) Error in `row.names<-.data.frame`(`*tmp*`, value = c("1", "0")) : invalid 'row.names' length Attached are "aa" breathing cycle amplitude values (zip compressed) I'd like to figure out what is wrong with my data. wmTSA documentation does not mention any time series constraint. Thank you in advance. Kind regards, Maura -Messaggio originale- Da: stephen sefick [mailto:[EMAIL PROTECTED] Inviato: mar 09/12/2008 8.11 A: [EMAIL PROTECTED] Cc: [EMAIL PROTECTED]; [EMAIL PROTECTED]; [EMAIL PROTECTED] Oggetto: Re: [R] package "wmtsa": wavCWTPeaks error Are the names of the rows the same as the time series that you are using? I know that I am not being that helpful, but this seems like a mismatch in the time series object. look at length(rowname(your.data)) length(your.data[,1]) again it is always helpful to have reproducible code. On Tue, Dec 9, 2008 at 1:39 AM, <[EMAIL PROTECTED]> wrote: > I keep getting the following error when I look for minima in the series: > >> aa.peak <- wavCWTPeaks (aa.tree) > Error in `row.names<-.data.frame`(`*tmp*`, value = c("1", "0")) : > invalid 'row.names' length > > How can I work it around ? > > Thank you. > > Regards, > Maura > > > Alice Messenger ;-) chatti anche con gli amici di Windows Live Messenger e > tutti i telefonini TIM! > Vai su http://maileservizi.alice.it/alice_messenger/index.html?pmk=footer > > __ > R-help@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. > > -- Stephen Sefick Let's not spend our time and resources thinking about things that are so little or so large that all they really do for us is puff us up and make us feel like gods. We are mammals, and have not exhausted the annoying little problems of being mammals. -K. Mullis Alice Messenger ;-) chatti anche con gli amici di Windows Live Messenger e tutti i telefonini TIM! Vai su http://maileservizi.alice.it/alice_messenger/index.html?pmk=footer [[alternative HTML version deleted]] __ R-help@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.
[R] R scripts and parameters
A couple of weeks ago I asked how it is possible to run an R script (not a function) passing some parameters. Someone suggested the function "commandArgs()". I read the on-line help and found no clarifying example. Therefore I do not know how to use it appropriately. I noticed this function returns the pathname of the R executable which is not what I need. I meant to ask if it is possible to open an R session and launch a script passing parameters that the script can retrieve and use itself. Just like in C I can run a program and call it with some arguments > Example_Prog A B C The program "Example_Prog" can acess its own arguments through the data structures "argc" an "argv". How can I launch an R script simulating the above mechanism ? Shall I use source ("script-name") ? Where are the arguments to be passed, as part of the source call ? Is the function "commandArgs" to be places as one of the first code lines of the script in order to access its own arguments ? Is there any "commandArgs" usage example ? Thank you very much in advance. Maura tutti i telefonini TIM! [[alternative HTML version deleted]] __ R-help@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.
[R] Index-G1 error
I am using some functions from package clusterSim to evaluate the best clusters layout. Here is the features vector I am using to cluater 12 signals: > alpha.vec [1] 0.8540039 0.8558350 0.8006592 0.8066406 0.8322754 0.8991699 0.8212891 [8] 0.8815918 0.9050293 0.9174194 0.8613281 0.8425293 In the following I pasted an excerpt of my program: library(clusterSim) setwd("C:/Documents and Settings/Monville/SpAn-Tests/Signals-Classification-Dir/Classification-by-Signal-Dir") ## LOAD DONOHO ALPHA FILE features.tab <- read.table("Signals-Alpha-and-Zero-Moments.txt",header=T) ## EXTRACT SIGNALS ID insig <- features.tab[,"SignalID"] ## GENERATE DISTANCE MATRIX LABELS rwn <- NULL for(i in 1:length(insig)) { rwn <- c(rwn,as.character(insig[i])) } ## EXTRACT FEATURES VECTOR alpha.vec <- features.tab[,"Signal_Donoho_Alpha"] ## CALCULATE DISTANCE MATRIX - EUCLIDEAN DISTANCE ## ATTACH SIGNAL LABELS dist.mat <- dist(as.matrix(alpha.vec),method = "euclidean") yy <- as.matrix(dist.mat) rownames(yy) <- rwn nc.min <- 2#MINIMUM CLUSTERS NUM. nc.max <- length(alpha.vec) -1 #MAXIMUM CLUSTERS NUM. ## - PAM - INDEX.G1 -- res <- array(0,c(nc.max - nc.min +1,2)) res[,1] <- nc.min:nc.max clusters <- NULL for (nc in nc.min:nc.max) { cl <- pam(dist.mat,nc,diss=TRUE) res[nc-nc.min+1,2] <- G1 <- index.G1(as.matrix(alpha.vec),cl$cluster,d=dist.mat,centrotypes="medoids") clusters <- rbind(clusters, cl$cluster) } ### I get the following error whenever I use index.G1: > nc <- 2 > cl <- pam(dist.mat,nc,diss=TRUE) > cl Medoids: ID [1,] 5 5 [2,] 9 9 Clustering vector: [1] 1 1 1 1 1 2 1 2 2 2 1 1 Objective function: build swap 0.01873272 0.01620992 Available components: [1] "medoids""id.med" "clustering" "objective" "isolation" [6] "clusinfo" "silinfo""diss" "call" > ndex.G1(as.matrix(alpha.vec),cl$cluster,d=dist.mat,centrotypes="medoids") Error: could not find function "ndex.G1" > index.G1(as.matrix(alpha.vec),cl$cluster,d=dist.mat,centrotypes="medoids") Error in centers[i, ] <- .medoid(x[cl == i, ], d[cl == i, cl == i]) : number of items to replace is not a multiple of replacement length Please, notice that the same code work if I call index.G2, index.G3, index.S Whay it doesn't work with index.G1 ? Thank you very much. Maura tutti i telefonini TIM! [[alternative HTML version deleted]] __ R-help@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.
[R] R: R scripts and parameters
Sorry. This is still unclear to me. I generated a file called "Test.R" that contains the following lines: commandArgs(TRUE) cat("\n A = ",A,"\n") cat("\n B = ",B,"\n") cat("\n C = ",C,"\n") First of all I have to clarify which command line we are talking about. If I run the command "Rscript" from a Windows terminal, the system does not recognize such a command: C:\Documents and Settings\Monville\Utilities-Dir>Rscript Test.R aa bb cc "Rscript" non è riconosciuto come comando interno o esterno, un programma eseguibile o un file batch. The above system response tells me that Rscript is not recognized either as an internal or external command, an executable or a batch file. In fact Rscript is an R command. Nevertheless, I started an R session and tried such a command from R console command line and got the following: > getwd() [1] "C:/Documents and Settings/Monville/Utilities-Dir" > Rscript Test.R aa bb cc Error: unexpected symbol in "Rscript Test.R" I feel I do not have a good grasp of how to run R scripts the same way as I usually run C programs. Any help is welcome. Thank you. Maura -Messaggio originale- Da: Duncan Murdoch [mailto:murd...@stats.uwo.ca] Inviato: mar 17/02/2009 17.34 A: mau...@alice.it Cc: r-h...@stat.math.ethz.ch Oggetto: Re: [R] R scripts and parameters On 2/17/2009 10:55 AM, mau...@alice.it wrote: > A couple of weeks ago I asked how it is possible to run an R script (not a > function) passing some parameters. > Someone suggested the function "commandArgs()". > I read the on-line help and found no clarifying example. Therefore I do not > know how to use it appropriately. > I noticed this function returns the pathname of the R executable which is not > what I need. > > I meant to ask if it is possible to open an R session and launch a script > passing parameters that the script can retrieve and use itself. > Just like in C I can run a program and call it with some arguments > >> Example_Prog A B C > > The program "Example_Prog" can acess its own arguments through the data > structures "argc" an "argv". > > How can I launch an R script simulating the above mechanism ? > Shall I use source ("script-name") ? > Where are the arguments to be passed, as part of the source call ? > Is the function "commandArgs" to be places as one of the first code lines of > the script in order to access its own arguments ? > Is there any "commandArgs" usage example ? Gabor gave you a solution from within R. If you want to run a script from the command line, then use commandArgs(TRUE). For example, put this into the file test.R: commandArgs(TRUE) (The TRUE says you only want to see the trailing arguments, not everything else on the command line.) Then from the command line, do Rscript test.R A B C and you'll see the output [1] "A" "B" "C" Duncan Murdoch tutti i telefonini TIM! [[alternative HTML version deleted]] __ R-help@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.
[R] package "wavelets" does nor recognize filter "d2"
I take the liberty of pasting the on-line documentation for package "wavelets", functions "dwt" and "wt.filter", pertinent to the wavelet/filter choice. While I apologize for my verbose messages with huge attachments, I encourage whoever loads packages to CRAN to take some minutes to reread the attached documentation. Usage dwt(X, filter="la8", n.levels, boundary="periodic", fast=TRUE) filter Either a wt.filter object, a character string indicating which wavelet filter to use in the decomposition, or a numeric vector of wavelet coefficients (not scaling coefficients). See help(wt.filter) for acceptable filter names wt.filter(filter="la8", modwt=FALSE) Arguments filter A character string indicating which wavelet transform filter to compute Details The character strings currently supported are derived from one of four classes of wavelet transform filters: Daubechies, Least Asymetric, Best Localized and Coiflet. The prefixes for filters of these classes are d, la, bl and c, respectively. Following the prefix, the filter name consists of an integer indicating length. Supported lengths are as follows: Daubechies 2,4,6,8,10,12,14,16,18,20. Least Asymetric 8,10,12,14,16,18,20. Now let's try to pick filter "d2" > X1 <- c(.2,-.4,-.6,-.5,-.8,-.4,-.9,0,-.2,.1,-.1,.1,.7,.9,0,.3) > X2 <- c(.2,-.4,-.6,-.5,-.8,-.4,-.9,0,-.2,.1,-.1,.1,-.7,.9,0,.3) > > # combine them and compute DWT > newX <- cbind(X1,X2) > wt <- dwt(newX,filter="d2", n.levels=3, boundary="reflection", fast=FALSE) Error in wt.filter(filter) : Invalid filter name. > wt.filter("d2") Error in wt.filter("d2") : Invalid filter name. Regards, Maura tutti i telefonini TIM! [[alternative HTML version deleted]] __ R-help@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.
[R] problems in package "wavelets" function "wt.filter"
> wt.filter("d8") Error in validObject(.Object) : invalid class "wt.filter" object: invalid object for slot "transform" in class "wt.filter": got class "function", should be or extend class "character" How come ? The above function works fine with the other Daubechies filters. Thank you. Best regards, Maura tutti i telefonini TIM! [[alternative HTML version deleted]] __ R-help@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.
[R] how to recover a list structure
I am experiencing some problems at working with lists at high level. In the following "coef" contains the original DWT coefficients organized in a list. Thorugh applying the following two commands: coef.abs <- lapply(unlist(coef,recursive=FALSE,use.names =TRUE),abs) coef.abs.sorted <- sort(unlist(coef.abs),decreasing=TRUE) I get vector "coef.abs.sorted" containing the coefficients absolute value ordered by decreasing magnitude, whose first 10 elements I set to zero after applying an iterative math formula (telling me how many coefficient values to spare). My problem is setting to zero the correspondent coefficients in the original "coef" list so as to reconstruct the signal from the depleted coefficients set, given that the above operations have erased the list structure. I can get the labels of the coefficients that have to be zeroed ... but the names of vector "coef.abs.sorted" elements differes from the original "coef" list elements as shown in the following: > names(coef.abs.sorted[1:10]) [1] "d6.d6(0)" "d5.d5(2)" "d5.d5(0)" "d4.d4(2)" "d5.d5(1)" "d4.d4(1)" "d4.d4(6)" "d4.d4(5)" "d4.d4(3)" [10] "d3.d3(12)" I wonder if there exists a high level command to set to zero respectively the coefficients in list "coef": - Level=6, Oscillation-Number=0 - Level=5, Oscillation-Number=0,1,2 - Level=4, Oscillation-Number=1,2,3,5.6 - Level=3, Oscillation-Number=12 > coef $d1 d1(0) d1(1) d1(2) d1(3) d1(4) d1(5) d1(6) d1(7) 1.075111e-02 -4.777441e-03 -2.775026e-03 2.011722e-03 -2.376611e-02 -1.574422e-03 -2.810372e-02 8.542393e-03 d1(8) d1(9)d1(10)d1(11)d1(12) d1(13)d1(14)d1(15) -1.754845e-02 -7.363856e-04 3.123922e-03 1.053743e-02 -1.014095e-02 1.059210e-02 -4.152311e-03 -7.320749e-04 d1(16)d1(17)d1(18)d1(19)d1(20) d1(21)d1(22)d1(23) -3.680064e-03 5.620248e-03 -2.251741e-03 -1.454674e-02 1.891275e-02 2.092009e-03 -1.286729e-02 9.037282e-03 d1(24)d1(25)d1(26)d1(27)d1(28) d1(29)d1(30)d1(31) -1.027137e-02 1.014230e-02 -2.175260e-03 -1.689383e-03 -2.016800e-03 3.984632e-03 -1.563781e-03 -3.801979e-03 d1(32)d1(33)d1(34)d1(35)d1(36) d1(37)d1(38)d1(39) 6.976144e-04 1.048419e-03 -1.319865e-02 -8.368520e-04 6.618890e-03 -5.835673e-03 8.721318e-03 2.018621e-02 d1(40)d1(41)d1(42)d1(43)d1(44) d1(45)d1(46)d1(47) -3.329934e-03 -4.823901e-03 2.957486e-02 -2.887600e-02 2.500062e-02 -2.207839e-02 1.516034e-02 4.328945e-05 d1(48)d1(49)d1(50)d1(51)d1(52) d1(53)d1(54)d1(55) 1.605634e-02 -2.360298e-02 7.875788e-03 -4.129065e-03 -1.014460e-02 -2.676679e-03 -9.953614e-03 -8.844977e-03 d1(56)d1(57)d1(58)d1(59) -2.141513e-02 -7.405836e-03 -5.078857e-03 8.480675e-04 $d2 d2(0)d2(1)d2(2)d2(3)d2(4)d2(5) d2(6)d2(7)d2(8) 0.033393680 0.015767682 -0.006008297 0.016899336 0.006661543 0.005297962 -0.005782728 -0.009358879 -0.012128449 d2(9) d2(10) d2(11) d2(12) d2(13) d2(14) d2(15) d2(16) d2(17) -0.014097771 0.003439004 -0.010154074 0.031203264 -0.057290615 0.004552577 0.061358997 -0.040730889 0.004064522 d2(18) d2(19) d2(20) d2(21) d2(22) d2(23) d2(24) d2(25) d2(26) -0.007208508 0.010426952 0.003855540 -0.011492580 0.035028591 0.029604957 -0.020069126 -0.018983905 -0.033710992 d2(27) d2(28) d2(29) 0.035848240 -0.014716622 0.008372893 $d3 d3(0)d3(1)d3(2)d3(3)d3(4)d3(5) d3(6)d3(7)d3(8) 0.020437693 -0.023658475 0.033448175 0.009689787 0.024750901 0.040022643 0.016532575 -0.035730498 -0.048828011 d3(9) d3(10) d3(11) d3(12) d3(13) d3(14) -0.012357469 -0.042282285 0.010908775 -0.061393069 0.058384786 -0.036842060 $d4 d4(0) d4(1) d4(2) d4(3) d4(4) d4(5) d4(6) 0.05419644 -0.23596007 0.84412709 0.06639234 0.02718491 0.15101792 -0.18101631 $d5 d5(0) d5(1) d5(2) 2.3514158 -0.4952582 -2.5589658 $d6 d6(0) -5.643476 > coef.abs.sorted d6.d6(0) d5.d5(2) d5.d5(0) d4.d4(2) d5.d5(1) d4.d4(1) d4.d4(6) d4.d4(5) d4.d4(3) 0.00e+00 0.00e+00 0.00e+00 0.00e+00 0.00e+00 0.00e+00 0.00e+00 0.00e+00 0.00e+00 d3.d3(12)d2.d2(15)d3.d3(13)d2.d2(13) d4.d4(0) d3.d3(8) d3.d3(10)d2.d2(16) d3.d3(5) 0.00e+00
[R] Moving Average
I am looking for some help at removing low-frequency components from a signal, through Moving Average on a sliding window. I understand thiis is a smoothing procedure that I never done in my life before .. sigh. I searched R archives and found "rollmean", "MovingAverages {TTR}", "SymmetricMA". None of the above mantioned functions seems to accept the smoothing polynomial order and the sliding window with as input parameters. Maybe I am missing something. I wonder whether there is some building blocks in R if not even a function which does it all (I do not expect that much,though). Even some literature references and/or tutorials are very welcome. Thank you so much, Maura tutti i telefonini TIM! [[alternative HTML version deleted]] __ R-help@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.
[R] R: Moving Average
I apologize for my messy post which stems from my own confusion ... and depression as well. In fact I though I was done with a big chunk of a project and to my dismay I found out there is more to do. I am trying to adapt an algorithm, based on advanced wavelet analysis, to my respiration signals. The original algorithm was implemented in Fortran by the mathematician author of the underlying theory. I implemented it in R language with some minor changes due to the nature o fthe phenomenon I am studying. Since my results and the mathematician's results mostly disagree on the same sample signal, I was suggested to remove the low frequencies components in advance of starting wavelet analysis. Upon rereading his suggestion I got more and more confused. As far as I know Moving Average is one of the simplest DSP low-pass filters. Therefore I cannot understand how MA can be used to remove low-frequency components. Nor I can understand hi suggestion that I paste in the following. "You have a rather short signal - 120 samples only. I avoid regarding wavelet coeffcients on senior detail levels because their main support interval is of the same order as the whole time interval and the circular effect of discrete finite wavelet transform is too strong for them. Thus, if the length of time series equals N=2^k then I work with detail levels from 1 to (k-3). It means that for this time series k=7 and the working detail levels are 1,2,3. Besides that you use periodic extension of the signal whereas I use zero padding till the length nearest N=2^k and I do not include into analysis zero wavelet coefficients which arises due to zero padding. Moreover, the SpAn removes automatically before wavelet analysis low-frequency components from the signal (which are the main source of circular effect) by moving average within time window of the radius 2^(k-3). I advise you to remove low-frequency components as well, for example by local polynomials of the 2-nd order wit! hin moving time window of the radius 8 samples (the length of moving window equals 17, i.e. slightly more than 16 - maximum scale for the 3-rd detail level)." Thank you so much, Maura -Messaggio originale- Da: David Winsemius [mailto:dwinsem...@comcast.net] Inviato: gio 26/02/2009 14.54 A: mau...@alice.it Cc: r-help@r-project.org Oggetto: Re: [R] Moving Average I saw Gabor's reply but have a clarification to request. You say you want to remove low frequency components but then you request smoothing functions. The term "smoothing" implies removal of high-frequency components of a series. If smoothing really is your goal then additional R resource would be smooth.spline, loess (or lowess), ksmooth, or using smoothing terms in regressions. Venables and Ripley have quite a few worked examples of such in MASS. -- David Winsemius On Feb 26, 2009, at 7:07 AM, wrote: > I am looking for some help at removing low-frequency components from > a signal, through Moving Average on a sliding window. > I understand thiis is a smoothing procedure that I never done in my > life before .. sigh. > > I searched R archives and found "rollmean", "MovingAverages {TTR}", > "SymmetricMA". > None of the above mantioned functions seems to accept the smoothing > polynomial order and the sliding window with as input parameters. > Maybe I am missing something. > > I wonder whether there is some building blocks in R if not even a > function which does it all (I do not expect that much,though). > Even some literature references and/or tutorials are very welcome. > > Thank you so much, > Maura > > > > tutti i telefonini TIM! > > > [[alternative HTML version deleted]] > > __ > R-help@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. tutti i telefonini TIM! [[alternative HTML version deleted]] __ R-help@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.
[R] help with correct use of function lsfit
To the purpose of fitting a 2nd order polynomial (a + b*x + c*x^2) to the chunk of signal falling in a 17 consecutive samples window I wrote the following very crude script. Since I have no previous experience of using Least Square Fit with R I would appreciate your supervision and suggestion. I guess the returned coefficients of the oolynomial are: a = -1.3191398 b = 0.1233055 c = 0.9297401 Thank you very much in advance, Maura ## ## Main tms <- t(read.table("signal877cycle1.txt")) J <- ilogb(length(tms), base=2) + 1 y <- c(tms,rep(0,2^J - length(tms))) y.win <- tms.ext[1:17] ls.mat <- matrix(nrow=length(y.win),ncol=3,byrow=TRUE) dt <- 0.033 ls.mat[,1] <- 1 ls.mat[,2] <- seq(0,dt*(length(y.win)-1),dt) ls.mat[,3] <- ls.mat[,2]^2 # > tms <- t(read.table("signal877cycle1.txt")) > J <- ilogb(length(tms), base=2) + 1 > y <- c(tms,rep(0,2^J - length(tms))) > y.win <- tms.ext[1:17] > ls.mat <- matrix(nrow=length(y.win),ncol=3,byrow=TRUE) > dt <- 0.033 > ls.mat[,1] <- 1 > ls.mat[,2] <- seq(0,dt*(length(y.win)-1),dt) > ls.mat[,3] <- ls.mat[,2]^2 > y [1] -1.29882462 -1.29816465 -1.29175902 -1.33508315 -1.31905086 -1.30246447 -1.25496640 -1.25858566 -1.19862868 [10] -1.16985809 -1.15755035 -1.15627040 -1.10929231 -1.09324296 -1.07202676 -1.03543530 -1.00609649 -0.96931799 [19] -0.96014189 -0.93879923 -0.89472101 -0.86568807 -0.86394226 -0.83804684 -0.79226517 -0.74804696 -0.69506558 [28] -0.63984135 -0.57677266 -0.52376371 -0.48793752 -0.44261935 -0.37505621 -0.30538492 -0.19309771 -0.07859412 [37] -0.01879655 0.04247391 0.09565881 0.17329566 0.29132263 0.38380712 0.45016443 0.50107765 0.57413940 [46] 0.68835476 0.78369090 0.83756871 0.87753415 0.92834503 0.99560230 1.08055356 1.17121517 1.22967280 [55] 1.25791166 1.28749046 1.31672692 1.33188866 1.35420775 1.37356226 1.38792638 1.40398573 1.41558702 [64] 1.39204622 1.39848595 1.39902593 1.40604565 1.42092504 1.41436531 1.3843 1.36012986 1.32950875 [73] 1.26507137 1.25315597 1.18249472 1.08857029 0.98782261 0.90470599 0.83081192 0.77709116 0.65228917 [82] 0.51844166 0.44530462 0.39562664 0.30153281 0.17979539 0.09895985 0.04306094 -0.03937571 -0.14150334 [91] -0.25936679 -0.31480454 -0.38806157 -0.47389691 -0.50785671 -0.58179371 -0.67538285 -0.74246719 -0.78380551 [100] -0.83894328 -0.86450224 -0.90614055 -0.93751928 -0.99679687 -1.03205956 -1.06616465 -1.06651404 -1.14997066 [109] -1.18338930 -1.21335809 -1.20208854 -1.22370767 -1.23488486 -1.25112655 -1.26942581 -1.26792234 -1.28838504 [118] -1.28799329 -1.27326566 -1.28502518 0. 0. 0. 0. 0. 0. [127] 0. 0. > y.win [1] -1.298825 -1.298165 -1.291759 -1.335083 -1.319051 -1.302464 -1.254966 -1.258586 -1.198629 -1.169858 -1.157550 [12] -1.156270 -1.109292 -1.093243 -1.072027 -1.035435 -1.006096 > ls.mat [,1] [,2] [,3] [1,]1 0.000 0.00 [2,]1 0.033 0.001089 [3,]1 0.066 0.004356 [4,]1 0.099 0.009801 [5,]1 0.132 0.017424 [6,]1 0.165 0.027225 [7,]1 0.198 0.039204 [8,]1 0.231 0.053361 [9,]1 0.264 0.069696 [10,]1 0.297 0.088209 [11,]1 0.330 0.108900 [12,]1 0.363 0.131769 [13,]1 0.396 0.156816 [14,]1 0.429 0.184041 [15,]1 0.462 0.213444 [16,]1 0.495 0.245025 [17,]1 0.528 0.278784 > lsfit(x, y, wt = NULL, intercept = TRUE, tolerance = 1e-07, +yname = NULL> > lsfit(ls.mat, y.win,wt = NULL, intercept = TRUE, tolerance = 1e-07,yname = > NULL) $coefficients Intercept X1 X2 X3 -1.3191398 0.1233055 0.9297401 0.000 $residuals [1] 0.020315146 0.015893550 0.015192628 -0.037263015 -0.032387216 -0.028982296 0.003309337 -0.017541342 [9] 0.023159250 0.030648485 0.019649885 -0.004401476 0.015220334 0.001888425 -0.008301609 -0.005141358 [17] -0.011258729 $intercept [1] TRUE $qr $qt [1] 4.937370523 0.409411205 -0.089144866 -0.041892736 -0.035696706 -0.031176843 0.002024443 -0.018121872 [9] 0.023077794 0.030860815 0.019950712 -0.004217443 0.015082286 0.001223006 -0.009699688 -0.007477386 [17] -0.014737995 $qr Intercept X2 X3X1 [1,] -4.1231056 -1.08849989 -0.39512546 -4.123106e+00 [2,] 0.2425356 0.66656733 0.35194755 1.558035e-17 [3,] 0.2425356 0.21973588 -0.09588149 1.787189e-17 [4,] 0.2425356 0.17022850 -0.10350966 -2.990539e-17 [5,] 0.2425356 0.12072112 -0.19811319 2.906411e-01 [6,] 0.2425356 0.07121375 -0.27000118 2.654896e-01 [7,] 0.2425356 0.02170637 -0.31917362 2.457966e-01 [8,] 0.2425356 -0.02780101 -0.34563052 2.315620e-01 [9,] 0.2425356 -0.07730838 -0.34937188 2.227859e-01 [10,] 0.2425356 -0.12681576 -0.33039769 2.194681e-01 [11,] 0.2425356 -0.17632314 -0.28870796 2.216089e-01 [12,] 0.2425356 -0.22583052 -0.22430269 2.29
[R] flaw in CRAN package "wavelets": Daubechies "d8" not recognized by function wt.filter
> wt.filter("d8") HOW COME Error in validObject(.Object) : invalid class "wt.filter" object: invalid object for slot "transform" in class "wt.filter": got class "function", should be or extend class "character" > wt.filter("d10") # OK An object of class wt.filter Slot "L": [1] 10 > wt.filter("d6") #OK An object of class wt.filter Slot "L": [1] 6 Thank you in advance to anyone who takes care of reported bugs in CRAN packages. Maura tutti i telefonini TIM! [[alternative HTML version deleted]] __ R-help@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.
[R] R: flaw in CRAN package "wavelets": Daubechies "d8" not recognized by function wt.filter
Thank you. I do not know where the source code is available.I never uploaded anything to CRAN. I am just an R user so far. Can you please tell me ? I did notify the package maintainer mentioned in the package on-line documentation, namely Eric Aldrich , twice. I suspect hic contact information is obsolete because he never got back to me or the R forum. Moreover, his web site does not exist and his name cannot be found in the University of Washington directory. Best regards, Maura -Messaggio originale- Da: David Winsemius [mailto:dwinsem...@comcast.net] Inviato: mer 04/03/2009 7.20 A: mau...@alice.it Cc: r-help@r-project.org; eldr...@gmail.com Oggetto: Re: [R] flaw in CRAN package "wavelets": Daubechies "d8" not recognized by function wt.filter You can look at the code yourself. The d8 filter appears to have a deletion mutation making it "different" than the other d-series and the fix looks feasible for testing: d6.filter <- function(mod = F) { class <- "Daubechies" name <- "d6" L <- as.integer(6) g <- c(0.332670552950083, 0.806891509311093, 0.459877502118491, -0.135011020010255, -0.0854412738820267, 0.0352262918857096) if (modwt == TRUE) { g <- g/sqrt(2) transform <- "modwt" } else transform <- "dwt" h <- wt.filter.qmf(g, inverse = TRUE) wt.filter <- new("wt.filter", L = L, h = h, g = g, wt.class = class, wt.name = name, transform = transform) return(wt.filter) } d8.filter <- function(mod = F) { class <- "Daubechies" name <- "d8" L <- as.integer(8) g <- c(0.230377813307443, 0.714846570548406, 0.630880767935879, -0.0279837694166834, -0.187034811717913, 0.0308413818353661, 0.032883011778, -0.0105974017850021) < missing code> h <- wt.filter.qmf(g, inverse = TRUE) wt.filter <- new("wt.filter", L = L, h = h, g = g, wt.class = class, wt.name = name, transform = transform) return(wt.filter) } d10.filter <- function(mod = F) { class <- "Daubechies" name <- "d10" L <- as.integer(10) g <- c(0.160102397974193, 0.60382926979719, 0.724308528437773, 0.138428145901320, -0.242294887066382, -0.0322448695846381, 0.0775714938400459, -0.0062414902127983, -0.012580751999082, 0.0033357252854738) if (modwt == TRUE) { g <- g/sqrt(2) transform <- "modwt" } else transform <- "dwt" h <- wt.filter.qmf(g, inverse = TRUE) wt.filter <- new("wt.filter", L = L, h = h, g = g, wt.class = class, wt.name = name, transform = transform) return(wt.filter) } Make your own wt.filter with the missing code inserted and see if happiness prevails.When I apply the fix, I get: > wt.filter("d8") An object of class "wt.filter" Slot "L": [1] 8 Slot "level": [1] 1 Slot "h": [1] -0.01059740 -0.03288301 0.03084138 0.18703481 -0.02798377 -0.63088077 0.71484657 -0.23037781 Slot "g": [1] 0.23037781 0.71484657 0.63088077 -0.02798377 -0.18703481 0.03084138 0.03288301 -0.01059740 Slot "wt.class": [1] "Daubechies" Slot "wt.name": [1] "d8" Slot "transform": [1] "dwt" By the way, there also appears to be no d2 and calling wt.filter with "d2" also provokes an error. The proper manner for getting this addressed is to draw it to the attention of the package maintainer rather than posting a "to whom it may concern" message to the list. -- David Winsemius On Mar 4, 2009, at 12:36 AM, wrote: >> wt.filter("d8") HOW COME > Error in validObject(.Object) : > invalid class "wt.filter" object: invalid object for slot > "transform" in class "wt.filter": got class "function", should be or > extend class "character" > >> wt.filter("d10") # OK > An object of class wt.filter > Slot "L": > [1] 10 > >> wt.filter("d6") #OK > An object of class wt.filter > Slot "L": > [1] 6 > > > Thank you in advance to anyone who takes care of reported bugs in > CRAN packages. > Maura > > > tutti i telefonini TIM! > > > [[alternative HTML version deleted]] > > __ > R-help@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. tutti i telefonini TIM! [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https:
[R] Multi-line texts in plots
I am running a simulation many times changing one parameter each time and recording the outcome. I have to produce a plot to make a sense of the bunch of numbers I get from every run. My problem is to insert a multi-line text to keep track of which result correspond to which parameter values. A legend does not work in this case because I will plot 2 variables and the corresponding experimental values. So two curves on the same drawing as a result of the combination of 20 parameters. I may decide to place two plots on the same canvas but if so I will have to find the space for two 20-line texts In short, I wonder how I can insert a 20-line text on each plot. I browsed through the documentation of the par command but I could not find any helpful option. Thank you in advance for any suggestion. Maura tutti i telefonini TIM! [[alternative HTML version deleted]] __ R-help@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.
[R] R: Multi-line texts in plots
Thank you. I will try the approacch you suggested. Here is the list of 20 flags whose concurrent values values select the program branch. "TRUE" / "FALSE" can be replaced by 1 / 0 All the seperating lines "$$" and "..." and comments (in capital letters) can be removed (this is a print-out). Just the flags name and value will do. Thank you so much. Maura $.. PROGRAM FLAGS ...$ $ $ $ TrendOff: FALSE $..$ $ $ $ MOdwt: FALSE $..$ $ ZeroPadding:TRUE $ $ $ STEP-1: LOW-FREQUENCY COMPONENTS REMOTION REMOTION THROUGH WAVELET d4 TRANFORM $ $ Step1HighScalesOff: TRUE $ Step1NumHighScalesOff: 4 $ Step1ScalingCoefOff:TRUE $ Step1ExtraCoefOff: TRUE $ STEP-2: BEST WAVELET BASIS THROUGH MINIMUM-ENTROPY COST FUNCTION $ $ Step2HighScalesOff: TRUE $ Step2NumHighScalesOff: 4 $ Step2ScalingCoefOff:TRUE $ Step2ExtraCoefOff: TRUE $ STEP-3: BEST WAVELET BASIS THROUGH COHERENT BASIS THRESHOLDING $ $ Step3HighScalesOff: TRUE $ Step3NumHighScalesOff: 4 $ Step3ScalingCoefOff:TRUE $ Step3ExtraCoefOff: TRUE $ STEP-4: DONOHO ALPHA $ $ Step4HighScalesOff: TRUE $ Step4NumHighScalesOff: 4 $ Step4ScalingCoefOff:TRUE $ Step4ExtraCoefOff: TRUE -Messaggio originale- Da: baptiste auguie [mailto:ba...@exeter.ac.uk] Inviato: ven 20/03/2009 12.56 A: mau...@alice.it Cc: r-help@r-project.org Oggetto: Re: [R] Multi-line texts in plots Hi, it would help if you provided a minimal example. Here is one approach I often use with the plotting package ggplot2, parameters <- expand.grid(m=c(0, 1), s=seq(0.1, 1,length=10)) x <- seq(-5, 5, length=300) foo <- function(m, s){ data.frame(x=x, y=dnorm(x, m, s), m=factor(m), s=factor(s)) } # construct a data.frame with all the data results <- do.call(rbind, mapply(foo, m=parameters$m, s=parameters$s, SIMPLIFY=F)) library(ggplot2) p1 <- qplot(x, y, data=results, geom="line", colour=s, linetype=m) p2 <- p1 + facet_grid(m~.) results2 <- within(results, f <- factor(paste("m=", m,"; s=", s))) p3 <- qplot(x, y, data=results2, geom="line", colour=f) p1 # note how the legend is constructed for you p2 # clearest imho p3 # with 20 levels it's not very readable Hope this helps, baptiste On 20 Mar 2009, at 10:59, mau...@alice.it wrote: > I am running a simulation many times changing one parameter each > time and recording the outcome. > I have to produce a plot to make a sense of the bunch of numbers I > get from every run. > My problem is to insert a multi-line text to keep track of which > result correspond to which parameter values. > A legend does not work in this case because I will plot 2 variables > and the corresponding experimental values. > So two curves on the same drawing as a result of the combination of > 20 parameters. > I may decide to place two plots on the same canvas but if so I will > have to find the space for two 20-line texts > In short, I wonder how I can insert a 20-line text on each plot. I > browsed through the documentation of the par command > but I could not find any helpful option. > Thank you in advance for any suggestion. > Maura > > > tutti i telefonini TIM! > > > [[alternative HTML version deleted]] > > __ > R-help@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. _ Baptiste Auguié School of Physics University of Exeter Stocker Road, Exeter, Devon, EX4 4QL, UK Phone: +44 1392 264187 http://newton.ex.ac.uk/research/emag __ tutti i telefonini TIM! [[alternative HTML version deleted]] __ R-help@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.
[R] struggling with pairlists
I would like to create a vector of pairlist (flag, binary_value) like: (variable ="TrendOff", value = 0) (variable ="MOdwt",value = 1) (variable ? "ZeroPadding", value =1) I tried the following syntax but the emcompassing list (that I called "flags") is not made up of pairlists. Instead it is made up of two apparently disjoint lists: > flags_val <- c( 0,1,1,1,4,1,1,1,4,1,1,1,4,1,1,1,4,1,1) > flags_nam <- c("TrendOff","MOdwt","ZeroPadding", + "Step1HSOff","Step1NumHSOff","Step1NumHSOff","Step1ExtOff", + "Step2HSOff","Step2NumHSOff","Step2NumHSOff","Step2ExtOff", + "Step3HSOff","Step3NumHSOff","Step3NumHSOff","Step3ExtOff", + "Step4HSOff","Step4NumHSOff","Step4NumHSOff","Step4ExtOff" ) > flags_nam [1] "TrendOff" "MOdwt" "ZeroPadding" "Step1HSOff" "Step1NumHSOff" "Step1NumHSOff" [7] "Step1ExtOff" "Step2HSOff""Step2NumHSOff" "Step2NumHSOff" "Step2ExtOff" "Step3HSOff" [13] "Step3NumHSOff" "Step3NumHSOff" "Step3ExtOff" "Step4HSOff" "Step4NumHSOff" "Step4NumHSOff" [19] "Step4ExtOff" > flags <- pairlist (data = flags_val, variable = flags_nam) > flags $data [1] 0 1 1 1 4 1 1 1 4 1 1 1 4 1 1 1 4 1 1 $variable [1] "TrendOff" "MOdwt" "ZeroPadding" "Step1HSOff" "Step1NumHSOff" "Step1NumHSOff" [7] "Step1ExtOff" "Step2HSOff""Step2NumHSOff" "Step2NumHSOff" "Step2ExtOff" "Step3HSOff" [13] "Step3NumHSOff" "Step3NumHSOff" "Step3ExtOff" "Step4HSOff" "Step4NumHSOff" "Step4NumHSOff" [19] "Step4ExtOff" Please, can someone teach me how to create a vector of pairlists ? I could find no illustrating on-line example. Thank you very much. Maura tutti i telefonini TIM! [[alternative HTML version deleted]] __ R-help@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.
[R] R: Multi-line texts in plots
Now that I have my list of flags with theri respective values (thanks to all those who posted their suggestions): Flags Values 1 TrendOff 0 2 MOdwt 1 3ZeroPadding 1 4 Step1HSOff 1 5 Step1NumHSOff 4 6 Step1NumHSOff 1 7Step1ExtOff 1 8 Step2HSOff 1 9 Step2NumHSOff 4 10 Step2NumHSOff 1 11 Step2ExtOff 1 12Step3HSOff 1 13 Step3NumHSOff 4 14 Step3NumHSOff 1 15 Step3ExtOff 1 16Step4HSOff 1 17 Step4NumHSOff 4 18 Step4NumHSOff 1 19 Step4ExtOff 1 The next step is to insert the above list in a composite plot made up of 4 quadrants. The top 2 quadrants are filled with a barplot, the bottom left quadrant is filled with a 2-tracks plot. I would like to place the flags list in the bottom right quadrant. Hiow can I do that ? Maybe through using the text command recursively (once for each flag pairlist) ? Please, notice taht what none of the graphs represent the flags value. Therefore a legend is unappropriate here. Here is a sketched incomplete and undebugged script to generate the composite plot I mentioned: alpha <- matrix(nrow=21,ncol=2,byrow=T) zm<- matrix(nrow=10,ncol=2,byrow=T) colnames(alpha) <- c("MEM","SpAn") colnames(zm) <- c("MEM","SpAn") alpha[,1] <- c( 0.9453125, 1, 1, 1, 0.9765625, 0.9973958, 0.9375, 0.9921671, 0.9765625, 0.9322917, 0.96875, 0.8645833, 0.8723958, 0.9270833, 0.9791667, 0.9869792, 0.9661458, 0.9895833, 1, 1, 0.9713542 ) alpha[,2] <- c( 0.7265625, 0.8828125, 0.7734375, 0.7734375, 0.6875, 0.8359375, 0.6484375, 0.8046875, 0.71875, 0.734375, 0.71875, 0.7265625, 0.6796875, 0.7265625, 0.6953125, 0.6953125, 0.703125, 0.7890625, 0.828125, 0.8359375, 0.8515625 ) zm[,1] <- c( 0.857, 0, 0, 0, 0.0476, 0, 0.0476, 0, 0, 0.0476 ) zm[,2] <- c( 0, 0, 0, 0.762, 0, 0.0476, 0.1904, 0, 0, 0 ) flags_val <- c( 0,1,1,1,4,1,1,1,4,1,1,1,4,1,1,1,4,1,1) flags_nam <- c("TrendOff","MOdwt","ZeroPadding", "Step1HSOff","Step1NumHSOff","Step1NumHSOff","Step1ExtOff", "Step2HSOff","Step2NumHSOff","Step2NumHSOff","Step2ExtOff", "Step3HSOff","Step3NumHSOff","Step3NumHSOff","Step3ExtOff", "Step4HSOff","Step4NumHSOff","Step4NumHSOff","Step4ExtOff" ) flags <- data.frame(Flags=flags_nam, Values=flags_val,stringsAsFactors=FALSE) par(mfrow=c(2,2)) barplot(zm[,1],width=1,space=0,horiz=FALSE,axes=FALSE,main="MEM Vanishing Moments Distribution",cex.main=0.95) xxLab <- seq(0,11,1) axis(1,at=xxLab-0.5,labels=as.character(xxLab),col="red",col.axis="red",font.axis=1,xpd=TRUE, cex.lab=1) yyLab <- seq(0,1,0.14) axis(2,at=yyLab,labels=as.character(yyLab),col="red",col.axis="red",font.axis=1,xpd=TRUE, cex.lab=0.8,cex.axis=0.8) barplot(zm[,2],width=1,space=0,horiz=TRUE,axes=FALSE) text(x=25.5,y=15.6,pos=4,"SpAn Vanishing Moments Distribution",cex=1.2,font=2) axis(2,at=xxLab-1,labels=as.character(xxLab),col="red",col.axis="red",font.axis=1,xpd=TRUE, cex.lab=1) axis(3,at=yyLab-1,labels=as.character(yyLab),col="red",col.axis="red",font.axis=1,xpd=TRUE, cex.lab=0.8,cex.axis=0.8) cycle <- seq(1,21,1) plot(cycle, alpha[,1], pch=1, type = "l", col=3, lty=2, main="Alpha") points(cycle, alpha[,2], pch=3, type="b", lty=1, pch=4, col=6) legend("topright", legend=c("MEM","SpAn"), col=c(3,6),text.col="green4",lty=c(2,1), pch=c(1,3),merge=FALSE, bg='gray90') Thank tyou so much. Maura -Messaggio originale- Da: baptiste auguie [mailto:ba...@exeter.ac.uk] Inviato: ven 20/03/2009 12.56 A: mau...@alice.it Cc: r-help@r-project.org Oggetto: Re: [R] Multi-line texts in plots Hi, it would help if you provided a minimal example. Here is one approach I often use with the plotting package ggplot2, parameters <- expand.grid(m=c(0, 1), s=seq(0.1, 1,length=10)) x <- seq(-5, 5, length=300) foo <- function(m, s){ data.frame(x=x, y=dnorm(x, m, s), m=factor(m), s=factor(s)) } # construct a data.frame with all the data results <- do.call(rbind, mapply(foo, m=parameters$m, s=parameters$s, SIMPLIFY=F)) library(ggplot2) p1 <- qplot(x, y, data=results, geom="line", colour=s, linetype=m) p2 <- p1 + facet_grid(m~.) results2 <- within(results, f <- factor(paste("m=", m,
[R] package "sowas"
I cannot find sowas package by Douglas Mauran in CRAN packages list- On which platforms does sowas run ? Has anybody used such a package at all ? hHank you very much, Maura tutti i telefonini TIM! [[alternative HTML version deleted]] __ R-help@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.
[R] R: package "sowas"
I downloaded it. But I could not find the installation executable file. How can I install it on Windows XP ? Thank you. Maura -Messaggio originale- Da: ronggui [mailto:ronggui.hu...@gmail.com] Inviato: dom 22/03/2009 10.47 A: mau...@alice.it; r-help@r-project.org Oggetto: Re: [R] package "sowas" There is a binary version for Windows in the homepage of it. http://www.cru.uea.ac.uk/~douglas/software/sowas_0.94.zip You can find more on http://tocsy.agnld.uni-potsdam.de/wavelets/ Best 2009/3/22 stephen sefick : > You must go to his website because it is not on CRAN. I have built it > on mac osx by installing it with R CMD install. This should work on > other unix platforms. > > Stephen Sefick > > On Sat, Mar 21, 2009 at 9:26 PM, wrote: >> I cannot find sowas package by Douglas Mauran in CRAN packages list- >> On which platforms does sowas run ? >> Has anybody used such a package at all ? >> >> hHank you very much, >> Maura >> >> >> >> tutti i telefonini TIM! >> >> >> [[alternative HTML version deleted]] >> >> __ >> R-help@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. >> > > > > -- > Stephen Sefick > > Let's not spend our time and resources thinking about things that are > so little or so large that all they really do for us is puff us up and > make us feel like gods. We are mammals, and have not exhausted the > annoying little problems of being mammals. > > -K. Mullis > > __ > R-help@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. > -- HUANG Ronggui, Wincent Tel: (00852) 3442 3832 PhD Candidate Dept of Public and Social Administration City University of Hong Kong Home page: http://asrr.r-forge.r-project.org/rghuang.html A sociologist is someone who, when a beautiful women enters the room and everybody look at her, looks at everybody. tutti i telefonini TIM! [[alternative HTML version deleted]] __ R-help@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.
[R] R: R: package "sowas"
OK.Done. Tank you very much. Maura -Messaggio originale- Da: ronggui [mailto:ronggui.hu...@gmail.com] Inviato: dom 22/03/2009 15.40 A: mau...@alice.it Cc: r-help@r-project.org Oggetto: Re: R: [R] package "sowas" Executable file is not required. You must install R first, then you click "packages--install package(s) from local zip file ..." to install the sowas package. Best 2009/3/22 : > I downloaded it. But I could not find the installation executable file. > How can I install it on Windows XP ? > Thank you. > Maura > > > > -Messaggio originale- > Da: ronggui [mailto:ronggui.hu...@gmail.com] > Inviato: dom 22/03/2009 10.47 > A: mau...@alice.it; r-help@r-project.org > Oggetto: Re: [R] package "sowas" > > There is a binary version for Windows in the homepage of it. > http://www.cru.uea.ac.uk/~douglas/software/sowas_0.94.zip > > You can find more on http://tocsy.agnld.uni-potsdam.de/wavelets/ > > Best > > 2009/3/22 stephen sefick : >> You must go to his website because it is not on CRAN. I have built it >> on mac osx by installing it with R CMD install. This should work on >> other unix platforms. >> >> Stephen Sefick >> >> On Sat, Mar 21, 2009 at 9:26 PM, wrote: >>> I cannot find sowas package by Douglas Mauran in CRAN packages list- >>> On which platforms does sowas run ? >>> Has anybody used such a package at all ? >>> >>> hHank you very much, >>> Maura >>> >>> >>> >>> tutti i telefonini TIM! >>> >>> >>> [[alternative HTML version deleted]] >>> >>> __ >>> R-help@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. >>> >> >> >> >> -- >> Stephen Sefick >> >> Let's not spend our time and resources thinking about things that are >> so little or so large that all they really do for us is puff us up and >> make us feel like gods. We are mammals, and have not exhausted the >> annoying little problems of being mammals. >> >> -K. Mullis >> >> __ >> R-help@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. >> > > > > -- > HUANG Ronggui, Wincent > Tel: (00852) 3442 3832 > PhD Candidate > Dept of Public and Social Administration > City University of Hong Kong > Home page: http://asrr.r-forge.r-project.org/rghuang.html > > A sociologist is someone who, when a beautiful women enters the room > and everybody look at her, looks at everybody. > > > > Alice Messenger ;-) chatti anche con gli amici di Windows Live Messenger e > tutti i telefonini TIM! er -- HUANG Ronggui, Wincent PhD Candidate Dept of Public and Social Administration City University of Hong Kong Home page: http://asrr.r-forge.r-project.org/rghuang.html tutti i telefonini TIM! [[alternative HTML version deleted]] __ R-help@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.
[R] how to estimate multidimensional spectral measure of coherence
Please, does anyone know of an R packge to estimate multidimensional spectral measure of coherence within a moving time window ? Some time ago I expeimented with a similar package that performs Cross Spectrum Analysis on the whole signal though. Unluckily I deal with non-stationary signals whose properties change along with time. Therefore estimates can only be made over time periods roughly proportional to the reciprocal of the rate at which properties are changing. Thank you very much. Maura tutti i telefonini TIM! [[alternative HTML version deleted]] __ R-help@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.
[R] R: how to estimate multidimensional spectral measure of coherence
Does it work on a sliding window ? Does it estimate the cospectrum (the real part) and the quadrature spectrum (complex), the coherence squared, and the phase difference between two vector time series ? SOme time ago I started to read its author's thesis. It seemed to me strictly tailored on the specific problems he studied more than a wider purpose toolkit. Maura have you tried sowas? I know you had talked about it, but it may do what you want. I have used it for the wavelet cross spectrum. On Mon, Mar 23, 2009 at 9:47 AM, wrote: > Please, does anyone know of an R packge to estimate multidimensional spectral > measure of coherence within a moving time window ? > Some time ago I expeimented with a similar package that performs Cross > Spectrum Analysis on the whole signal though. > Unluckily I deal with non-stationary signals whose properties change along > with time. Therefore estimates can only be made over time periods > roughly proportional to the reciprocal of the rate at which properties are > changing. > Thank you very much. > Maura > > > tutti i telefonini TIM! > > > [[alternative HTML version deleted]] > > __ > R-help@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. > -- Stephen Sefick Let's not spend our time and resources thinking about things that are so little or so large that all they really do for us is puff us up and make us feel like gods. We are mammals, and have not exhausted the annoying little problems of being mammals. -K. Mullis tutti i telefonini TIM! [[alternative HTML version deleted]] __ R-help@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.
[R] Fortran-90 and R
I have some code in Fortran-90 that outperforms my R implementation of the same algorithm (in terms of speed). I wonder whether it is possible to interface R with Fortran-90. that is would like to call a Fortran routine from my R script, passing to the Fortran routine some real numbers array, some scalar real numbers, and an integer number . I have no idea how to do that because Fortran is a compiled language whereas R s an interpreted language .. therefore I do not know whetehr it makes any sense to build a make file for the linker ... Is the linker necessary ? Thank you very much. Maura tutti i telefonini TIM! [[alternative HTML version deleted]] __ R-help@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.
[R] R: Fortran-90 and R
I do hope the chapte about "Interfacing R and Fortran" is sufficient. I have a heavy load of work from two projects and no previous experience in either cases (analysis packages, algorithms, and so on ...). I am a postdoc. Thank you. Maura -Messaggio originale- Da: Peter Dalgaard [mailto:p.dalga...@biostat.ku.dk] Inviato: gio 26/03/2009 8.57 A: mau...@alice.it Cc: r-help@r-project.org Oggetto: Re: [R] Fortran-90 and R mau...@alice.it wrote: > I have some code in Fortran-90 that outperforms my R implementation of the > same algorithm (in terms of speed). > I wonder whether it is possible to interface R with Fortran-90. that is would > like to call a Fortran routine from my R > script, passing to the Fortran routine some real numbers array, some scalar > real numbers, and an integer number . > I have no idea how to do that because Fortran is a compiled language whereas > R s an interpreted language .. > therefore I do not know whetehr it makes any sense to build a make file for > the linker ... Is the linker necessary ? > > Thank you very much. > Maura You need to read this: http://cran.r-project.org/doc/manuals/R-exts.pdf -p -- O__ Peter Dalgaard Øster Farimagsgade 5, Entr.B c/ /'_ --- Dept. of Biostatistics PO Box 2099, 1014 Cph. K (*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918 ~~ - (p.dalga...@biostat.ku.dk) FAX: (+45) 35327907 tutti i telefonini TIM! [[alternative HTML version deleted]] __ R-help@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.
[R] Conerned about Interfacing R with Fortran
I am reading the manual sections illustrating how to call a Fortran subroutine from R. I feel uneasy at the explicit statement about ".Fortran" interface working with Fortran 77. I would like to call a Fortran-90 subroutine from my R script. Is that supported at all ? Thank you, Maura tutti i telefonini TIM! [[alternative HTML version deleted]] __ R-help@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.
[R] Need some help at interfacing R with Fortran-90
I browsed through ch.5 of R manual "Writing R extensions". It seems to be written for experienced programmers rathern than for people who occasionally face this problem. A table summarising the main ley points for each supported platform would be very useful. Something like: Supported languages: C, Fortran-77, .. Windows guidelines: 1. compie Fotran code with (commands) from (terminal / command line ... ?) 2. load compiled code with (commands) from () 3. call Fortran subroutine from R passing arguments Linux guidelines: 1. 2. 3. Unix guidelines: 1. 2. 3. Coming to my problem. I have 4 Fortran-90 subroutines. There is a "main" routine calling the other three ones. Therefore I only need to call, and exchange data, between R and the "main" Fortran subroutine. Question-1: can Fotran-90 be interfaced to R ? The manual mentions Fortran-77. I found no mention of Fortran-90 (which supports dynamic memory allocation, and whose set of commands is bigger then Fortran-77) Question-2: Shall I generate executable code (compile the Fortran subroutines) through a Fortran compiler (which one ?) outside R environment ? Question-3: Shall I create a library ("so") object for each one of the 4 Fortran routiines or just the for the "main" one ? Question-4: What is the whole interfacing procedure on a Windows/XP system (steps sequence) ? Question-5: What is the whole interfacing procedure on a Mac/OS system (steps sequence) ? Thank you in advance for clarifying my confusion. Maura tutti i telefonini TIM! tutti i telefonini TIM! tutti i telefonini TIM! [[alternative HTML version deleted]] __ R-help@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.
[R] R: Fortran 90 etc.
I have tried to compile the working Fortran-90 routines (see attachment) to interface them with R. The compiler automatically caled by R CMD command line prints a bunch of error messages (as follows). I think I'm better off translating the Fortran implementation into R ... which is what I hoped I could avoid. Maura host705:Desktop mauede$ R CMD SHLIB ford.f90 gfortran -arch i386 -fno-common -g -O2 -c ford.f90 -o ford.o ford.f90:2: c - 1 Error: Unclassifiable statement at (1) ford.f90:3: c --- Choozing wavelet order from minimum enthropy of squared wavelet 1 Error: Unclassifiable statement at (1) ford.f90:4: c --- coefficients distribution on detail levels with numbers from LevMin up to 1 Error: Unclassifiable statement at (1) ford.f90:5: c --- Vocabulary of wavelets: the first 10 orthogonal Daubechies wavelets + 7 1 Error: Unclassifiable statement at (1) ford.f90:6: c --- If wavelet order is p>100 it means that it is a symlet of the order (p-10 1 Error: Unclassifiable statement at (1) ford.f90:7: c --- Input: X - real array of signal of the length N; 1 Error: Unclassifiable statement at (1) ford.f90:8: c ---Nfour=2**Kfour - the minimum integer of 2 in the power, which is = 1 Error: Unclassifiable statement at (1) ford.f90:9: c ---LevMin, LevMax - numbers of working detail levels. 1 Error: Unclassifiable statement at (1) ford.f90:10: c --- Output: wavelet order NordOut. 1 Error: Unclassifiable statement at (1) ford.f90:11: c - 1 Error: Unclassifiable statement at (1) ford.f90:13.14: real*4 Y [allocatable] (:) 1 Error: Syntax error in data declaration at (1) ford.f90:15.16: allocate(Y(Nfour)) 1 Error: Syntax error in ALLOCATE statement at (1) ford.f90:41.17: Dw=abs(Y(j)) 1 Error: Syntax error in argument list at (1) ford.f90:56.15: Dw=abs(Y(j)) 1 Error: Syntax error in argument list at (1) ford.f90:22.7: Y=X 1 Error: Incompatible ranks 0 and 1 in assignment at (1) ford.f90:72.18: deallocate(Y) 1 Error: Expression in DEALLOCATE statement at (1) must be ALLOCATABLE or a POINTER ford.f90:79: c --- 1 Error: Unclassifiable statement at (1) ford.f90:80: c --- Fast wavelet transform of the signal array a(n) 1 Error: Unclassifiable statement at (1) ford.f90:81: c --- n must be = 2**m 1 Error: Unclassifiable statement at (1) ford.f90:82: c --- if isign= 1 then direct transform 1 Error: Unclassifiable statement at (1) ford.f90:83: c --- if isign=-1 then inverse transform 1 Error: Unclassifiable statement at (1) ford.f90:84: c --- The used orthogonal Daubechies wavelet is setting by preliminary 1 Error: Unclassifiable statement at (1) ford.f90:85: c --- call of the subroutine pwtset. 1 Error: Unclassifiable statement at (1) ford.f90:86: c --- 1 Error: Unclassifiable statement at (1) ford.f90:109: c - 1 Error: Unclassifiable statement at (1) Fatal Error: Error count reached limit of 25. make: *** [ford.o] Error 1 host705:Desktop mauede$ -Messaggio originale- Da: John C Nash [mailto:nas...@uottawa.ca] Inviato: ven 27/03/2009 16.14 A: mau...@alice.it Oggetto: Fortran 90 etc. Even though I'm a fairly experienced Fortran (77 actually) programmer and use R a lot, I too am having trouble interfacing the two. (If you do ?optim, you will see my codes are the NM, BFGS and CG codes from VERY long ago. I'm trying to update them.) However, for your problem, I think you will be happier in the short term by getting R to write out the data and then simply read it into Fortran. You can then get Fortran to output a file that is readable by R. I recommend using the CSV type (comma separated values) files -- they are tedious rather than difficult, and give very little problem for exchange between lots of programs (including spreadsheets -- I use Gnumeric as it has a very nice ssconvert function for use in command line scripts that can be automated. This would let you automate some of your work.) And I would make my intermediate files "verbose" i.e., with lots of labels etc. This will be more work to set up, but I think you will find you can debug things much quicker. And the files will be self-documenting too. I always have too many Test1.txt files around. This is not an elegant solution, but if your time is short, I think you will find you can make it work much, much faster than trying to package things within the R framework. Best wishes, JN e tutti i telefonini TIM! Vai su __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read th
[R] binary AND operators in R
I cannot find any R function or operator that performs a binary AND operation, as performed by Fortran built-in function "iand". Ideally either R operator "&" or "&&" should do that. But some tests proved they do not: > A<- 1 > B <- 2 > A [1] 1 > B [1] 2 > as.numeric(A&B) [1] 1 > as.numeric(A&&B) [1] 1 The binary content of A should be "1" The binary content of B should be "01000" Therefore the bitwise AND operator should yield 0 ! I do not know how to fore the binary representation of an unsigned integer when writing R code. Do you know how to get around this problem ? Thank you so much. Maura tutti i telefonini TIM! [[alternative HTML version deleted]] __ R-help@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.
[R] what is R equivalent of Fortran DOUBLE PRECISION ?
I noticed taht R cannot understand certain Fortran real constant formats. For instance: c14<- as.double( 7.785205408500864D-02) Error: unexpected symbol in " c14<- as.double( 7.785205408500864D" The above "D" is used in Fortran language to indicate the memory starage mode. That is for instructing Fortran compiler to store such a REAL constant in DOUBLE PRECISION... am I right ? Since R cannot undestand numerical conatant post-fixed by the letter "D", I wonder how I can instruct R interpreter to store such a numerical constant reserving as muh memory as necessary so as to accommodate a double precision number. I noticed R accepts the folllowing syntax but I do not know if i have achieved my goal thsi way: > c14<- as.double( 7.785205408500864E-02) > typeof(c4) [1] "double" My questions are: what is the best precision I can get with R when dealing with real number ? Is R "double" type equvalent to Fortran DOUBLE PRECISION for internal number representation ? Thank you very much. Maura tutti i telefonini TIM! [[alternative HTML version deleted]] __ R-help@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.
[R] scope of variables in R
I need to allocate (using C nomenclature) a set of "global" variables, some integer scalars and some double vectors. I have placed the name of such variables in the file containing the main script and the called functions: # # --- GLOBAL DATA & CONSTANTS -- EntrThreshold <- 1.e+35 NCMAX <- 50 ncof <- 0 ioff <- 0 joff <- 0 sig<- 0.0 cc <- vector(length=NCMAX) cr <- vector(length=NCMAX) Function "pwtset", called by function "ford", changes the content of variable 'ncof' as confirmed by the debigging printed values. But when function "pwset" exits and the flow control returns to the caller "ford" then variable 'ncof' has not kept the value assigned by "pwset", as if function "pwset" had allocated its own variable 'ncof'. My question is: how can I have R interpreter allocate "global"variables visible and accessible by all the functions in the same file ? "pwtset" <- function(n) { cat("\n BEGIN 'pwtset' \n") if(n < 100){ ncof <- n }else{ ncof <- n -100 } } BEGIN 'pwtset' function 'pwtset': ncof = 4 END 'pwtset' function 'ford': BEFORE calling wt1, ncof: 0 Thank you very much for removing my confusion. Maura tutti i telefonini TIM! [[alternative HTML version deleted]] __ R-help@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.
[R] Still confused about R method of data exchanging between caller and called function
First of all I'd like to thank all those who answered me back teaching me different ways to get the calledfunction modify global data rather than its own. I fixed that. Now I have a similar pproblem. Whenever the caller passes a matrix to the called function I thought the called function would make a copy of the passed array in its own memory frame, modify its own copy, but be able to pass back the results to the caller as follows ... but I am mistaken (I find all "NA" on the second call ... how caome ? "ford" <- function(X,N,Nfour,Kfour,LevMin,LevMax) { Y <- X Nord <- Kord if(Nord == 2){ cat("\n call HAAR \n") Y <- Haar(Y,Nfour,1) }else{ cat("\n call pwtset \n") pwtset(Nord) cat("\n call wt1 \n") Y <- wt1(Y,Nfour,1) cat("\n function 'ford' Y = ",Y,"\n") } # "wt1" <- function (a,n,isign){ cat("\n BEGIN 'wt1' \n") cat("\n 'wt1': n = ",n,"\n") cat("\n 'wt1': a = ",a,"\n") if (n < 4){ cat("\n function 'wt1': WRONG INPUT SIGNAL LENGTH \n") return() } if(isign >= 0){ nn <- n while(nn >= 4){ cat("\n call pwt \n") a <- pwt(a,nn,isign) nn <- nn/2 } ... cat("\n END 'wt1' \n") a #RETURN WAVELET COEFFICIENTS }# end function "wt1" tutti i telefonini TIM! [[alternative HTML version deleted]] __ R-help@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.
[R] Color coded 3D plot
I wonder whether it is possible in R to generate color-coded 3D plots, like the attached example. Basically a function f(x,y) (the 3rd dimension) is rendered through colors intensities. The side color-bar is a guide to the interpretation of the plot. Thank you very much, Maura e tutti i telefonini TIM! Vai su e tutti i telefonini TIM! Vai su __ R-help@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.
[R] R: Color coded 3D plot
Thank you. This is what I need. Maura -Messaggio originale- Da: Kingsford Jones [mailto:kingsfordjo...@gmail.com] Inviato: mer 22/04/2009 7.30 A: mau...@alice.it Cc: r-h...@stat.math.ethz.ch Oggetto: Re: [R] Color coded 3D plot The attachment didn't come through, but try: example(filled.countour) #or library(lattice) example(levelplot) hth, Kingsford Jones On Tue, Apr 21, 2009 at 9:46 PM, wrote: > I wonder whether it is possible in R to generate color-coded 3D plots, like > the attached example. > Basically a function f(x,y) (the 3rd dimension) is rendered through colors > intensities. The side color-bar is a guide to the > interpretation of the plot. > Thank you very much, > Maura > > > > e tutti i telefonini TIM! > Vai su > > > > > > e tutti i telefonini TIM! > Vai su > > __ > R-help@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. > > tutti i telefonini TIM! [[alternative HTML version deleted]] __ R-help@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.
[R] R: how to split and handle a big R program into multiple files
Is that an R command ? I browswd for the on-line hlp about such a command but could not find it. Thank you. maura -Messaggio originale- Da: baptiste auguie [mailto:ba...@exeter.ac.uk] Inviato: gio 23/04/2009 11.48 A: mau...@alice.it Cc: r-help Help Oggetto: Re: [R] how to split and handle a big R program into multiple files If most of the functions are quite stable (you don't change them too often), you could also consider creating a R package with package.skeleton. baptiste On 23 Apr 2009, at 10:39, jgar...@ija.csic.es wrote: > source() and the use of functions > ... > Javier > --- > >> I am working on a program totally written in R which is now getting >> bigger >> and bigger so that editling the only file that contains all the >> functions >> is becoming more and more unmanageable. >> I wonder whether it is possible to spread the R code, making up the >> same >> program, in a number of smaller files and then call them all, in >> the right >> order, through a list of something like the C language >> directive. >> >> Any other suggestion how to organize, handle, and maintain a big R >> program >> is welcome. >> >> Thank you in advance, >> Maura >> >> >> tutti i telefonini TIM! >> >> >> [[alternative HTML version deleted]] >> >> __ >> R-help@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. >> > > __ > R-help@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. _ Baptiste Auguié School of Physics University of Exeter Stocker Road, Exeter, Devon, EX4 4QL, UK Phone: +44 1392 264187 http://newton.ex.ac.uk/research/emag __ tutti i telefonini TIM! [[alternative HTML version deleted]] __ R-help@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.
[R] R: how to split and handle a big R program into multiple files
It looks like I can store each function in a different file and have "main file" containing the "include-like" directiives and the main instructions. Something like: source("Program_Global_Constants.R") source("Program_Global_Variables.R") source("Program_Fun1.R") source("Program_Fun2.R") source("Program_Fun3.R") source("Program_Fun4.R") #. # Main .. # Fun1() Fun2() ... Fun4() -Messaggio originale- Da: jgar...@ija.csic.es [mailto:jgar...@ija.csic.es] Inviato: gio 23/04/2009 11.39 A: mau...@alice.it Cc: r-help@r-project.org Oggetto: Re: [R] how to split and handle a big R program into multiple files source() and the use of functions ... Javier --- > I am working on a program totally written in R which is now getting bigger > and bigger so that editling the only file that contains all the functions > is becoming more and more unmanageable. > I wonder whether it is possible to spread the R code, making up the same > program, in a number of smaller files and then call them all, in the right > order, through a list of something like the C language > directive. > > Any other suggestion how to organize, handle, and maintain a big R program > is welcome. > > Thank you in advance, > Maura > > > tutti i telefonini TIM! > > > [[alternative HTML version deleted]] > > __ > R-help@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. > tutti i telefonini TIM! [[alternative HTML version deleted]] __ R-help@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.
[R] how to split and handle a big R program into multiple files
I am working on a program totally written in R which is now getting bigger and bigger so that editling the only file that contains all the functions is becoming more and more unmanageable. I wonder whether it is possible to spread the R code, making up the same program, in a number of smaller files and then call them all, in the right order, through a list of something like the C language directive. Any other suggestion how to organize, handle, and maintain a big R program is welcome. Thank you in advance, Maura tutti i telefonini TIM! [[alternative HTML version deleted]] __ R-help@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.
[R] R: R: how to split and handle a big R program into multiple files
I read the on-line documentation. What I am still missing is how I run my program after encapsulating it in a package. I will have to load the package ... just guessing Thank you maura -Messaggio originale- Da: baptiste auguie [mailto:ba...@exeter.ac.uk] Inviato: gio 23/04/2009 12.17 A: mau...@alice.it Cc: r-help Help Oggetto: Re: R: [R] how to split and handle a big R program into multiple files It is an R command (package utils), see ?package.skeleton baptiste On 23 Apr 2009, at 10:51, mau...@alice.it wrote: > > Is that an R command ? > I browswd for the on-line hlp about such a command but could not > find it. > Thank you. > maura > > > -Messaggio originale- > Da: baptiste auguie [mailto:ba...@exeter.ac.uk] > Inviato: gio 23/04/2009 11.48 > A: mau...@alice.it > Cc: r-help Help > Oggetto: Re: [R] how to split and handle a big R program into > multiple files > > > If most of the functions are quite stable (you don't change them too > often), you could also consider creating a R package with > package.skeleton. > > > baptiste > > > > On 23 Apr 2009, at 10:39, jgar...@ija.csic.es wrote: > > > source() and the use of functions > > ... > > Javier > > --- > > > >> I am working on a program totally written in R which is now getting > >> bigger > >> and bigger so that editling the only file that contains all the > >> functions > >> is becoming more and more unmanageable. > >> I wonder whether it is possible to spread the R code, making up the > >> same > >> program, in a number of smaller files and then call them all, in > >> the right > >> order, through a list of something like the C language > >> directive. > >> > >> Any other suggestion how to organize, handle, and maintain a big R > >> program > >> is welcome. > >> > >> Thank you in advance, > >> Maura > >> > >> > >> tutti i telefonini TIM! > >> > >> > >> [[alternative HTML version deleted]] > >> > >> __ > >> R-help@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. > >> > > > > __ > > R-help@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. > > _ > > Baptiste Auguié > > School of Physics > University of Exeter > Stocker Road, > Exeter, Devon, > EX4 4QL, UK > > Phone: +44 1392 264187 > > http://newton.ex.ac.uk/research/emag > __ > > > > > Alice Messenger ;-) chatti anche con gli amici di Windows Live > Messenger e tutti i telefonini TIM! er > _ Baptiste Auguié School of Physics University of Exeter Stocker Road, Exeter, Devon, EX4 4QL, UK Phone: +44 1392 264187 http://newton.ex.ac.uk/research/emag __ tutti i telefonini TIM! [[alternative HTML version deleted]] __ R-help@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.
[R] R: R: R: how to split and handle a big R program into multiple files
Submitting to CRAN is one of my goals. What we are implementing is not done yet either in R or MatLab. There exists some Fortran applications of the algorithms we are implementing for general use. it'll still take me some time before I get there. Maura -Messaggio originale- Da: Duncan Murdoch [mailto:murd...@stats.uwo.ca] Inviato: gio 23/04/2009 14.21 A: mau...@alice.it Cc: baptiste auguie; r-help Help Oggetto: Re: [R] R: R: how to split and handle a big R program into multiple files On 4/23/2009 7:15 AM, mau...@alice.it wrote: > I read the on-line documentation. > What I am still missing is how I run my program after encapsulating it in a > package. > I will have to load the package ... just guessing If I had a large program that I needed to run just once, e.g. an analysis or simulations for a paper, here's how I would organize it: - Identify all the general purpose functions and put them in a package. - The one-off parts of the code don't really belong as functions in a package, though there's nothing to stop you from doing that. I'd probably put them into a vignette, or just write the whole paper in Sweave, which is almost the same thing. If your general purpose functions do something new that would be useful to others, you might want to polish up the package and send it to CRAN (and perhaps submit it with a supporting paper to JSS). But that's not necessary: a package is a good way to organize code for your own use too. Duncan Murdoch > > Thank you > maura > > -Messaggio originale- > Da: baptiste auguie [mailto:ba...@exeter.ac.uk] > Inviato: gio 23/04/2009 12.17 > A: mau...@alice.it > Cc: r-help Help > Oggetto: Re: R: [R] how to split and handle a big R program into multiple > files > > It is an R command (package utils), see ?package.skeleton > > baptiste > > On 23 Apr 2009, at 10:51, mau...@alice.it wrote: > >> >> Is that an R command ? >> I browswd for the on-line hlp about such a command but could not >> find it. >> Thank you. >> maura >> >> >> -Messaggio originale- >> Da: baptiste auguie [mailto:ba...@exeter.ac.uk] >> Inviato: gio 23/04/2009 11.48 >> A: mau...@alice.it >> Cc: r-help Help >> Oggetto: Re: [R] how to split and handle a big R program into >> multiple files >> >> >> If most of the functions are quite stable (you don't change them too >> often), you could also consider creating a R package with >> package.skeleton. >> >> >> baptiste >> >> >> >> On 23 Apr 2009, at 10:39, jgar...@ija.csic.es wrote: >> >> > source() and the use of functions >> > ... >> > Javier >> > --- >> > >> >> I am working on a program totally written in R which is now getting >> >> bigger >> >> and bigger so that editling the only file that contains all the >> >> functions >> >> is becoming more and more unmanageable. >> >> I wonder whether it is possible to spread the R code, making up the >> >> same >> >> program, in a number of smaller files and then call them all, in >> >> the right >> >> order, through a list of something like the C language >> >> directive. >> >> >> >> Any other suggestion how to organize, handle, and maintain a big R >> >> program >> >> is welcome. >> >> >> >> Thank you in advance, >> >> Maura >> >> >> >> >> >> tutti i telefonini TIM! >> >> >> >> >> >> [[alternative HTML version deleted]] >> >> >> >> __ >> >> R-help@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. >> >> >> > >> > __ >> > R-help@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. >> >> _ >> >> Baptiste Auguié >> >> School of Physics >> University of Exeter >> Stocker Road, >> Exeter, Devon, >> EX4 4QL, UK >> >> Phone: +44 1392 264187 >> >> http://newton.ex.ac.uk/research/emag >> __ >> >> >> >> >> Alice Messenger ;-) chatti anche con gli amici di Windows Live >> Messenger e tutti i telefonini TIM! > > er >> > > _ > > Baptiste Auguié > > School of Physics > University of Exeter > Stocker Road, > Exeter, Devon, > EX4 4QL, UK > > Phone: +44 1392 264187 > > http://newton.ex.ac.uk/research/emag > __ > > > > > > tutti i telefonini TIM! > > > [[alternative HTML version deleted]] > > > > > > __ > R-help@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 prov
[R] constrained optimization
Is there any R package addressing problems of constrained optimization ? I have the following "apparently" simple problem: Given a set V with fixed cardinality:nv Given a set S whose cardinality is a parameter:nHat Let the cardinality of the intersection S.and.V be: nHatv The problem consists of maximizing nHatv/nv subject to a penalty if nHat > nHatv It is allowed and even desirable to make set S contain set V Thank you so much tutti i telefonini TIM! [[alternative HTML version deleted]] __ R-help@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.
[R] R: constrained optimization
Thank you. Unluckily what makes the problem only apparenttly simple (for me) is that we have not differentiable functions and the parameter space is not continuous ... which reduces dramatically the number of choices. I would be grateful to chat with anyone who has tackled a similar problem. Maura -Messaggio originale- Da: David Winsemius [mailto:dwinsem...@comcast.net] Inviato: dom 26/04/2009 6.55 A: mau...@alice.it Cc: r-h...@stat.math.ethz.ch Oggetto: Re: [R] constrained optimization http://search.r-project.org/cgi-bin/namazu.cgi?query=%22constrained+optimization%22&max=100&result=normal&sort=score&idxname=functions&idxname=Rhelp08 And that is only the help messages from the last two years.' On Apr 26, 2009, at 12:00 AM, wrote: > Is there any R package addressing problems of constrained > optimization ? > I have the following "apparently" simple problem: > > Given a set V with fixed cardinality:nv > Given a set S whose cardinality is a parameter:nHat > Let the cardinality of the intersection S.and.V be: nHatv > > The problem consists of maximizing nHatv/nv subject to a penalty > if nHat > nHatv > > It is allowed and even desirable to make set S contain set V > > Thank you so much > > > tutti i telefonini TIM! > > > [[alternative HTML version deleted]] > > __ > R-help@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. David Winsemius, MD Heritage Laboratories West Hartford, CT tutti i telefonini TIM! [[alternative HTML version deleted]] __ R-help@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.
[R] eager to learn how to use "sapply", "lapply", ...
After a year my R programming style is still very "C like". I am still writing a lot of "for loops" and finding it difficult to recognize where, in place of loops, I could just do the same with one line of code, using "sapply", "lapply", or the like. On-line examples for such high level function do not help me. Even if, sooner or later, I am getting my R scripts to do what I expect, I would really like to shake my C programming style off. I am staring at my R script and thinking "how can I improve it ?" For instance, I have a lot of loops similar to the following one and wonder whether I can replace them with a proper call to a high level R function that does the same: Nstart <- Nfour/(2^Lev) + 1 Nfinish <- Nstart -1 + Nfour/(2^Lev) LengLev <- Nfinish - Nstart + 1 NW <- floor(LengLev*N/Nfour) if(NW > 0){ for(j in Nstart:(Nstart + NW -1)){ Dw <- abs(Y[j]) Rnorm <- Rnorm + Dw^2 } } Thank you very much for helping me get better. Maura tutti i telefonini TIM! [[alternative HTML version deleted]] __ R-help@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.
[R] what happens if a function removes an external (global) variable ?
My program consists of a number of functions and a main script. It loops through many time series analyzing one at a time. I have declared a number of arrays and scalar variables in the main script namespace (using C++ terminology) because those data structures ar shared by many functions. let say "XX" is he name of a global array. I wonder what happens in the following cases: 1. a function tries to remove the global array through the instruction "rm(XX)" Will the next usage of XX still access a global variable (if using the assignment operator "<<-") or a new local one will be created ? 2. the main script removes the global array through the instruction "rm(XX)" Will the next usage of XX in the main script allocate a new global variable that can be accessed by all the called functions ? 3. If the global array XX is never removed but is assigned in different loops alternatively very short and very long time series then what will happen to the memory segment allocated to R ? Will it get more and more fragmented slowing down the process ... or aven crash ? Thank you very much. Maura tutti i telefonini TIM! [[alternative HTML version deleted]] __ R-help@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.
[R] wrong if-else syntax
What is wrong in the following nested if-else statements: if (Condition_1) { # begin IF_1 statement_1 statement_2 statement_3 if (Condition_2) { # begin IF_2 a<- a +1 } # end IF_2 statement_4 statement_5 statement_6 statement_7 if (Condition_3) {# begin IF_2 statement_8 } else { # ELSE_2 statement_9 statement_10 } # end IF_2 } else { # ELSE_1 statement_11 } # end IF_1 It looks like R interpret does not like the above syntax. In fact in my script I have the following instructions: if (DonohoAplhaON){ tms <<- xx[,"sampamp"] #EXTRACT SIGNAL AMPLITUDE tmsLen <<- length(tms) J <<- ilogb(tmsLen, base=2) if (logb(tmsLen, base=2)%%2 > 0) { J <<- J + 1 } rm(xx) rawtms <- tms X <- PreProcessor(tms,tmsLen,J) BestWavList <- FindBestWavelet (X,tmsLen,J,Step1NumHighScalesOFF) if (!is.null(BestWavList)) { #COMPUTE SIGNAL DONOHO-ALPHA features.mat[ns,"alpha"]<- CalcDonohoAlpha(rawtms,BestWavList$No,J,tmsLen,Step3NumHighScalesOFF,Step3AllCoefON) } else { cat("\n\n Could not compute Best Wavelet Basis for Signal: ",fln," Skip current signal! \n\n") next } } else { features.mat[ns,"alpha"] <- NA } It keeps printing out an error referred to the second " } else {" as if it could not realize that the inner if-statement has been closed: > if(!is.null(BestWavList)) { >#COMPUTE SIGNAL DONOHO-ALPHA + features.mat[ns,"alpha"]<- CalcDonohoAlpha(rawtms,BestWavList$No,J,tmsLen,Step3NumHighScalesOFF,Step3AllCoefON) + }else { + cat("\n\n Could not compute Best Wavelet Basis for Signal: ",fln," Skip current signal! \n\n") + next + } > }else { Error: unexpected '}' in " }" > features.mat[ns,"alpha"] <- NA > } Error: unexpected '}' in " }" Thank you for clarifying my doubts Maura tutti i telefonini TIM! [[alternative HTML version deleted]] __ R-help@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.
[R] Gaussian local detrending and smoothing within a moving time window
Is there an R function implementing a Gaussian local detrending and smoothing within a moving time window ? I used ksmooth over the entire time series. Plotting the data before and after this operation shows that the signal is actuslly smoother but the tend is still there. I wonder whether ksmooth can be adapted on a sliding window, iteratively providing overlapping signal segments like: x[(n+r):(m+r)] where n < m; r =1,2,3, so the sliding window width is m-n However, I do not know how the bandwidth and the window with are going to be related. Thank you for any comment and/or suggestion. Maura tutti i telefonini TIM! [[alternative HTML version deleted]] __ R-help@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.
[R] corrupted smoothing kernel ?
I am trying to use the "kernel" function. To understand how it works I tried out some of the examples. None of them works as shown in the following: > kernel("daniell", 50) # Error in kernel("daniell", 50) : unused argument(s) (50) > kernel("daniell", 10) # Error in kernel("daniell", 10) : unused argument(s) (10) > kernel("daniell", c(3,3)) Error in kernel("daniell", c(3, 3)) : unused argument(s) (c(3, 3)) > kernel("fejer", 100, r=6) Error in kernel("fejer", 100, r = 6) : unused argument(s) (100, r = 6) > kernel("daniell", c(11,7,3) ) Error in kernel("daniell", c(11, 7, 3)) : unused argument(s) (c(11, 7, 3)) My goal is to detrend a time series affected by non-linear trend. I do not have clear ideas about the difference betweeen "detrending" and "smoothing". I would appreciate some suggestions and/or literature references by people experienced about detrending and smoothing. I was told the there are two best methods about detrending: polynomial fit on a sliding window and kernel smoothing. I keep being confused . I got the book by Hardle. Maybe you can advice some other clarifying literature (possibly with examples). Thank you very much. Maura tutti i telefonini TIM! [[alternative HTML version deleted]] __ R-help@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.
[R] R: corrupted smoothing kernel ?
I have just installed R2.9.0 on my Windows XP system. I have followed the same installation procedure I have been using for over a year. That is installation from the "exe" file. "kernel" belongs to package "stats"which is (I think) installed by default. I loaded it but did not use the command: > library(stats) Now I did and it works fine for me too. I am sorry. I though such a command is only necessary when a package is installed. Thank youi. Maura -Messaggio originale- Da: Uwe Ligges [mailto:lig...@statistik.tu-dortmund.de] Inviato: gio 14/05/2009 16.14 A: mau...@alice.it Cc: r-h...@stat.math.ethz.ch Oggetto: Re: [R] corrupted smoothing kernel ? mau...@alice.it wrote: > I am trying to use the "kernel" function. To understand how it works I tried > out some of the examples. > None of them works as shown in the following: > >> kernel("daniell", 50) # > Error in kernel("daniell", 50) : unused argument(s) (50) which works for me. Have you loaded some specific package? Which R versioj is this? Your OS? Self-compiled R or some pre-compiled binary? Uwe Ligges >> kernel("daniell", 10) # > Error in kernel("daniell", 10) : unused argument(s) (10) >> kernel("daniell", c(3,3)) > Error in kernel("daniell", c(3, 3)) : unused argument(s) (c(3, 3)) >> kernel("fejer", 100, r=6) > Error in kernel("fejer", 100, r = 6) : unused argument(s) (100, r = 6) >> kernel("daniell", c(11,7,3) ) > Error in kernel("daniell", c(11, 7, 3)) : > unused argument(s) (c(11, 7, 3)) > > My goal is to detrend a time series affected by non-linear trend. I do not > have clear ideas about the > difference betweeen "detrending" and "smoothing". I would appreciate some > suggestions and/or literature references > by people experienced about detrending and smoothing. > I was told the there are two best methods about detrending: polynomial fit on > a sliding window and kernel smoothing. > I keep being confused . I got the book by Hardle. Maybe you can advice some > other clarifying literature (possibly with > examples). > Thank you very much. > Maura > > > > > > > tutti i telefonini TIM! > > > [[alternative HTML version deleted]] > > __ > R-help@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. tutti i telefonini TIM! [[alternative HTML version deleted]] __ R-help@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.
[R] Spearman rho
I read that Spearman rho can be used to detect the presence of trend in a time series. However, I cannot figure out how to use such a test to thsi purpose. First of all which one of the available functions and how to pass my mono-channel time series which contains both positive and negative values. I would love to see some examples. Thank you very much. Maura tutti i telefonini TIM! [[alternative HTML version deleted]] __ R-help@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.
[R] stationarity tests
How can I make sure the residual signal, after subtracting the trend extracted through some technique, is actually trend-free ? I would greatly appreciate any suggestion about some Stationarity tests. I'd like to make sure I have got the difference between ACF and PACF right. In the following I am citing some definitions. I would appreciate your thoughts. ACF(k) estimates the correlation between y(t) and y(t-k) like an ordinary correlation coefficient. ACF is the simple ( i.e. unconditional ) correlation between a time series and it's lags thus y(t)=a+b*y(t-k) gnerates the kth autocoreelation coefficient (b). If we have form y(t)=a+b*y(t-1)+c*y(t-2) .. then (c) is the PARTIAL AUTOCORRELATION COEFFFICIENT or in other words the CONDITIONAL CORRELATION of lag 2 given lag1 PACF(k) estimates the correlation between y(t) and y(t-k) adjusted for the effects of y(t-1), ..., y(t-k+1). Model identification is achieved by looking at the pattern of the ACF and PACF. - If the ACF dies off exponentially, but the PACF has p spikes, AR(p) is indicated. - If the ACF has q spikes and the PACF dies off exponentially, MA(q) is indicated. The ACF and the PACF for the resulting stationary series is used to determine the best B/J model for the series according to the following rules: a. If the ACF trails off and the PACF shows spikes, then an AR model with order p = number of significant PACF spikes is the best model. b. If the PACF trails off and the ACF shows spikes, then an MA model with order q= number of significant ACF spikes is the best model. c. If both the ACF and the PACF trail off then a ARMA model is used with p=1 and q=1. Thank you very much, Maura Thank you very much. Best regards, Maura Edelweiss tutti i telefonini TIM! [[alternative HTML version deleted]] __ R-help@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.
[R] how to implement a circular buffer with R
Some wavelet analysis experts have implemented periodic boundary conditions for signals. I need to implement a circular buffer. Something like: "12345abcdefgh12345abcdefgh" so that at each step the riightmost element is moved to the leftmost index and everything else is properly shifted: "h12345abcdefgh12345abcdefg", "gh12345abcdefgh12345abcdef", My implementation (still debugging) seems to start working but is terribly clumsy. I am sure that some expert can suggest a more elegant solution, Thank you. Maura tutti i telefonini TIM! [[alternative HTML version deleted]] __ R-help@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.
[R] Harmonic Analysis
I am looking for a package to perform harmonic analysis with the goal of estimating the period of the dominant high frequency component in some mono-channel signals. I guess there are presumably a number of CRAN packages allowing for such analysis. However, my search with keywords was not successfull. It brought up a lot of Fourier miscellanea but nothing specifically geared for my needs. I would greatly appreciate your suggestions. Thank you in advance. Maura tutti i telefonini TIM! [[alternative HTML version deleted]] __ R-help@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.
[R] R: Harmonic Analysis
Well, the time series I am dealing with are non-linear and not-stationary. Maura -Messaggio originale- Da: r-help-boun...@r-project.org per conto di stephen sefick Inviato: mer 27/05/2009 14.58 A: r-h...@stat.math.ethz.ch Oggetto: Re: [R] Harmonic Analysis why will a fourier transform not work? 2009/5/27 Uwe Ligges : > > > Dieter Menne wrote: >> >> alice.it> writes: >> >>> I am looking for a package to perform harmonic analysis with the goal of >>> estimating the period of the >>> dominant high frequency component in some mono-channel signals. >> >> You should widen your scope by looking a "time series" instead of harmonic >> analysis. There is a task view on the subject at >> >> http://cran.at.r-project.org/web/views/TimeSeries.html > > > ... or take a look at package tuneR. > > Uwe Ligges > > > > >> Dieter >> >> __ >> R-help@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. > > __ > R-help@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. > -- Stephen Sefick Let's not spend our time and resources thinking about things that are so little or so large that all they really do for us is puff us up and make us feel like gods. We are mammals, and have not exhausted the annoying little problems of being mammals. -K. Mullis __ R-help@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. tutti i telefonini TIM! [[alternative HTML version deleted]] __ R-help@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.
[R] R: R: Harmonic Analysis
Actually I do use DWT for features extraction which is aimed at clustering signals bearing statistically comparable patterns. Trend can easily fool any clustering function. This is why detrending is the number 1 step in the whole procedure. Sparing the quasi-harmonic components that bear most of the information is a must. I am interested at sparing the quasi-periodic oscillations that, otherwise, would be wiped out by the detrending procedure. Thanks, Maura -Messaggio originale- Da: stephen sefick [mailto:ssef...@gmail.com] Inviato: gio 28/05/2009 0.56 A: mau...@alice.it Cc: r-h...@stat.math.ethz.ch Oggetto: Re: R: [R] Harmonic Analysis Do you need time localization, or are you only interested in the period of the high frequency? If you do need time localization why not use a CWT to look at the signal? Stephen On Wed, May 27, 2009 at 4:59 PM, wrote: > Well, the time series I am dealing with are non-linear and not-stationary. > Maura > > -Messaggio originale- > Da: r-help-boun...@r-project.org per conto di stephen sefick > Inviato: mer 27/05/2009 14.58 > A: r-h...@stat.math.ethz.ch > Oggetto: Re: [R] Harmonic Analysis > > why will a fourier transform not work? > 2009/5/27 Uwe Ligges : >> >> >> Dieter Menne wrote: >>> >>> alice.it> writes: >>> I am looking for a package to perform harmonic analysis with the goal of estimating the period of the dominant high frequency component in some mono-channel signals. >>> >>> You should widen your scope by looking a "time series" instead of >>> harmonic >>> analysis. There is a task view on the subject at >>> >>> http://cran.at.r-project.org/web/views/TimeSeries.html >> >> >> ... or take a look at package tuneR. >> >> Uwe Ligges >> >> >> >> >>> Dieter >>> >>> __ >>> R-help@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. >> >> __ >> R-help@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. >> > > > > -- > Stephen Sefick > > Let's not spend our time and resources thinking about things that are > so little or so large that all they really do for us is puff us up and > make us feel like gods. We are mammals, and have not exhausted the > annoying little problems of being mammals. > > -K. Mullis > > __ > R-help@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. > > > > Alice Messenger ;-) chatti anche con gli amici di Windows Live Messenger e > tutti i telefonini TIM! er -- Stephen Sefick Let's not spend our time and resources thinking about things that are so little or so large that all they really do for us is puff us up and make us feel like gods. We are mammals, and have not exhausted the annoying little problems of being mammals. -K. Mullis tutti i telefonini TIM! [[alternative HTML version deleted]] __ R-help@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.
[R] ACF roots
I have a number of signals whose ACF may or may not cross the zero line. Whether roots exist or not is a piece of useful information for me. Likewise, if any root exists, I'd like to know its lag value. Unluckily R function ACF does not seem to provide such information. I wonder whether someone can come up with some suggestions ... maybe there is some other function that yields the regular ACF plus more ... Otherwise, I would appreciate some literature reference or just any advice that can help. Thank you so much. Maura tutti i telefonini TIM! [[alternative HTML version deleted]] __ R-help@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.
[R] JGR installation errors
I remember JGR installation on SuSE 10.3 as a nightmare that eventually I overcame with JGR designers' help. I have installed SuSE 11.1, latest R version and am trying to install JGR again. It is still a nightmare. I have followed the guidelines on http://jgr.markushelbig.org/JGR_on_Linux.html I have made sure I have the so R libraries. I have installed java-1.6.0-sun and its development environment. Following the on-line guidelines for JGR installation, the process fails on trying to install "rJava" ... please see all the messages in the following. I get the same error if I try to install "rJava" in advance of JGR. Thank you very much, Maura As root: linux-326k:/home/mauede # sudo R CMD javareconf Java interpreter : /usr/bin/java Java version : 1.6.0_0 Java home path : /usr/lib64/jvm/java-1.6.0-openjdk-1.6.0/jre Java compiler: /usr/bin/javac Java headers gen.: /usr/bin/javah Java archive tool: /usr/bin/jar Java library path: $(JAVA_HOME)/lib/amd64/server:$(JAVA_HOME)/lib/amd64:$(JAVA_HOME)/../lib/amd64::/usr/java/packages/lib/amd64:/usr/lib64:/lib64:/lib:/usr/lib JNI linker flags : -L$(JAVA_HOME)/lib/amd64/server -L$(JAVA_HOME)/lib/amd64 -L$(JAVA_HOME)/../lib/amd64 -L -L/usr/java/packages/lib/amd64 -L/usr/lib64 -L/lib64 -L/lib -L/usr/lib -ljvm JNI cpp flags: Updating Java configuration in /usr/lib64/R Done. linux-326k:/home/mauede # sudo R > install.packages('JGR') --- Please select a CRAN mirror for use in this session --- CRAN mirror Selection: 24 also installing the dependencies rJava, JavaGD, iplots trying URL 'http://cran.stat.unipd.it/src/contrib/rJava_0.6-3.tar.gz' Content type 'application/octet-stream' length 240527 bytes (234 Kb) opened URL == downloaded 234 Kb trying URL 'http://cran.stat.unipd.it/src/contrib/JavaGD_0.5-2.tar.gz' Content type 'application/octet-stream' length 87076 bytes (85 Kb) opened URL == downloaded 85 Kb trying URL 'http://cran.stat.unipd.it/src/contrib/iplots_1.1-3.tar.gz' Content type 'application/octet-stream' length 331100 bytes (323 Kb) opened URL == downloaded 323 Kb trying URL 'http://cran.stat.unipd.it/src/contrib/JGR_1.6-7.tar.gz' Content type 'application/octet-stream' length 506759 bytes (494 Kb) opened URL == downloaded 494 Kb * Installing *source* package rJava ... checking for gcc... gcc -std=gnu99 checking for C compiler default output file name... a.out checking whether the C compiler works... yes checking whether we are cross compiling... no checking for suffix of executables... checking for suffix of object files... o checking whether we are using the GNU C compiler... yes checking whether gcc -std=gnu99 accepts -g... yes checking for gcc -std=gnu99 option to accept ISO C89... none needed checking how to run the C preprocessor... gcc -std=gnu99 -E checking for grep that handles long lines and -e... /bin/grep checking for egrep... /bin/grep -E checking for ANSI C header files... yes checking for sys/wait.h that is POSIX.1 compatible... yes checking for sys/types.h... yes checking for sys/stat.h... yes checking for stdlib.h... yes checking for string.h... yes checking for memory.h... yes checking for strings.h... yes checking for inttypes.h... yes checking for stdint.h... yes checking for unistd.h... yes checking for string.h... (cached) yes checking sys/time.h usability... yes checking sys/time.h presence... yes checking for sys/time.h... yes checking for unistd.h... (cached) yes checking for an ANSI C-conforming con
[R] R: JGR installation errors
It works now. Thank you. I even succeeded in starting R by clicking on JGR icon that I placed on my desktop. I wonder whether some Java or system flag that unlocks Mutex (I ignore what it is) has to be set somewhere ... maybe fron the .bashrc file. The first time I happened to get JGR running (as root) a warning popped up (I haven't saved it) about a possible crash caused by Mutex being unlocked by anothe thread ... I restarted JGR as regular user and that message is not printed out any more. I do not know whether I can feel confident everything is fine with this installation ... ? Regards, Maura -Messaggio originale- Da: Simon Urbanek [mailto:simon.urba...@r-project.org] Inviato: ven 19/06/2009 15.43 A: mau...@alice.it Cc: stats-rosuda-de...@listserv.uni-augsburg.de; r-h...@stat.math.ethz.ch Oggetto: Re: JGR installation errors MAura, On Jun 19, 2009, at 7:36 , wrote: > I remember JGR installation on SuSE 10.3 as a nightmare that > eventually I overcame with JGR designers' help. > I have installed SuSE 11.1, latest R version and am trying to > install JGR again. > It is still a nightmare. > Well, good Linux distros offer JGR as binaries so it's one-liner to install it ;). All other distros I use are easy to install even from sources - SuSE seems is notoriously struggling ... > I have followed the guidelines on > http://jgr.markushelbig.org/JGR_on_Linux.html > I have made sure I have the so R libraries. > I have installed java-1.6.0-sun and its development environment. > Following the on-line guidelines for JGR installation, > the process fails on trying to install "rJava" ... please see all > the messages in the following. > I get the same error if I try to install "rJava" in advance of JGR. > > Thank you very much, > Maura > > > As root: > > linux-326k:/home/mauede # sudo R CMD javareconf > Java interpreter : /usr/bin/java > Java version : 1.6.0_0 > Java home path : /usr/lib64/jvm/java-1.6.0-openjdk-1.6.0/jre > Java compiler: /usr/bin/javac > Java headers gen.: /usr/bin/javah > Java archive tool: /usr/bin/jar > Java library path: $(JAVA_HOME)/lib/amd64/server:$(JAVA_HOME)/lib/ > amd64:$(JAVA_HOME)/../lib/amd64::/usr/java/packages/lib/amd64:/usr/ > lib64:/lib64:/lib:/usr/lib > JNI linker flags : -L$(JAVA_HOME)/lib/amd64/server -L$(JAVA_HOME)/ > lib/amd64 -L$(JAVA_HOME)/../lib/amd64 -L -L/usr/java/packages/lib/ > amd64 -L/usr/lib64 -L/lib64 -L/lib -L/usr/lib -ljvm > JNI cpp flags: > ^^^ - it appears that you don't have full JDK installed properly or it's non-standard location - R cannot find flags needed to compile JNI. You don't have either of ${JAVA_HOME}/include, ${JAVA_HOME}/../ include, ${JAVA_HOME}/jre/include so you'll need to figure out whether a) you just didn't install them or b) they are installed in a non- standard location. The fix for a) is to install them, the fix for b) is set set them using JAVA_CPPFLAGS when calling javareconf (and report back to us to see if that's something we can add to R). Cheers, Simon > Updating Java configuration in /usr/lib64/R > Done. > tutti i telefonini TIM! [[alternative HTML version deleted]] __ R-help@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.
[R] help with installation of local gzip-ped packages
I was suggested to install two tar-red and gzip-ped packages that are not part of CRAN or BioConductors yet. I read the R manual about Administration and could only find a good description of how to install packages not canonically included in CRAN repository, on UNIX systems. I work on Linux/SuSE and Windows ... so I am stuck with such an installation. Any suggestion in very welcome. Thank you. Maura tutti i telefonini TIM! [[alternative HTML version deleted]] __ R-help@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.
[R] Cannot install pakages from Bioconductor besides the default installation
I am running the last R version on SuSE 11.1. I installed the Bioconductor environment following the instructions on the web. As a consequence some core packages from Bioconductors were installed. I need to add some more packages. So I tried biomaRt as follows. It does not get installed correctly. Please see the following sequence. Thank you in advance. Maura > source("http://bioconductor.org/biocLite.R";) Warning messages: 1: In safeSource() : Redefining biocinstall 2: In safeSource() : Redefining biocinstallPkgGroups 3: In safeSource() : Redefining biocinstallRepos > > biocLite("biomaRt") Running biocinstall version 2.4.11 with R version 2.9.0 Your version of R requires version 2.4 of Bioconductor. Warning in install.packages(pkgs = pkgs, repos = repos, dependencies = dependencies, : argument 'lib' is missing: using '/home/mauede/R/x86_64-unknown-linux-gnu-library/2.9' also installing the dependencies XML, RCurl trying URL 'http://bioconductor.org/packages/2.4/extra/src/contrib/XML_2.5-1.tar.gz' Content type 'application/x-gzip' length 676201 bytes (660 Kb) opened URL == downloaded 660 Kb trying URL 'http://bioconductor.org/packages/2.4/extra/src/contrib/RCurl_0.98-1.tar.gz' Content type 'application/x-gzip' length 470071 bytes (459 Kb) opened URL == downloaded 459 Kb trying URL 'http://bioconductor.org/packages/2.4/bioc/src/contrib/biomaRt_2.0.0.tar.gz' Content type 'application/x-gzip' length 200617 bytes (195 Kb) opened URL == downloaded 195 Kb The downloaded packages are in /tmp/RtmpAtNws1/downloaded_packages Warning messages: 1: In install.packages(pkgs = pkgs, repos = repos, dependencies = dependencies, : installation of package 'XML' had non-zero exit status 2: In install.packages(pkgs = pkgs, repos = repos, dependencies = dependencies, : installation of package 'RCurl' had non-zero exit status 3: In install.packages(pkgs = pkgs, repos = repos, dependencies = dependencies, : installation of package 'biomaRt' had non-zero exit status > > library(biomaRt) Error in library(biomaRt) : there is no package called 'biomaRt' > ?getBM No matches for "getBM" have been found > ?getSequence No matches for "getSequence" have been found tutti i telefonini TIM! [[alternative HTML version deleted]] __ R-help@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.
[R] question about package biomaRt
Can biomaRt connect to data base "http://mirecords.umn.edu"; or a branch of it ... for instance the validated miRNAs list ..? Thank you very much. Maura tutti i telefonini TIM! [[alternative HTML version deleted]] __ R-help@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.
[R] R: Cannot install pakages from Bioconductor besides the default installation
Yes it is. I copied and pasted all the attempted installation messages. The installed Bioconductor environment is the latest released. Just installed yesterday. The dependencies ... well, should be automatically resolved.- Thank you, Maura -Messaggio originale- Da: Martin Morgan [mailto:mtmor...@fhcrc.org] Inviato: mar 23/06/2009 18.55 A: mau...@alice.it Cc: bioconductor-boun...@stat.math.ethz.ch; r-h...@stat.math.ethz.ch; Stefano Rovetta; Francesco Masulli; Chenna Reddy Oggetto: Re: [R] Cannot install pakages from Bioconductor besides the default installation Please ask Bioconductor questions on the Bioconductor mailing list https://stat.ethz.ch/mailman/listinfo/bioconductor Is the below a complete transcript of the outcome of biocLite('biomaRt')? I would have expected to see R attempt to install each package, and then perhaps XML failing to compile. This would mean that first RCurl and then biomaRt would fail to install. Likely XML would fail to install because of outdated system dependencies, but this is just speculation; is this really the complete output of the biocLite('biomaRt') command? Martin writes: > I am running the last R version on SuSE 11.1. > I installed the Bioconductor environment following the instructions on the > web. As a consequence some > core packages from Bioconductors were installed. > I need to add some more packages. So I tried biomaRt as follows. > It does not get installed correctly. > Please see the following sequence. > Thank you in advance. > Maura > >> source("http://bioconductor.org/biocLite.R";) > Warning messages: > 1: In safeSource() : Redefining 'biocinstall' > 2: In safeSource() : Redefining 'biocinstallPkgGroups' > 3: In safeSource() : Redefining 'biocinstallRepos' >> > biocLite("biomaRt") > Running biocinstall version 2.4.11 with R version 2.9.0 > Your version of R requires version 2.4 of Bioconductor. > Warning in install.packages(pkgs = pkgs, repos = repos, dependencies = > dependencies, : > argument 'lib' is missing: using > '/home/mauede/R/x86_64-unknown-linux-gnu-library/2.9' > also installing the dependencies 'XML', 'RCurl' > > trying URL > 'http://bioconductor.org/packages/2.4/extra/src/contrib/XML_2.5-1.tar.gz' > Content type 'application/x-gzip' length 676201 bytes (660 Kb) > opened URL > == > downloaded 660 Kb > > trying URL > 'http://bioconductor.org/packages/2.4/extra/src/contrib/RCurl_0.98-1.tar.gz' > Content type 'application/x-gzip' length 470071 bytes (459 Kb) > opened URL > == > downloaded 459 Kb > > trying URL > 'http://bioconductor.org/packages/2.4/bioc/src/contrib/biomaRt_2.0.0.tar.gz' > Content type 'application/x-gzip' length 200617 bytes (195 Kb) > opened URL > == > downloaded 195 Kb > > > The downloaded packages are in > '/tmp/RtmpAtNws1/downloaded_packages' > Warning messages: > 1: In install.packages(pkgs = pkgs, repos = repos, dependencies = > dependencies, : > installation of package 'XML' had non-zero exit status > 2: In install.packages(pkgs = pkgs, repos = repos, dependencies = > dependencies, : > installation of package 'RCurl' had non-zero exit status > 3: In install.packages(pkgs = pkgs, repos = repos, dependencies = > dependencies, : > installation of package 'biomaRt' had non-zero exit status >> > library(biomaRt) > Error in library(biomaRt) : there is no package called 'biomaRt' >> ?getBM > No matches for "getBM" have been found >> ?getSequence > No matches for "getSequence" have been found > > > > > > tutti i telefonini TIM! > > > [[alternative HTML version deleted]] > > __ > R-help@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. -- Martin Morgan Computational Biology / Fred Hutchinson Cancer Research Center 1100 Fairview Ave. N. PO Box 19024 Seattle, WA 98109 Location: Arnold Building M1 B861 Phone: (206) 667-2793 tutti i telefonini TIM! [[alternative HTML version deleted]] __ R-help@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.
[R] how to call Perl from R
I read some archived posts about calling R from Perl scripts. There seems to be an R package creating the necessaary interface. I'd like to do the opposite. That is to call Perl from an R script. I wonder whether this is possible at all ??? What about Bioperl which is a Perl variation built to deal with Bioinformatic datasets ? Thank you, Maura tutti i telefonini TIM! [[alternative HTML version deleted]] __ R-help@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.
[R] is there a way to extract fata from web pages through some R function ?
I deal with a huge amount of Biology data stored in different databases. The databases belongig to Bioconductor organization can be accessed through Bioconductor packages. Unluckily some useful data is stored in databases like, for instance, miRDB, miRecords, etc ... which offer just an interactive HTML interface. See for instance http://mirdb.org/cgi-bin/search.cgi, http://mirecords.umn.edu/miRecords/interactions.php?species=Homo+sapiens&mirna_acc=Any&targetgene_type=refseq_acc&targetgene_info=&v=yes&search_int=Search Downloading data manually from the web pages is a painstaking time-consumung and error-prone activity. I came across a Python script that downloads (dumps) whole web pages into a text file that is then parsed. This is possible because Python has a library to access web pages. But I have no experience with Python programming nor I like such a programming language whose syntax is indentation-sensitive. I am *hoping* that there exists some sort of web pages, HTML connection from R ... is there ?? Thank you very much for any suggestion. Maura tutti i telefonini TIM! [[alternative HTML version deleted]] __ R-help@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.
[R] Is there a way to extract some fields data from HTML pages through any R function ?
I deal with a huge amount of Biology data stored in different databases. The databases belongig to Bioconductor organization can be accessed through Bioconductor packages. Unluckily some useful data is stored in databases like, for instance, miRDB, miRecords, etc ... which offer just an interactive HTML interface. See for instance http://mirdb.org/cgi-bin/search.cgi, http://mirecords.umn.edu/miRecords/interactions.php?species=Homo+sapiens&mirna_acc=Any&targetgene_type=refseq_acc&targetgene_info=&v=yes&search_int=Search Downloading data manually from the web pages is a painstaking time-consumung and error-prone activity. I came across a Python script that downloads (dumps) whole web pages into a text file that is then parsed. This is possible because Python has a library to access web pages. But I have no experience with Python programming nor I like such a programming language whose syntax is indentation-sensitive. I am *hoping* that there exists some sort of web pages, HTML connection from R ... is there ?? Thank you very much for any suggestion. Maura tutti i telefonini TIM! [[alternative HTML version deleted]] __ R-help@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.
[R] R: Is there a way to extract some fields data from HTML pages through any R function ?
Thank you so much. I emailed the people who are in charge of maintaining miRecords and related info. I asked them for an available data transfer protocol like ftp or similar to avoid manually downloading haindreds of sequences from their web site. I got no feedback at all. Thanks again, Maura -Messaggio originale- Da: Martin Morgan [mailto:mtmor...@fhcrc.org] Inviato: mer 01/07/2009 17.51 A: mau...@alice.it Cc: r-h...@stat.math.ethz.ch Oggetto: Re: [R] Is there a way to extract some fields data from HTML pages through any R function ? Hi Maura -- mau...@alice.it wrote: > I deal with a huge amount of Biology data stored in different databases. > The databases belongig to Bioconductor organization can be accessed through > Bioconductor packages. > Unluckily some useful data is stored in databases like, for instance, miRDB, > miRecords, etc ... which offer just an > interactive HTML interface. See for instance > http://mirdb.org/cgi-bin/search.cgi, > > http://mirecords.umn.edu/miRecords/interactions.php?species=Homo+sapiens&mirna_acc=Any&targetgene_type=refseq_acc&targetgene_info=&v=yes&search_int=Search > > Downloading data manually from the web pages is a painstaking time-consumung > and error-prone activity. > I came across a Python script that downloads (dumps) whole web pages into a > text file that is then parsed. > This is possible because Python has a library to access web pages. > But I have no experience with Python programming nor I like such a > programming language whose syntax is indentation-sensitive. > > I am *hoping* that there exists some sort of web pages, HTML connection from > R ... is there ?? Tools in R for this are the RCurl package and the XML package. library(RCurl) library(XML) Typically this involves manual exploration of the web form, Then you might query the web form result <- postForm("http://mirdb.org/cgi-bin/search.cgi";, searchType="miRNA", species="Human", searchBox="hsa-let-7a", submitButton="Go") and parse the results into a convenient structure html <- htmlTreeParse(result, asText=TRUE, useInternalNodes=TRUE) you can then use XPath (http://www.w3.org/TR/xpath, especially section 2.5) to explore and extract information, e.g., ## second table, first row getNodeSet(html, "//table[2]/tr[1]") ## second table, makes subsequent paths shorter tbl <- getNodeSet(html, "//table[2]")[[1]] xget <- function(xml, path) # a helper function unlist(xpathApply(xml, path, xmlValue))[-1] df <- data.frame(TargetRank=as.numeric(xget(tbl, "./tr/td[2]")), TargetScore=as.numeric(xget(tbl, "./tr/td[3]")), miRNAName=xget(tbl, "./tr/td[4]"), GeneSymbol=xget(tbl, "./tr/td[5]"), GeneDescription=xget(tbl, "./tr/td[6]")) There are many ways through this latter part, probably some much cleaner than presented above. There are fairly extensive examples on each of the relevant help pages, e.g., ?postForm. Martin > Thank you very much for any suggestion. > Maura > > > tutti i telefonini TIM! > > > [[alternative HTML version deleted]] > > __ > R-help@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. tutti i telefonini TIM! [[alternative HTML version deleted]] __ R-help@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.