Re: [R] Creating dates to plot

2012-11-16 Thread PtitBleu
Hello Eric, strptime(201206,format=%Y%m) gives NA (I don't know why but I'm a newbie). The only solution I found is to add 01 as a day to have a complete date (Year Month Day): x$Period-as.Date(paste(x$Period,01,sep=),format=%Y%m%d) Then you get a Date format you can use to plot graph. I think

Re: [R] add constraints to nls or use another function

2012-07-09 Thread PtitBleu
bbolker wrote PtitBleu ptit_bleu at yahoo.fr writes: Hello, I'm trying to fit experimental data with a model and nls. For some experiments, I have data with x from 0 to 1.2 and the fit is quite good. But it can happen that I have data only the [0,0.8] range (see the example

Re: [R] How to use Sys.time() while writing a csv file name

2012-07-04 Thread PtitBleu
Hello, It seems that there is a problem with :. If you only need the date, you can use as.Date(Sys.time()) instead of the complete form. If you need the time, you can try the following commands which change the : into - : newsystime--format(Sys.time(),%Y-%m-%d-%H-%M-%S)

[R] add constraints to nls or use another function

2012-06-28 Thread PtitBleu
Hello, I'm trying to fit experimental data with a model and nls. For some experiments, I have data with x from 0 to 1.2 and the fit is quite good. But it can happen that I have data only the [0,0.8] range (see the example below) and, then, the fit is not correct. I would like to add a

Re: [R] add horizontal reference lines in lattice bwplot

2012-06-13 Thread PtitBleu
Hello Gareth, Concerning the lines, you can try : panel.abline(h=13) and panel.grid(h=2, v=0, y=c(11, 12), col.line=blue) I have no idea for the annotation. Sorry. Ptit Bleu. -- View this message in context:

Re: [R] Filling color's points in legend's plot in R

2012-01-19 Thread PtitBleu
Hello Tsidkenu, Not sure that I have well understood your question but maybe you can add fill to your legend function : legend(10,90,legend=c(TR=100 años,TR=50 años,TR=25 años,TR=10 años),lwd=2,pt.cex=1.5,bty='n',pch=c(24,22,21,23), fill=c(red,green,blue,black)) Have a good day, Ptit Bleu. --

[R] lm and R-squared (newbie)

2011-12-15 Thread PtitBleu
Hello, I've two data.frames (data1 and data4), dec=. and sep=;. http://r.789695.n4.nabble.com/file/n4199964/data1.txt data1.txt http://r.789695.n4.nabble.com/file/n4199964/data4.txt data4.txt When I do plot(data1$nx,data1$ny, col=red) points(data4$nx,data4$ny, col=blue) , results seem very

[R] newbie's question : xyplot legend with a white background

2011-11-10 Thread PtitBleu
Hello, Sorry in advance for adding a silly question on this forum but I haven't found the right keywords to find a solution to this basic problem. I'm just looking a way to have a white background behind the legend to hide the grid. Thanks in advance. The silly example for my silly question:

[R] How to find seasonal effect and trend from raw data (newbie ...)

2011-10-25 Thread PtitBleu
Hello, From the data provided in the attached file, I would like to find the seasonal effect and the trend (if there are some) like in page 10 of the following document: http://www.statoek.wiso.uni-goettingen.de/veranstaltungen/zeitreihen/sommer03/ts_r_intro.pd

[R] Homography with R

2011-09-23 Thread PtitBleu
Hello, I would like to know if it exists a package including something equivalent to this page: http://www.developpez.net/forums/d740403/autres-langages/algorithmes/contribuez/image-geometrie-projective-homography/

Re: [R] Problem with legend

2011-09-20 Thread PtitBleu
Maybe by adding col=c(grey,white,white), bg=white but not sure ... Have a nice end of day, Ptit Bleu. -- View this message in context: http://r.789695.n4.nabble.com/Problem-with-legend-tp3826973p3827120.html Sent from the R help mailing list archive at Nabble.com.

[R] RODBC sqlSave problem with bigint numbers

2011-07-27 Thread PtitBleu
Hello, After a (bad) first try some months ago, I'm trying again to use RODBC package instead of DBI+RMySQL packages to populate MySQL database. The main command is sqlSave(channel, data_df, tablename, append=T, rownames=FALSE, colnames=FALSE, fast=FALSE, varTypes=vartypes) where data_df is the

