Displaying 20 results from an estimated 10000 matches similar to: "basic debugging"
2012 Jan 06
4
data.frame: temporal complexity
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 unaceptable: 24s !!
Is there any way to reduce complexity about O(n) ? for example 2 or 3s (10s
maxi)
2012 Feb 03
4
how to plot several curves in the same frame
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 plot 2 curves in the same frame: 1 for 2012-02-01 (on the
first line) and 1 for 2012-02-02 (on
2012 Feb 24
6
strange behaviour of "POSIXlt" "POSIXt" object
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 context:
2012 Feb 02
2
How to retrieve a column name of a data frame
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:
2012 Feb 27
2
RStudio: how to change language from fr(french) to eng(english)
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 Nabble.com.
2012 Feb 10
1
debug in a loop
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" for each step ... I'd like to declare a
"browser()" in the loop
2012 Jan 12
2
defmacro installation issue
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.6.2.zip'
Content type 'application/zip' length 102500 bytes (100 Kb)
2012 Jan 12
2
is there an equivalent for #ifdef (C langage) in R
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)
}
}else{
#here I use debug mode
c=a+b
}
I assume this would work... The problem is :
if
2012 Feb 09
1
how to specify the Oy axis length
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-length-tp4372937p4372937.html
Sent from the R help mailing list archive at Nabble.com.
2011 Dec 27
1
How to extract an interval of "hour:minute" type
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:00;67;
4352;2011-09-02 01:03:00;67;
4352;2011-09-02 01:04:00;67;
....
I loaded
2012 Feb 27
2
kmeans: how to retrieve clusters
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 82 2950.5
2 83 1831.5
3 1192 2899.0
4 1193 2103.5
The first cluster is the two first lines
the 2nd cluster is the two last lines
Here is the code:
x = colCandList$colCandInd
y = colCandList$colCandMed
m = matrix(c(x, y),
2012 Jan 12
1
how to select column wich median is in this interval [5;6]
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 interval [5;6] ( Here, for
instance, e1 and e3)
I would not want to use loop... (for, while)
I search
2012 Apr 05
2
how to compute a vector of min values ?
Hi,
I'd like to know how to get a vector of min value from many vectors without
making a loop. For example :
>v1 = c( 1, 2, 3)
> v2 = c( 2, 3, 4)
> v3 = c(3, 4, 5)
> df = data.frame(v1, v2, v3)
> df
v1 v2 v3
1 1 2 3
2 2 3 4
3 3 4 5
> min_vect = min(df)
> min_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
2012 Jun 01
1
Error: package 'myLib' is not installed for 'arch=i386'
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=French_France.1252
LC_MONETARY=French_France.1252 LC_NUMERIC=C
2012 Jan 19
1
dataframe: how to select an element from a row
Hi,
I 'd like to select the Date where myvalue =1800 appears the* first time*.
For instance:
df =data.frame(date, myvalue, ...)
...
Date myvalue
2012-01-05 2500
2012-01-06 2450
*2012-01-07 1800*
2012-01-08 2200
2012-01-09 1800
I'd like to retrieve the third line.
I do
2004 Nov 29
2
proper way to process dataframe by rows
This is a best practices / style question.
The way I use RODBC is I something like this:
> foo <- sqlQuery(db, "select * from foo")
> apply(foo, 1, function{...})
That is, I use apply to iterate over each result -- row -- in the
RODBC-produced dataframe. Is this how one generally wants to do this?
My concern is that when apply iterates over the rows, it uses
as.matrix()
2011 Jun 27
2
Add use of dput() to the instructions at bottom of post?
It's often difficult to figure out what a problem data set looks like when someone pastes a mess of output from R into an e-mail. The dput command, used judiciously?I would hope no one would send a 1 M data set?can make life much easier.
I wonder if it would be useful to add a hint in the instructions at the bottom of the posting page, where the list asks for self-contained reproducible
2018 Mar 26
2
unable to move temporary installation of package
I'm running Windows 10 / R Studio / R Open 3.4.3
Since getting a new computer recently I cannot install packages into my personal libpath directory, and I can't seem to update packages (it says all packages are up to date even if I manually install an old version). I've got 100% admin rights on the computer and in the library folder, I've set my R environment variable to specify
2009 Dec 03
3
[LLVMdev] patch for portability
Sorry, always end up not replying to the list:
The main issue with dealing with next this way is that people adding new
uses of next will probably not be using c++0x and therefore won't know it's
ambiguous and that it needs to be qualified.
There are also two issues with rvalue references and the STL:
1. EquivalenceClasses, in the insert and findLeader functions, it uses map
functions
2008 Feb 05
5
App upgrade steps from 1.2.4 to 2.0.2?
Hi all, experienced programmer but complete RoR newbie here, this is
my first rails post/question so bear with me. I have a working RoR
app on 1.2.4 and PostgreSQL, and my first efforts at running it in
2.0.2 show it does not cleanly upgrade without changes. Can anyone
give me some hints/pointers as to what I''ll need to change for 2.0.2
and how do I identify it other than trial and