[R] Is it possible to enter in a function wich is within a library ?

2012-09-28 Thread ikuzar
Hello, I'd like to know if it is Ipossible to enter in a function wich is included in a library ? I know how to debug function wich is in a R file (but not in a library). But it is not the case when the function is included in a library. I want to go step by step in this function in order to test

[R] Error: package 'myLib' is not installed for 'arch=i386'

2012-06-01 Thread ikuzar
Hello, I 'd like to use some functions in myLib. So I do: library(myLib) Then I get this message: Error: package 'myLib' is not installed for 'arch=i386' > sessionInfo() R version 2.13.2 (2011-09-30) Platform: i386-pc-mingw32/i386 (32-bit) locale: [1] LC_COLLATE=French_France.1252 LC_CTYPE=Fr

[R] how to compute a vector of min values ?

2012-04-05 Thread ikuzar
n_vect [1] 1 I 'd like to get min_vect = (1, 2, 3), where 1 is the min of v1, 2 is the min of v2 and 3 is the min of v3. The example above are very easy but, in real, I have got v1, v2, ... v1440 Thanks for your help, ikuzar -- View this message in context: http://r.789695.n4.nabble.com

Re: [R] strange behaviour of "POSIXlt" "POSIXt" object

2012-03-05 Thread ikuzar
Hi, I'd like to know what "L" means in "1L" in the instruction below: for(i in 1:20){ z$mday <- z$mday + 1L ; cat(is.na(z), ": ");print(z)} The result : FALSE : [1] "2009-02-26 06:30:00" FALSE : [1] "2009-02-27 06:30:00" FALSE : [1] "2009-02-28 06:30:00" FALSE : [1] "2009-03-01 06:30:00" FALSE :

Re: [R] kmeans: how to retrieve clusters

2012-02-28 Thread ikuzar
Hi, Ok, I understand what you mean. I wanted to get sorted data group by cluster in output ... But I have to do it myself using kres$cluster thanks for your help -- View this message in context: http://r.789695.n4.nabble.com/kmeans-how-to-retrieve-clusters-tp4426427p4427543.html Sent from th

[R] kmeans: how to retrieve clusters

2012-02-27 Thread ikuzar
Hello, I'd like to classify data with kmeans algorithm. In my case, I should get 2 clusters in output. Here is my data colCandInd colCandMed 1 822950.5 2 83 1831.5 3 1192 2899.0 4 1193 2103.5 The first cluster is the t

[R] RStudio: how to change language from fr(french) to eng(english)

2012-02-27 Thread ikuzar
Hello, RStudio displays errors in french . I'd like to change it in english Please help, Thanks -- View this message in context: http://r.789695.n4.nabble.com/RStudio-how-to-change-language-from-fr-french-to-eng-english-tp4424972p4424972.html Sent from the R help mailing list archive at Nabb

Re: [R] strange behaviour of "POSIXlt" "POSIXt" object

2012-02-27 Thread ikuzar
So, how is the correct way to increment the day ? -- View this message in context: http://r.789695.n4.nabble.com/strange-behaviour-of-POSIXlt-POSIXt-object-tp4418115p4425206.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-proj

Re: [R] strange behaviour of "POSIXlt" "POSIXt" object