Re: [R] RODBC sqlSave problem with bigint numbers

2011-07-27 Thread PtitBleu
I've just tested with 12 figures instead of 13. And it works ... But I'm not able to modify these numbers as they are codes given by other guys (and women as well) to distinguish equipments. And I thought the limit with R was 15 digits and not 13. Is it a (bad for me) special feature of the

Re: [R] RODBC sqlSave problem with bigint numbers

2011-07-27 Thread PtitBleu
I spent all the day on this problem and I've just finally found a solution: with options(digits=13), it now works. If I hadn't found this, I would have used the solution of Renaud (but not very convenient to me). Nice end of day, (Happy) Ptit Bleu. -- View this message in context:

Re: [R] Problem with long number (from character to numeric class)

2011-02-10 Thread PtitBleu
Hello Dan, I just need to make substractions, comparisons and to use them in a split command. Ptit Bleu. Hello, I have a text file with one column containing long number but stored as string. I download the file with read.table (and colClass) and the first row of this column is :

[R] Problem with long number (from character to numeric class)

2011-02-09 Thread PtitBleu
Hello, I have a text file with one column containing long number but stored as string. I download the file with read.table (and colClass) and the first row of this column is : 095842087016731010 As I need to make some calculations with these numbers, I tried to convert them using as.numeric.

Re: [R] Insert variable in RMySQL-Statement

2011-02-09 Thread PtitBleu
Maybe this solution will help you. Ptit Bleu. library(DBI) library(RMySQL) drv-dbDriver(MySQL) con-dbConnect(drv, username=my_name, password=my_pwd, dbname=my_db, host=localhost) for (a in values) { requete-paste(select * from db where id=,a,sep=) rs-dbSendQuery(con, requete)

Re: [R] Problem with long number (from character to numeric class)

2011-02-09 Thread PtitBleu
Thanks for all your answers. I didn't know this limit. I finally found another way to go around this problem: luckily the 4 first figures are always the same for all these numbers. I created a new column with as.numeric(substr(df$BigNumber,5,18)). Numbers are now 14-figures long and it is now

[R] How to find the right devices in a minimum number of boxes

2011-02-08 Thread PtitBleu
Hello, with the following post, I don't expect a solution (I have not usable example) but some keywords to find the right package and/or functions to solve my problem. Thanks in advance for your help. Ptit Bleu. PS : but if you have the solution, of course, it is ok for me :-) Here is an

[R] RODBC : how to avoid truncatig big integer when using sqlsave

2011-02-04 Thread PtitBleu
Hello, I'm still trying to modify my script in order to use RODBC instead of RMySQL (no more ready-to-use package for windows). My new problem is the following one (not seen with RMySQL): I'd like to copy a data.frame to a mysql table. One column is a numeric one with big integer like :

Re: [R] sqlsave and mysql database with autoincremental column

2011-02-03 Thread PtitBleu
I found a solution (certainly not the best one but it works). I add a 45th column full of 0 to the 44-columns data.frame. When I copy the data.frame to the database with sqlsave, the last column of the table is not full of 0, but it autoincrements. Another small question: what is the command to

[R] sqlsave and mysql database with autoincremental column

2011-02-01 Thread PtitBleu
Hello, I'm trying to modify my r-script to use RODBC instead of DBI/RMySQL (no more ready-to-use package for windows). I would like to copy a data.frame of 44 columns to a table of 45 columns (the 45th is an autoincremental column). With the following commands, colnames(df)- a vector with

Re: [R] Accessing MySQL Database in R

2011-01-20 Thread PtitBleu
Hello, I used to use RMySQL but as there is no more package for windows, I decided to move to RODBC. I installed ODBC driver for MySQL (downloaded on the MySQL website) and then the RODBC package. I finally discovered that it was not needed to register your database with ODBC before using it.

Re: [R] rprofile.site

2011-01-11 Thread PtitBleu
Hello Julian, I'm not sure my answer will be very helpful to you but it seems that Tinn-R looks for Rprofile.site at the old place (R/bin/etc). With the new R configuration, this file is in now R/bin. Maybe you can try to copy the Rprofil.site file to the place expected by Tinn-R. I also found

Re: [R] looking for the RMySQL package for R 2.12.0 under XP

2011-01-05 Thread PtitBleu
Hello David, As I had no time to try to compile the RMySQL package, I finally followed your advice and moved to RODBC. The decision to modify my scripts was taken after I discovered the function odbcDriverConnect which allow to directly connect to database (like RMySQL) without declaring the

[R] xyplot : superimposed 2 groups in different panels

2010-11-30 Thread PtitBleu
Hello, I would like to plot the following xyplot : for each date of fff (1 date per panel), bbb=f(aaa) for the two groups (ddd=1 and ddd=2) superimposed. I can do it by group (see below) but not together. I looked at http://lmdvr.r-forge.r-project.org/figures/figures.html but I haven't found

[R] Still confused with lapply

2010-11-30 Thread PtitBleu
Hello Petr, After your message, I finally decided to have a look in my script and to modify the functions. There is no more loop on rows and functions calling functions. I now use new functions applied on complete columns and I also use your 'matrix' tip (Very useful). Result: with the old

Re: [R] xyplot : superimposed 2 groups in different panels

2010-11-30 Thread PtitBleu
Simply thank you. It is exactly what I wanted. Have nice day, Ptit Bleu (under snow) -- View this message in context: http://r.789695.n4.nabble.com/xyplot-superimposed-2-groups-in-different-panels-tp3065509p3066747.html Sent from the R help mailing list archive at Nabble.com.

Re: [R] looking for the RMySQL package for R 2.12.0 under XP

2010-11-25 Thread PtitBleu
Thank you for all your answers. I've looked at RODBC but it seems that you have to declare the database with the administration tools before using it . With RMySQL, you can do it directly in the R-script which is very convenient for me as I regularly treat new databases. For those who already

[R] looking for the RMySQL package for R 2.12.0 under XP

2010-11-24 Thread PtitBleu
Hello, I convinced our new Ph student to work with R and I managed to convince the guy in charge of the computer networks to install R 2.12.0 (we haven't the admin rights). I wanted to install on his computer the same packages I use (but I have R 2.11) and especially RMySQL. Problem : there is

[R] Still confused with lapply

2010-11-19 Thread PtitBleu
Hello, I would like to replace a for loop with lapply in order to speed up the treatment of my data (I've read lapply can help to do it). At the end of the message, you will find a simple example (function is more complex and data frames is more than 1 million of rows) of what I would like to

Re: [R] Still confused with lapply

2010-11-19 Thread PtitBleu
Thanks for your answer but do you have a solution using the function ? I need to you use the data frame with a function (not the one given). Thanks in advance again. Ptit Bleu. -- View this message in context: http://r.789695.n4.nabble.com/Still-confused-with-lapply-tp3050414p3050455.html Sent

Re: [R] Odp: Still confused with lapply

2010-11-19 Thread PtitBleu
Hello Petr, Your solution works well with my example. But with the function I want to use (which calls another functions), I still have errors. I have to work on it again (but only on monday). Again thank you, Ptit Bleu. PS : I have access to all the functions but I don't want to modify all of

Re: [R] Add values of rlm coefficients to xyplot

2010-11-09 Thread PtitBleu
Hello again, Thanks to this forum, I found a lapply command to apply rlm to each Device of the Name column of the df1 data frame (df1 data frame is given in the previous post). I'm now looking for a nice way to create a data frame with the name of the device, the intercept and the slope. I now

Re: [R] Add values of rlm coefficients to xyplot

2010-11-09 Thread PtitBleu
Thank you very much David for the advice ! I haven't checked the plyr and data.table packages but here is the script to replace the for loop :: dfrlm1-as.data.frame(do.call(rbind, lapply(split(df1, df1$Name), function(X){coef(rlm(col2 ~ col3, data=X))}))) names(dfrlm1)-c(Intercept, Slope) Have

[R] Add values of rlm coefficients to xyplot

2010-11-08 Thread PtitBleu
Hello, I have a simple xyplot with rlm lines. I would like to add the a and b coefficients (y=ax+b) of the rlm calculation in each panel. I know I can do it 'outside' the xyplot command but I would like to do all at the same time. I found some posts with the same question, but no answer. Is

Re: [R] Update RMySQL and ... it's no more running

2010-09-24 Thread PtitBleu
Hello, After an upgrade, RGui was crashing each time I was trying to connect to MySQL database. The error message was again : 'RMySQL was compiled with MySQL 5.0.67 but loading MySQL 5.1.44' I found an https://stat.ethz.ch/pipermail/r-sig-db/2009q1/000572.html old discussion giving this

Re: [R] loadlibrary failure

2010-09-24 Thread PtitBleu
Hello Eduardo, Maybe have a look at this thread : http://r.789695.n4.nabble.com/Update-RMySQL-and-it-s-no-more-running-td1561401.html#a1561401 Update RMySQL and ... it's no more running The last message gives a link to a procedure to configure RMySQL. It worked for me. Have a nice week-end,

[R] Problem with as.POSIXlt$hour

2010-06-15 Thread PtitBleu
Hello, In one of my functions, I need to extract the hour from a date. For example: as.POSIXlt(2010-03-27 02:00:00)$hour gives 2 as expected. It works for all the dates I've tested except the following one which is in my list of dates: as.POSIXlt(2010-03-28 02:00:00)$hour which gives 0. I don't

Re: [R] Problem with as.POSIXlt$hour

2010-06-15 Thread PtitBleu
Hello again, You are right: it corresponds to the DST time transition in France (I think you have guessed it was France from my Frenglish style - sorry about it). To get around this problem, I now use : as.numeric(format(strptime(2010-03-28 02:00:00, format=%Y-%m-%d %H:%M:%S), format=%H))

[R] looking for a package to solve current-voltage equation I=f(I)

2010-03-12 Thread PtitBleu
Hello, I'm looking for a R-package to solve such an equation : http://n4.nabble.com/file/n1590462/iv.png which is one current-voltage equation of a solar cell. Thanks in advance, Ptit Bleu. -- View this message in context:

[R] Update RMySQL and ... it's no more running

2010-02-19 Thread PtitBleu
Hello, I updated the RMySQL (and DBI) package but, since, it doesn't run anymore. I followed the advices given here http://biostat.mc.vanderbilt.edu/wiki/Main/RMySQL but with no success. I also copied the libMySQL.dll in the bin directory of R. Also no good result. The error message (in french

Re: [R] Update RMySQL and ... it's no more running

2010-02-19 Thread PtitBleu
Hello again, After 'googling', I set the environment variable MYSQL_HOME value to the path to MYSQL with the command below. I get a warning (is it a problem or not ???) but I managed to connect to my databases. But when I close and open again R, the connection is lost. I have to run the command

Re: [R] Update RMySQL and ... it's no more running

2010-02-19 Thread PtitBleu
Just to say that I found the place to set the environment variables (Computer/Properties/Advanced/Environment variables). The warning is still there but the connection seems ok. Concerning the warning, do you think I have to install an older version of mysql ? By the way, I also copied

[R] executable R script under xp (to avoid migration toward Matlab or C++)

2010-02-15 Thread PtitBleu
Hello, I discovered R two years ago and thanks to the R-community I managed to write some scripts to analyze my data stored in mysql databases. The only problem is that I am the only one using R in the lab. Colleagues mainly use Matlab (but not with mysql, only with text files) but regularly

Re: [R] executable R script under xp (to avoid migration toward Matlab or C++)

2010-02-15 Thread PtitBleu
Thanks to all for your advices. littler is not for xp, isn'it ? Anyway, I will try to convince my boss to keep R. But I'm not sure that I will be successful (there is a pressure to have a single language for all the scripts and even money for that ...). And for this year I have been registered

Re: [R] executable R script under xp (to avoid migration toward Matlab or C++)

2010-02-15 Thread PtitBleu
Hello everyone, Barry : Thanks for the link to Rscript. I will check this possibility (the os was not given in the text, but in subject :-)) Romain : I think my skills at computing are too low for your solution (I only know a bit of R and of Quick Basic ... nothing with C, C++, ...) and I also

[R] lattice - 2 graphs per panel with 2 differents colours

2009-12-11 Thread PtitBleu
Hello, I would like to get a lattice plot of 8 panels (unique(df$fact)=8) with 2 graphs (df$y1 and df$y2 as a function of df$x) and 1 red point at (500, ymax) per panel. The script below is quite ok but I'm not able to define two different colors for the two graphs. If you have an idea how to

[R] Problem with date x-axis

2009-12-04 Thread PtitBleu
Hello, I have a friday problem. I'm trying to plot the number of measures by day with this command between the 2008-07-31 and the 2009-11-13 (it works) : plot(unique(as.Date(strptime(data$date, format=%Y-%m-%d %H:%M:%S))), measuresbyday) then I would like to plot vertical lines for each month.