2012-02-27 Thread ikuzar
Hi, I do not know what part of my code should I post here (I use large size of data, the loop "for" contains many lines). The situation is difficult to post here, but I hope these lines would be useful for help: hcEndDateTmp = userDateStart if((hcStartTime<="23:59") & (hcEndTime >= "00:00")){

[R] strange behaviour of "POSIXlt" "POSIXt" object

2012-02-24 Thread ikuzar
Hi, Does anybody know why get I this kind of strange situation: Browse[2]> hcEnd [1] "2009-03-29 06:30:00" Browse[2]> class(hcEnd) [1] "POSIXlt" "POSIXt" Browse[2]> is.na(hcEnd) [1] TRUE This issue is the source of my all issues in my program, Thanks for your help -- View this message in con

[R] debug in a loop

2012-02-10 Thread ikuzar
Hi, I'd like to debug in a loop (using debug() and browser() etc but not print() ). I'am looking for the first occurence of NA. For instance: tab = c(1:300) tab[250] = NA len = length(tab) for (i in 1:len){ if(i != len){ tab[i] = tab[i]+tab[i+1] } } I do not want to do "Browse[2]> n"

Re: [R] problem with arrows( )

2012-02-09 Thread ikuzar
I found the issue: arrows( ) , segments( ) do not accept argument of type POSIXlt. One must convert the argument into POSIXct and it works well. -- View this message in context: http://r.789695.n4.nabble.com/problem-with-arrows-tp4373152p4373422.html Sent from the R help mailing list archive at

[R] problem with arrows( )

2012-02-09 Thread ikuzar
Hello, I have got an issue with this code: plot(...) xMontant = as.POSIXlt(ecs$startAt[i]) xDescendant = as.POSIXlt(ecs$endAt[i]) arrows(xMontant, 0, xMontant, ecsPOW, col="green") Here is the error: "Erreur dans arrows(xMontant, 0, xMontant, ecsPOW, col = "green") : premier argument incorr

[R] how to specify the Oy axis length

2012-02-09 Thread ikuzar
Hi, I'd like to plot a point: plot(1,2) I use RStudio. I'd like to know how to specify the length of Oy axis. I 'd like to put 20 as length of Oy but , by default, I 've got 2.5. Thanks for your help -- View this message in context: http://r.789695.n4.nabble.com/how-to-specify-the-Oy-axis-len

[R] basic debugging

2012-02-08 Thread ikuzar
Hi, I have to debug my program. When I execute my function (in debug mode), I have got an error but I do not know which line is concerned. I do not want to do an infinite "Browse[2]>n with each line in my function... THanks for your help, ikuzar -- View this message in context:

Re: [R] how to plot several curves in the same frame

2012-02-03 Thread ikuzar
Ok. I really have 15 days to plot, the x-axis is the date, and it is going to the MINUTES in a day. I have to plot a curve per day (so 15 plots) The real data is like this: 2012-02-01 00:01:00; 2100 2012-02-01 02:02:00; 2200 ... 2012-02-15 23:58:00; 2400 2012-02-15 23:59:00; 2400 -- View t

Re: [R] how to plot several curves in the same frame

2012-02-03 Thread ikuzar
I use RStudio. I'd like to plot these curves in a new frame (out of RStudio) -- View this message in context: http://r.789695.n4.nabble.com/how-to-plot-several-curves-in-the-same-frame-tp4354165p4354261.html Sent from the R help mailing list archive at Nabble.com. ___

[R] how to plot several curves in the same frame

2012-02-03 Thread ikuzar
Hello, I'd like to know how to plot several curves in the same frame (1curve = 1line=1day). For instance (csv file): 2012-02-01 01:00:00; 2100 2012-02-01 02:00:00; 2200 ... 2012-02-01 23:00:00; 2500 2012-02-02 01:00:00; 1000 2012-02-02 02:00:00; 1500 ... 2012-02-02 23:00:00; 1700 Here, I have to

Re: [R] How to retrieve a column name of a data frame

2012-02-02 Thread ikuzar
Sorry, it was not clear: my program have to return column name corresponding to a value, for example 'b' (so, the corresponding column is c1) How to retrieve c1 ? Thanks -- View this message in context: http://r.789695.n4.nabble.com/How-to-retrieve-a-column-name-of-a-data-frame-tp4351764p435186

[R] How to retrieve a column name of a data frame

2012-02-02 Thread ikuzar
Hi, I 'd like to know how to retrieve a column name of a data frame. For instance : df = data.frame(c1=c('a','b'),c2=c(1,2)) > df c1 c2 1 a 1 2 b 2 I would like to retrieve the column name which value is 2 (here, the column is c2) thanks for your help -- View this message in context: h

Re: [R] dataframe: how to select an element from a row

2012-01-20 Thread ikuzar
This works but I do not know if there is a better way tmp = df[df$myvalue<2000,] ind = match(tmp$myvalue, df$myvalue) res = df$DateTime[ind] solution = list(ind[1], res[1]) -- View this message in context: http://r.789695.n4.nabble.com/dataframe-how-to-select-an-element-from-a-row-tp4311881p43

Re: [R] dataframe: how to select an element from a row

2012-01-20 Thread ikuzar
Thank you Jorge and Florent for your responses. Now, I 'd like to get the date *(and its index) *where myvalue < 2000 for the first time. I expect for a result like (index, date) = (3, 2012-01-07 ) This way does not work: ind = match(df$myvalue <2000, df$myvalue) res = df$DateTime[ind] -- View

[R] dataframe: how to select an element from a row

2012-01-19 Thread ikuzar
Hi, I 'd like to select the Date where myvalue =1800 appears the* first time*. For instance: df =data.frame(date, myvalue, ...) ... Datemyvalue 2012-01-052500 2012-01-06 2450 *2012-01-07 1800* 2012-01-08

[R] how to select column wich median is in this interval [5;6]

2012-01-12 Thread ikuzar
Hello, I have got a data frame df like this : > df e1 e2 e3 e4 1 1 11 1 21 2 2 12 2 22 3 3 13 3 23 4 4 14 4 24 5 5 15 5 25 6 6 16 6 26 7 7 17 7 27 8 8 18 8 28 9 9 19 9 29 10 10 20 10 30 where e1 ... e3 are vectors I have to select columns which median is in the inter

[R] is there an equivalent for #ifdef (C langage) in R

2012-01-12 Thread ikuzar
Hi, I'd like to know if there is an equivalent for #ifdef (Clangage) in R. I 'd like to do something like: useDebug = defmacro(DEBUG, expr=(DEBUG==1)) if(useDebug(0)){ #Here I do not use debug mode make_addition = function(a, b) { c=a+b plot(c) return(c) } }e

[R] defmacro installation issue

2012-01-12 Thread ikuzar
Hi everybody, I want to use macro in my R code. But defmacro was not in my libraries. So I installed it : > install.packages("gtools") Installing package(s) into ‘C:/Program Files/R/R-2.13.2/library’ (as ‘lib’ is unspecified) essai de l'URL 'http://cran.cict.fr/bin/windows/contrib/2.13/gtools_2.

Re: [R] data.frame: temporal complexity

2012-01-06 Thread ikuzar
I did not test this way, I 'll do it later, I think that df$diffP <- c(NA, NA, diff(df$P,2)) is the best way to compute the difference !! I 'll post the result here -- View this message in context: http://r.789695.n4.nabble.com/data-frame-temporal-complexity-tp4269585p4270256.html Sent from the

Re: [R] data.frame: temporal complexity

2012-01-06 Thread ikuzar
Ok, thanks, it works ! -- View this message in context: http://r.789695.n4.nabble.com/data-frame-temporal-complexity-tp4269585p4270073.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list https://stat.ethz.

[R] data.frame: temporal complexity

2012-01-06 Thread ikuzar
Hello, I created a data.frame which contains two columns: df$P (Power) et df$DateTime (time). I'd like to add a new column df$diffP (difference of Power between T and T-2). I made a loop : for (i in 3:length(df$DateTime)){ df$diffP[i] = df$P[i] - df$P[i-2] } execution time result is unacept

Re: [R] How to extract an interval of "hour:minute" type

2011-12-27 Thread ikuzar
Jim Holtman > I'd like to compare "hour1:min1:sec1" with "hour2:min2:sec2". I know how to do to compare "year1-mon1-day1 hour1:min1:sec1" with "year2-mon2-day2 hour2:min2:sec2" by converting 'character' into POSIXlt but I'd like to konw if there is another way to do this comparison without con

[R] How to extract an interval of "hour:minute" type

2011-12-27 Thread ikuzar
Hi, I 'd like to know how to extract an interval of "hour:minute" type from a column of POSIXlt POSIXct type. For instance: my_data.csv: 4352;2011-09-02 21:30:00;3242; 4352;2011-09-02 21:31:00;3315; 4352;2011-09-02 21:32:00;4241; 4352;2011-09-02 21:33:00;5394; ... 4352;2011-09-02 01:02: