Re: [R] transform a list of arrays to tibble

2023-10-17 Thread arnaud gaboury
y want a tibble that allows you > to know what each row is for, consider one of many methods for saving the > previous row names as a new column. I used that to take the data.frame > version I made above and got: > > > temp <- as_tibble(result.df, rownames="rows")

[R] transform a list of arrays to tibble

2023-10-17 Thread arnaud gaboury
I work with a list of crypto assets daily closing prices in a xts class. Here is a limited example: asset.xts.lst <- list(BTCUSDT = structure(c(26759.63, 26862, 26852.48, 27154.15, 27973.45), dim = c(5L, 1L), index = structure(c(1697068800, 1697155200, 1697241600, 1697328000, 1697414400), tzone =

Re: [R] replace character by numeric value

2023-09-28 Thread arnaud gaboury
Are you trying to test contrasts maybe? I would be surprised if > the function for the statistical test you are trying to use does not > deal with that already on its own. > > HTH, > Ivan > > > On 27/09/2023 13:01, arnaud gaboury wrote: > > I have two data.frames: >

[R] replace character by numeric value

2023-09-28 Thread arnaud gaboury
I have two data.frames: mydf1 <- structure(list(symbol = "ETHUSDT", cummulative_quote_qty = 1999.9122, side = "BUY", time = structure(1695656875.805, tzone = "", class = c("POSIXct", "POSIXt"))), row.names = c(NA, -1L), class = c("data.table", "data.frame")) mydf2 <- structure(list(symbol =

[R] apply a function to a list of lists

2023-09-20 Thread arnaud gaboury
I have a list of 9 lists called my.list. Each one of these 9 lists is itself a list of 6 data.frames. Most of these data.frames have 0 rows and 0 columns. I want to return all data.frames from the list with row numbers different from 0. I first created the following function: non_empty_df <-

[R] getting historical data from cryptocurrency exchange

2020-11-25 Thread arnaud gaboury
I need to download basic OHLCV (Open, High, Low, Close, Volume) in a hourly format from various cryptocurrency exchanges. There is the crypto package[0] but it has been removed from CRAN. Then there is the coinmarketcapr[1] package on CRAN, but it is limited to a paid service, coinmarketcap, which

[R] change col types of a df/tbl_df

2015-12-10 Thread arnaud gaboury
Here is a sample of my data frame, obtained with read_csv2 from readr package. myDf <- structure(list(X15 = c("30.09.2015", "05.10.2015", "30.09.2015", "29.09.2015", "10.10.2015"), X16 = c("02.10.2015", "06.10.2015", "01.10.2015", "01.10.2015", "13.10.2015"), X17 = c("Grains", "Grains",

Re: [R] change col types of a df/tbl_df

2015-12-10 Thread arnaud gaboury
On Thu, Dec 10, 2015 at 12:54 PM, Duncan Murdoch <murdoch.dun...@gmail.com> wrote: > On 10/12/2015 6:12 AM, arnaud gaboury wrote: > >> Here is a sample of my data frame, obtained with read_csv2 from readr >> package. >> >> myDf <- structure(list(X15 = c(

Re: [R] change col types of a df/tbl_df

2015-12-10 Thread arnaud gaboury
On Thu, Dec 10, 2015 at 1:47 PM, Giorgio Garziano < giorgio.garzi...@ericsson.com> wrote: > my_convert <- function(col) { > v <- grep("[0-9]{2}.[0-9]{2}.[0-9]{4}", col); > w <- grep("[0-9]+,[0-9]+", col) > col2 <- col > if (length(v) == length(col)){ > col2 <- as.Date(col,

[R] R environment variables

2015-10-10 Thread arnaud gaboury
I was doing some cleaning ony my linux machine and, among others, I try to clean my R environment variables accordingly [0] and [1]. I am not really sure how to declare in a clean manner these startup variables. Here is my setup: 1- my home folder -$ ls ~/.config/R env/ helper/ Renviron

[R] Build R with optimized BLAS library

2015-08-22 Thread arnaud gaboury
I want to build R with an optimized BLAS library. My OS: Fedora 22 Hardware: CPU op-mode(s): 32-bit, 64-bit Byte Order: Little Endian CPU(s): 8 Thread(s) per core: 2 Vendor ID: GenuineIntel Model name: Intel(R) Core(TM) i7-2600K CPU @ 3.40GHz I am a little confused when it comes to choose a

Re: [R] Build R with optimized BLAS library

2015-08-22 Thread arnaud gaboury
#. rocks...1k --- Sent from my phone. Please excuse my brevity. On August 22, 2015 7:51:39 AM PDT, arnaud gaboury arnaud.gabo...@gmail.com wrote: I want to build R with an optimized BLAS library. My OS: Fedora 22 Hardware: CPU op-mode

Re: [R] Running R in Server

2015-08-18 Thread arnaud gaboury
On Sun, Aug 16, 2015, 2:29 PM Swagato Chatterjee swagato1...@gmail.com wrote: Hello, I have written a R script which runs a regression of a dataset and saves the result in a csv file. Now this dataset has to be edited periodically which is done in a server. I need to run the R script in a

[R] misbehavior with extract_numeric() from tidyr

2015-04-20 Thread arnaud gaboury
R 3.2.0 on Linux library(tidyr) playerStats - c(LVL 10, 5,671,448 AP l6,000,000 AP, Unique Portals Visited 1,038, XM Collected 15,327,123 XM, Hacks 14,268, Resonators Deployed 11,126, Links Created 1,744, Control Fields Created 294, Mind Units Captured 2,995,484

Re: [R] misbehavior with extract_numeric() from tidyr

2015-04-20 Thread arnaud gaboury
, arnaud gaboury arnaud.gabo...@gmail.com wrote: On Mon, Apr 20, 2015 at 9:10 AM, arnaud gaboury arnaud.gabo...@gmail.com wrote: R 3.2.0 on Linux library(tidyr) playerStats - c(LVL 10, 5,671,448 AP l6,000,000 AP, Unique Portals Visited 1,038, XM Collected

Re: [R] misbehavior with extract_numeric() from tidyr

2015-04-20 Thread arnaud gaboury
On Mon, Apr 20, 2015 at 9:10 AM, arnaud gaboury arnaud.gabo...@gmail.com wrote: R 3.2.0 on Linux library(tidyr) playerStats - c(LVL 10, 5,671,448 AP l6,000,000 AP, Unique Portals Visited 1,038, XM Collected 15,327,123 XM, Hacks 14,268, Resonators Deployed

Re: [R] misbehavior with extract_numeric() from tidyr

2015-04-20 Thread arnaud gaboury
, Apr 20, 2015 at 12:10 AM, arnaud gaboury arnaud.gabo...@gmail.com wrote: R 3.2.0 on Linux library(tidyr) playerStats - c(LVL 10, 5,671,448 AP l6,000,000 AP, Unique Portals Visited 1,038, XM Collected 15,327,123 XM, Hacks 14,268, Resonators Deployed

Re: [R] Error when loading shared library - stringini()

2015-04-16 Thread arnaud gaboury
On Thu, Apr 16, 2015 at 3:25 PM, arnaud gaboury arnaud.gabo...@gmail.com wrote: On a Linux 64 bits, R.3.1.2, with tidyr() loaded. gabx@hortensia [R] separate(rawStats, 'toto') Error in dyn.load(file, DLLpath = DLLpath, ...) : unable to load shared object '/developement/language/r/library

[R] Error when loading shared library - stringini()

2015-04-16 Thread arnaud gaboury
On a Linux 64 bits, R.3.1.2, with tidyr() loaded. gabx@hortensia [R] separate(rawStats, 'toto') Error in dyn.load(file, DLLpath = DLLpath, ...) : unable to load shared object '/developement/language/r/library/stringi/libs/stringi.so': libicui18n.so.54: cannot open shared object file: No such

Re: [R] Running R Remotely on LINUX

2015-04-15 Thread arnaud gaboury
On Tue, Apr 14, 2015 at 10:09 PM, John Sorkin jsor...@grecc.umaryland.edu wrote: I suggest that you investigate installing RStudio server on the Linux Box. If you do this, you can logon to RStudio (on the Linux server), and it will look exactly like RStudio running on a windows box. You may

Re: [R] Running R Remotely on LINUX

2015-04-14 Thread arnaud gaboury
On Tue, Apr 14, 2015 at 7:09 PM, Sarah Goslee sarah.gos...@gmail.com wrote: Hi Michael, On Tue, Apr 14, 2015 at 12:57 PM, Michael Haenlein haenl...@escpeurope.eu wrote: Dear all, I am used to running R locally on my Windows-based PC. Since some of my computations are taking a lot of

[R] replace values in one df by values from key pairs in another df

2015-02-13 Thread arnaud gaboury
I have been searching for a while now, but can't put all pieces of the puzzle together. Goal : I want to replace all these kinds of patterns @U032FHV3S by this @agreenmamba. In a more generic way, it is replacing 'id' by user 'name'. I have two df: The first, 'history', is some message history

Re: [R] replace values in one df by values from key pairs in another df

2015-02-13 Thread arnaud gaboury
This is the wrong part of my code. idName=users[users$id %in% ext] idname 1: U03AEKWTL agreenmamba 2: U032FHV3S poisonivy 3: U03AEKYL4 vairis Best is to use: idNames - users[pmatch(ext, users$id, duplicates.ok = T)]. This leave me with an ordered and duplicate

Re: [R] gsub : replace regex pattern with values from another data.frame

2015-02-12 Thread arnaud gaboury
On Thu, Feb 12, 2015 at 3:40 PM, arnaud gaboury arnaud.gabo...@gmail.com wrote: I have two df (and dt): df1 structure(list(name = c(poisonivy, poisonivy, poisonivy, poisonivy, poisonivy, poisonivy, poisonivy, poisonivy, cruzecontrol, agreenmamba, agreenmamba, vairis, vairis, vairis, vairis

Re: [R] gsub : replace regex pattern with values from another data.frame

2015-02-12 Thread arnaud gaboury
On Thu, Feb 12, 2015 at 7:12 PM, arnaud gaboury arnaud.gabo...@gmail.com wrote: On Thu, Feb 12, 2015 at 3:40 PM, arnaud gaboury arnaud.gabo...@gmail.com wrote: I have two df (and dt): df1 structure(list(name = c(poisonivy, poisonivy, poisonivy, poisonivy, poisonivy, poisonivy, poisonivy

[R] apply two functions to column

2015-02-12 Thread arnaud gaboury
I am little lost between all the possibilities to apply a function to a data.frame or data.table. Here is mine: structure(list(name = c(poisonivy, poisonivy, poisonivy, poisonivy, poisonivy, poisonivy, poisonivy, poisonivy, cruzecontrol, agreenmamba, agreenmamba, vairis, vairis, vairis, vairis,

[R] gsub : replace regex pattern with values from another data.frame

2015-02-12 Thread arnaud gaboury
I have two df (and dt): df1 structure(list(name = c(poisonivy, poisonivy, poisonivy, poisonivy, poisonivy, poisonivy, poisonivy, poisonivy, cruzecontrol, agreenmamba, agreenmamba, vairis, vairis, vairis, vairis, vairis, vairis, xaeth), text = c(ok, need items ?, i didn't submit pass codes for a

[R] upgrading issues with Rcpp

2015-02-11 Thread arnaud gaboury
gabx@hortensia [R] sessionInfo() R version 3.1.2 (2014-10-31) Platform: x86_64-unknown-linux-gnu (64-bit) locale: [1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C LC_TIME=en_US.UTF-8LC_COLLATE=en_US.UTF-8 LC_MONETARY=en_US.UTF-8 [6] LC_MESSAGES=en_US.UTF-8LC_PAPER=en_US.UTF-8

Re: [R] Best Beginner Books?

2014-10-02 Thread arnaud gaboury
On Thu, Oct 2, 2014 at 4:54 AM, Jason Eyerly teamtraders3...@gmail.com wrote: A lot of excellent suggestions! Thank you everyone for the input. I’ve purchased via Amazon: A Beginner's Guide to R by Zuur Data Manipulation with R by Spector “Introductory Statistics with R.” by Peter Dalgaard

Re: [R] Building R for better performance

2014-09-11 Thread arnaud gaboury
I got the benchmark script, which I've attached, from Texas Advanced Computing Center. Here are my results (elapsed times, in secs): Where can we get the benchmark script? __ R-help@r-project.org mailing list

Re: [R] Building R for better performance

2014-09-02 Thread arnaud gaboury
The best that I can see for R would be if someone were to post a how to use MKL for compiling R type document. I build R with MKL and ICC on my Archlinux box[1][2]. If I can help in anything, I will do it. [1]https://wiki.archlinux.org/index.php/R [2]https://aur.archlinux.org/packages/r-mkl/

Re: [R] Using openBLAS in R under Unix / Linux

2014-08-28 Thread arnaud gaboury
On Thu, Aug 28, 2014 at 11:45 AM, Martin Spindler spind...@mea.mpisoc.mpg.de wrote: Dear all, I would like to us openBLAS in R under Linux / Unix. Which steps do I have to undertake? Does someone know a detailed description? (I found some sources on the web, but none was really helpful for

Re: [R] Help on installing R packages in a Citrix

2014-08-22 Thread arnaud gaboury
On Fri, Aug 22, 2014 at 2:03 PM, S Ellison s.elli...@lgcgroup.com wrote: We are currently trying to migrate 3 users of R to a citrix based environment, but are coming across major issues trying to install the packages to the relevant image. Please be more precised in your issue.

[R] Regex - subsetting parts of a file name.

2014-07-31 Thread arnaud gaboury
A directory is full of data.frames cache files. All these files have the same pattern: df.some_name.RData my.cache.list - c(df.subject_test.RData, df.subject_train.RData, df.y_test.RData, df.y_train.RData) I want to keep only the part inside the two points. After lots of headache using grep()

Re: [R] Regex - subsetting parts of a file name.

2014-07-31 Thread arnaud gaboury
R as.vector(sapply(my.cache.list, function(x)strsplit(x, \\.)[[1]][2])) [1] subject_test subject_train y_testy_train R gsub(df\\.(.*)\\.RData, \\1, my.cache.list) [1] subject_test subject_train y_testy_train Note that . will match any character, while \\. matches a

Re: [R] compare two data frames of different dimensions and onlykeep unique rows

2012-02-28 Thread Arnaud Gaboury
TY very much for your setdiffDF(). It does the job perfectly. Arnaud Gaboury   A2CT2 Ltd. -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of Petr Savicky Sent: lundi 27 février 2012 20:41 To: r-help@r-project.org Subject: Re: [R

[R] compare two data frames with same columns names but of different dimensions

2012-02-27 Thread Arnaud Gaboury
= c(NA, 9L), class = data.frame) As you can see, they have same column names. My idea was to merge these two df when passing as argument not to take into account duplicate rows, so I will get one df with rows which are not in both df. Is it possible? How to do it? TY for any help. Arnaud

Re: [R] Ubuntu jaunty - R can't be install

2012-02-27 Thread Arnaud Gaboury
I don't understand where is your problem. Are you looking for jaunty as a package on R Crans?? Are you looking to install R package on your Ubuntu box? As you know, Jaunty is no more supported by Ubuntu, so packets have been moved in Archives. Arnaud Gaboury   A2CT2 Ltd. -Original

[R] compare two data frames of different dimensions and only keep unique rows

2012-02-27 Thread Arnaud Gaboury
, 24.81, 1273.5, 1276.25), Nbr.Lots = c(-61, -61, 6, 40, 40, -1, -1, -1, 1, -61, -61, 5, 1, 40, 40, -1, -1, -1, 1)), .Names = c(Product, Price, Nbr.Lots), row.names = c(1, 2, 3, 4, 5, 6, 7, 8, 9, 11, 21, 31, 41, 61, 71, 51, 10, 81, 91), class = data.frame) TY for your help Arnaud Gaboury   A2CT2

Re: [R] compare two data frames of different dimensions and only keep unique rows

2012-02-27 Thread Arnaud Gaboury
dimension (I can add some lines to deal with it, but again, seems very heavy). I hoped I could find a better solution. A2CT2 Ltd. -Original Message- From: jim holtman [mailto:jholt...@gmail.com] Sent: lundi 27 février 2012 18:42 To: Arnaud Gaboury Cc: r-help@r-project.org Subject: Re: [R

[R] data frame manipulation with condition

2012-02-24 Thread Arnaud Gaboury
. TY for any help. Trading   A2CT2 Ltd. Arnaud Gaboury   A2CT2 Ltd. __ 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

Re: [R] data frame manipulation with condition

2012-02-24 Thread Arnaud Gaboury
TY Uwe, So I will have to write a line for each condition? Right? In fact I was trying to do something with apply in one line, but couldn't achieve any result. In fact, all my transformation will be multiplying one object by a specific number according to the value of df$x. Arnaud Gaboury

Re: [R] data frame manipulation with condition

2012-02-24 Thread Arnaud Gaboury
this as result : df x y 1 AA 10 if df$x==AA, df$y-1*10 2 BB 50 if df$x==BB, df$y-2*25 3 CC 3 NOTHING 4 AA 40 if df$x==AA, df$y-4*10 5 DD 75 if df$x==DD, df$y-5*15 6 DD 90 if df$x==DD, df$y-6*15 Arnaud Gaboury   A2CT2 Ltd. -Original Message

Re: [R] data frame manipulation with condition

2012-02-24 Thread Arnaud Gaboury
clear enough, and YES I have tried many workarounds myself before posting. Feel free to ignore my post if you think I am lazy and disrespectful to the list. Arnaud Gaboury   A2CT2 Ltd. -Original Message- From: Uwe Ligges [mailto:lig...@statistik.tu-dortmund.de] Sent: vendredi 24 février

Re: [R] data frame manipulation with condition

2012-02-24 Thread Arnaud Gaboury
, 14L, 15L, 16L, 17L, 18L, 19L, 8L, 9L, 10L, 11L, 12L, 20L, 21L, 22L, 23L, 35L, 36L, 37L, 38L, 39L, 40L, 41L, 42L, 31L, 32L, 24L, 25L, 26L, 27L, 28L, 29L, 30L, 2L, 3L, 1L, 33L, 34L), class = data.frame) Have a good weekend. Arnaud Gaboury   A2CT2 Ltd. Trade: +41 22 849 88 63 Fax:   +41 22 849 88

Re: [R] data frame manipulation with condition

2012-02-24 Thread Arnaud Gaboury
WORKING Now day 2 with df2: df2 - data.frame(x = c(AA,AA,BB,BB,BB,CC,DD,DD), y = 1:8) df2$y - df2$y * mult[as.character(df2$x)] df2 x y 1 AA 2 2 AA 4 3 BB 15 4 BB 20 5 BB 25 6 CC 6 7 DD 14 8 DD 16 WORKING Ty both of you and have a good weekend. Arnaud Gaboury   A2CT2 Ltd

Re: [R] install rJava in Ubuntu 11.10

2012-02-24 Thread Arnaud Gaboury
the openJDK path in your environment. Hope this help. Arnaud Gaboury   A2CT2 Ltd. -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of John Kane Sent: vendredi 24 février 2012 19:32 To: r-help@r-project.org Subject: [R] install

Re: [R] data frame manipulation with conditions

2012-02-24 Thread Arnaud Gaboury
TY Elai for your answer. One solution has been given earlier in this list by Sarah Goslee and William Dunlap. Arnaud Gaboury   A2CT2 Ltd. -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of ilai Sent: vendredi 24 février 2012 20:14

[R] data frame colnames through ddply

2012-02-23 Thread Arnaud Gaboury
and renamed it Nbr.Lots. This line works. What I would like is changing the col names in the same line, thus avoiding another line with colnames(exportfile)-c(Contract,Price,Nbr.Lots) Is there a possibility to change my col names in the same line? TY Arnaud Gaboury   A2CT2 Ltd

[R] ifelse

2012-02-09 Thread Arnaud Gaboury
, but with an Error. Why? TY for any help Arnaud Gaboury   A2CT2 Ltd. __ 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

Re: [R] ifelse

2012-02-09 Thread Arnaud Gaboury
TY much. Works for me. Arnaud Gaboury   A2CT2 Ltd. -Original Message- From: R. Michael Weylandt [mailto:michael.weyla...@gmail.com] Sent: jeudi 9 février 2012 17:47 To: Arnaud Gaboury Cc: r-help@r-project.org Subject: Re: [R] ifelse cat() returns a null value so it's problematic

[R] loading packages in a function

2012-02-09 Thread Arnaud Gaboury
package: MASS Loading required package: nnet YOU DID A GOOD JOB,SEND EMAIL Last line is the supposed result of my function, so it ok. How to get rid of the first two lines, only for esthetic purpose? TY for your time. Arnaud Gaboury   A2CT2 Ltd. __ R

Re: [R] loading packages in a function

2012-02-09 Thread Arnaud Gaboury
TY for your answer, but here what i did : #load needed lybrary suppressPackageStartupMessages(library(plyr)) suppressPackageStartupMessages(library(car)) library(plyr) library(car) But I still get : Loading required package: MASS Loading required package: nnet Arnaud Gaboury   A2CT2 Ltd

Re: [R] loading packages in a function

2012-02-09 Thread Arnaud Gaboury
Ah, I feel stupid! OK, it works for me. TY for your help Arnaud Gaboury   A2CT2 Ltd. -Original Message- From: Sarah Goslee [mailto:sarah.gos...@gmail.com] Sent: jeudi 9 février 2012 20:02 To: Arnaud Gaboury Cc: r-help@r-project.org Subject: Re: [R] loading packages in a function

Re: [R] replace elements of a data frame

2012-02-08 Thread Arnaud Gaboury
names1-recode(df$names,'BO'='BOO';'CL'='CLR';'C'='CC') df1-data.frame(names1,price) df1 names1 price 1BOO10 2 CC25 3CLR20 TY for the tip. Any possibility to write this in one single line? Arnaud Gaboury   A2CT2 Ltd. -Original Message- From: Berend Hasselman

[R] decimal number format as quarter

2012-02-08 Thread Arnaud Gaboury
. All numbers are in fact 2.1/4, 2.1/2, 2.3/4. How can I tell R 2.2 is 2.25, 2.4 is 2.50 and 2.6 is 2.75 ? TY for any help. Arnaud Gaboury   A2CT2 Ltd. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read

Re: [R] decimal number format as quarter

2012-02-08 Thread Arnaud Gaboury
TY Jim, It do the trick. I was trying to play without success with the format() options. No simplest way so? Arnaud Gaboury   A2CT2 Ltd. -Original Message- From: jim holtman [mailto:jholt...@gmail.com] Sent: mercredi 8 février 2012 15:36 To: Arnaud Gaboury Cc: r-help@r-project.org

Re: [R] decimal number format as quarter

2012-02-08 Thread Arnaud Gaboury
David, You are not far indeed, as I trade commodities, and prices are the ones from grain market: Corn, wheat and Soybeans. They are quoted in 1/4, and my trading platform displays them in 2,4,6 and my statements are in 25,50,75. TY Arnaud Gaboury   A2CT2 Ltd. -Original Message

Re: [R] decimal number format as quarter

2012-02-08 Thread Arnaud Gaboury
Thanks so much Peter. You are the man. Easy way and working for me. Arnaud Gaboury   A2CT2 Ltd. -Original Message- From: peter dalgaard [mailto:pda...@gmail.com] Sent: mercredi 8 février 2012 16:15 To: David Reiner Cc: Arnaud Gaboury; jim holtman; r-help@r-project.org Subject: Re: [R

[R] replace elements of a data frame

2012-02-07 Thread Arnaud Gaboury
But my df is bigger indeed with other elements. I was thinking using replace(), but can't get any clean result ( NA or all elements replaced with only one), neither with sapply(). TY for any help, and sorry for the n00b question. Arnaud Gaboury   A2CT2 Ltd

Re: [R] replace elements of a data frame

2012-02-07 Thread Arnaud Gaboury
As you can see, BO has been replaced by BOO, but with a warning! Arnaud Gaboury   A2CT2 Ltd. Trade: +41 22 849 88 63 Fax:   +41 22 849 88 66 arnaud.gabo...@a2ct2.com This email and any files transmitted with it are confidential and intended solely for the use of the individual or entity

Re: [R] replace elements of a data frame

2012-02-07 Thread Arnaud Gaboury
I used in fact recode() from epilcac package, not the one you mentioned! Arnaud Gaboury   A2CT2 Ltd. -Original Message- From: Arnaud Gaboury Sent: mardi 7 février 2012 20:25 To: Jorge I Velez Cc: r-help@r-project.org; Arnaud Gaboury Subject: RE: [R] replace elements of a data frame I

[R] merge two data frames

2010-08-04 Thread arnaud gaboury
Dear list, here are my two data frames: av - structure(list(DESCRIPTION = c(COFFEE C Sep/10, COPPER Sep/10, CORN Dec/10, CRUDE OIL miNY Sep/10, GOLD Aug/10, HENRY HUB NATURAL GAS Sep/10, PALLADIUM Sep/10, SILVER Sep/10, SOYBEANS Nov/10, SPCL HIGH GRADE ZINC USD, SUGAR NO.11 Oct/10, WHEAT

Re: [R] merge two data frames

2010-08-04 Thread arnaud gaboury
/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. -- ** Arnaud Gaboury Mobile: +41 79 392 79 56 BBM: 255B488F

[R] which function

2010-06-02 Thread arnaud Gaboury
Dear group, Here is a list of elements : l - c(100415, 100416, 100419, 100420, 100421, 100422, 100423, 100426, 100427, 100428, 100429, 100430, 100503, 100504, 100505, 100506, 100507, 100510, 100511, 100512, 100513, 100514, 100517, 100518, 100519, 100520, 100521, 100524, 100525, 100526,

Re: [R] which function

2010-06-02 Thread arnaud Gaboury
The correct line is : l[(which(100420==l)-1):which(100420==l)] [1] 100419 100420 -Original Message- From: arnaud Gaboury [mailto:arnaud.gabo...@gmail.com] Sent: Wednesday, June 02, 2010 9:41 AM To: r-help@r-project.org Cc: 'arnaud Gaboury' Subject: which function Dear group

Re: [R] data frame manipulation with zero rows

2010-06-02 Thread arnaud Gaboury
I do really think it is a very good idea. TY -Original Message- From: h.wick...@gmail.com [mailto:h.wick...@gmail.com] On Behalf Of Hadley Wickham Sent: Wednesday, June 02, 2010 3:31 PM To: arnaud Gaboury Cc: Peter Ehlers; r-help@r-project.org; Prof Brian Ripley Subject: Re: [R

[R] bind select data frames

2010-06-02 Thread arnaud Gaboury
Dear group, Here is my environment: ls() [1] DailyPL100419 DailyPL100420 DailyPL100421 ddi l PLglobal Pos100416 Pos100419 Pos100420 Pos100421 position [13] resultsel Trad100416Trad100419 Trad100420Trad100421trade With

Re: [R] bind select data frames

2010-06-02 Thread arnaud Gaboury
Wiley [mailto:jwiley.ps...@gmail.com] Sent: Wednesday, June 02, 2010 4:48 PM To: arnaud Gaboury Cc: r-help@r-project.org Subject: Re: [R] bind select data frames Hello, Does this do what you are looking for? output - NULL for(i in paste(DailyPL, sel, sep=)[-1

Re: [R] bind select data frames

2010-06-02 Thread arnaud Gaboury
-Original Message- From: Joshua Wiley [mailto:jwiley.ps...@gmail.com] Sent: Wednesday, June 02, 2010 4:48 PM To: arnaud Gaboury Cc: r-help@r-project.org Subject: Re: [R] bind select data frames Hello, Does this do what you are looking for? output - NULL for(i in paste

Re: [R] bind select data frames

2010-06-02 Thread arnaud Gaboury
= ), envir = .GlobalEnv), : unused argument(s) (row.names = NULL) Why this error? TY for your help -Original Message- From: Joshua Wiley [mailto:jwiley.ps...@gmail.com] Sent: Wednesday, June 02, 2010 5:08 PM To: arnaud Gaboury Cc: r-help@r-project.org Subject: Re: [R] bind

Re: [R] bind select data frames

2010-06-02 Thread arnaud Gaboury
Here we go : dd-data.frame(do.call(rbind, mget(paste(DailyPL,sel[-1],sep=),envir=.GlobalEnv)),row.names=NULL) TY so much Joshua and Jorge. -Original Message- From: Joshua Wiley [mailto:jwiley.ps...@gmail.com] Sent: Wednesday, June 02, 2010 5:11 PM To: arnaud Gaboury Cc: r-help@r

Re: [R] bind select data frames

2010-06-02 Thread arnaud Gaboury
Jorge, Your line works and give the desired result. Now I need to be able to work with i instead of 100419..., as I need to be able to change these numbers. TY for your help From: Jorge Ivan Velez [mailto:jorgeivanve...@gmail.com] Sent: Wednesday, June 02, 2010 5:09 PM To: arnaud Gaboury Cc

[R] data frame manipulation with zero rows

2010-06-01 Thread arnaud Gaboury
Dear group, Here is the kind of data.frame I obtain every day with my function : futures - structure(list(DESCRIPTION = c(CORN Jul/10, CORN Jul/10, CORN Jul/10, CORN Jul/10, CORN Jul/10, LIVE CATTLE Aug/10, LIVE CATTLE Aug/10, SUGAR NO.11 Jul/10, SUGAR NO.11 Jul/10, SUGAR NO.11 Jul/10, SUGAR

Re: [R] data frame manipulation with zero rows

2010-06-01 Thread arnaud Gaboury
To: arnaud Gaboury Subject: Re: [R] data frame manipulation with zero rows On Tue, 1 Jun 2010, arnaud Gaboury wrote: Dear group, Here is the kind of data.frame I obtain every day with my function : futures - structure(list(DESCRIPTION = c(CORN Jul/10, CORN Jul/10, CORN Jul/10

[R] data frame manipulation ddply

2010-06-01 Thread arnaud Gaboury
Dear group, Here is my data frame: futures - structure(list(DESCRIPTION = c(CORN Jul/10, CORN Jul/10, CORN Jul/10, CORN Jul/10, CORN Jul/10, LIVE CATTLE Aug/10, LIVE CATTLE Aug/10, SUGAR NO.11 Jul/10, SUGAR NO.11 Jul/10, SUGAR NO.11 Jul/10, SUGAR NO.11 Jul/10, SUGAR NO.11 Jul/10 ),

Re: [R] data frame manipulation ddply

2010-06-01 Thread arnaud Gaboury
...@uni-bremen.de] Sent: Tuesday, June 01, 2010 11:38 AM To: arnaud Gaboury Subject: Re: [R] data frame manipulation ddply Hi Arnaud, maybe aggregate can help: PosFut - aggregate(futures$QUANTITY, list(DESCRIPTION = futures$DESCRIPTION, SETTLEMENT

Re: [R] data frame manipulation with zero rows

2010-06-01 Thread arnaud Gaboury
It is indeed ddply() from package plyr. -Original Message- From: Prof Brian Ripley [mailto:rip...@stats.ox.ac.uk] Sent: Tuesday, June 01, 2010 12:24 PM To: Peter Ehlers Cc: arnaud Gaboury; r-help@r-project.org Subject: Re: [R] data frame manipulation with zero rows On Tue, 1

[R] as.date

2010-06-01 Thread arnaud Gaboury
Dear group, Here is my df (obtained with a read.csv2()): df - structure(list(DESCRIPTION = c(COTTON NO.2 Jul/10, COTTON NO.2 Jul/10, PALLADIUM Jun/10, PALLADIUM Jun/10, SUGAR NO.11 Jul/10, SUGAR NO.11 Jul/10), CREATED.DATE = c(13/05/2010, 13/05/2010, 14/05/2010, 14/05/2010, 10/05/2010,

Re: [R] as.date

2010-06-01 Thread arnaud Gaboury
TY for the tip. The lower case is in fact the culprit. -Original Message- From: Erik Iverson [mailto:er...@ccbr.umn.edu] Sent: Tuesday, June 01, 2010 6:05 PM To: arnaud Gaboury Cc: r-help@r-project.org Subject: Re: [R] as.date Where does the problem comes from?? Maybe from

Re: [R] data frame manipulation with zero rows

2010-06-01 Thread arnaud Gaboury
Maybe not the cleanest way, but I create a fake data frame with one row so ddply() is happy!! if (nrow(futures)==0) futures-data.frame(...) -Original Message- From: Peter Ehlers [mailto:ehl...@ucalgary.ca] Sent: Tuesday, June 01, 2010 12:07 PM To: arnaud Gaboury Cc: 'Prof

Re: [R] data frame manipulation change elements meeting criteria

2010-05-27 Thread arnaud Gaboury
Thank you for the answer. Is there any way to combine if() and switch() in one line? In my case, something like : if(trade$Trade.Status==DEL)switch(.) I would like to avoid the loop . From: Joris Meys [mailto:jorism...@gmail.com] Sent: Wednesday, May 26, 2010 9:15 PM To: arnaud Gaboury

[R] switch function

2010-05-27 Thread arnaud Gaboury
Dear group, Here is my df : trades - structure(list(Trade.Status = c(DEL, INS, INS), Instrument.Long.Name = c(SUGAR NO.11, CORN, CORN), Delivery.Prompt.Date = c(Jul/10, Jul/10, Jul/10), Buy.Sell..Cleared. = c(Sell, Buy, Buy), Volume = c(1L, 2L, 1L), Price = c(15.2500, 368., 368.5000),

[R] data frame change elements meeting criteria

2010-05-27 Thread arnaud Gaboury
. NULL That's certainly not what I want. From: Joris Meys [mailto:jorism...@gmail.com] Sent: Thursday, May 27, 2010 8:43 AM To: arnaud Gaboury Cc: r-help@r-project.org Subject: Re: [R] data frame manipulation change elements meeting criteria The loop is due to the switch statement

Re: [R] data frame manipulation change elements meeting criteria

2010-05-27 Thread arnaud Gaboury
..sum. NULL That's certainly not what I want. From: Joris Meys [mailto:jorism...@gmail.com] Sent: Thursday, May 27, 2010 8:43 AM To: arnaud Gaboury Cc: r-help@r-project.org Subject: Re: [R] data frame manipulation change elements meeting criteria The loop is due to the switch statement

Re: [R] data frame manipulation change elements meeting criteria

2010-05-27 Thread arnaud Gaboury
, Instrument.Long.Name, Delivery.Prompt.Date, Buy.Sell..Cleared., Volume, Price, Net.Charges..sum.), row.names = c(NA, 3L), class = data.frame) From: Joris Meys [mailto:jorism...@gmail.com] Sent: Thursday, May 27, 2010 10:38 AM To: arnaud Gaboury Cc: r-help@r-project.org Subject: Re: [R] data frame

Re: [R] data frame manipulation change elements meeting criteria

2010-05-27 Thread arnaud Gaboury
To: arnaud Gaboury Cc: r-help@r-project.org Subject: Re: [R] data frame manipulation change elements meeting criteria Off course. You put in a matrix to sapply, but sapply is for vectors. You want to apply the switch command on every entry of the vector trades$Buy.Sell..Cleared for which trades

Re: [R] switch function

2010-05-27 Thread arnaud Gaboury
, Instrument.Long.Name, Delivery.Prompt.Date, Buy.Sell..Cleared., Volume, Price, Net.Charges..sum.), row.names = c(NA, 3L), class = data.frame) From: Joris Meys [mailto:jorism...@gmail.com] Sent: Thursday, May 27, 2010 10:38 AM To: arnaud Gaboury Cc: r-help@r-project.org Subject: Re: [R] data frame

Re: [R] switch function

2010-05-27 Thread arnaud Gaboury
: Thursday, May 27, 2010 2:34 PM To: arnaud Gaboury Cc: r-help@r-project.org Subject: Re: [R] switch function try this: toBuy - trades$Trade.Status == DEL trades$Buy.Sell..Cleared. == Sell toSell - trades$Trade.Status == DEL trades$Buy.Sell..Cleared. == Buy x - trades # make a copy

[R] writing function : can't find an object

2010-05-26 Thread arnaud Gaboury
Dear group, Here is my function: #return the daily PL for day y PLDaily-function(x,y) { #find elements in my directory with LSCPos in the name, keep the numeric part in the name and #create a list l-gsub(\\D,,dir()[grep(LSCPos,dir())]) #select in the list the desired elements

[R] (no subject)

2010-05-26 Thread arnaud Gaboury
help is appreciated *** Arnaud Gaboury Mobile: +41 79 392 79 56 BBM: 255B488F __ 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

[R] condition apply to elements of a data frame column

2010-05-26 Thread arnaud Gaboury
Oops, forgot to give a subject -Original Message- From: arnaud Gaboury [mailto:arnaud.gabo...@gmail.com] Sent: Wednesday, May 26, 2010 2:31 PM To: r-help@r-project.org Cc: 'arnaud Gaboury' Subject: Dear group, Here is my data frame: dput(u) structure(list(DESCRIPTION

Re: [R] condition apply to elements of a data frame column

2010-05-26 Thread arnaud Gaboury
element different from zero). From: Joris Meys [mailto:jorism...@gmail.com] Sent: Wednesday, May 26, 2010 2:48 PM To: arnaud Gaboury Cc: r-help@r-project.org Subject: Re: [R] (no subject) What exactly are you trying to do? If you want to know which position is wrong, try : if (sum(u$POSITION

[R] data frame manipulation change elements meeting criteria

2010-05-26 Thread arnaud Gaboury
Dear group, Here is my df : trade - structure(list(Trade.Status = c(DEL, INS, INS), Instrument.Long.Name = c(SUGAR NO.11, CORN, CORN), Delivery.Prompt.Date = c(Jul/10, Jul/10, Jul/10), Buy.Sell..Cleared. = c(Sell, Buy, Buy), Volume = c(1L, 2L, 1L), Price = c(15.2500, 368., 368.5000),

[R] writing function:loop and rbind

2010-05-24 Thread arnaud Gaboury
Dear group, I have a function, let's call it myfun, wich give me a list of result: R1,R2,R3... There is a loop in this function to get my results. Here is the structure of my function: Myfun-function() { For (i in X ){ ---instructions- Ri { { All Results (R1,R2...) are

Re: [R] writing function:loop and rbind

2010-05-24 Thread arnaud Gaboury
,] DailyPL100416 DailyPL100419 DailyPL100420 That's not what I want! I expect DF to be a data.frame binded by row. I suspect there is an issue with get() or assign(), or something like that. Any help is appreciated. -Original Message- From: arnaud Gaboury [mailto:arnaud.gabo...@gmail.com

Re: [R] writing function:loop and rbind

2010-05-24 Thread arnaud Gaboury
Maybe is there a neater solution, but the function mget() does the trick. So until further advice, I will work with your solution. Thank you -Original Message- From: Joshua Wiley [mailto:jwiley.ps...@gmail.com] Sent: Monday, May 24, 2010 5:07 PM To: arnaud Gaboury Cc: r-help@r

Re: [R] writing function:loop and rbind

2010-05-24 Thread arnaud Gaboury
Do you think there is a way to add somewhere the argument row.names=NULL ? Or should I have to write another line to remove the row.names? -Original Message- From: Joshua Wiley [mailto:jwiley.ps...@gmail.com] Sent: Monday, May 24, 2010 5:07 PM To: arnaud Gaboury Cc: r-help@r

[R] writing function

2010-05-24 Thread arnaud Gaboury
Dear group, Here is my environment after I run a function, myfun() myfun() ls() [1] allconavprix16 DailyPL100416 DailyPL100419 DailyPL100420 l llmyl PL PLdaily PLglobal PLmonthly [13] Pos100415 Pos100416 Pos100419

Re: [R] writing function

2010-05-24 Thread arnaud Gaboury
Thank you so much. You are totally right. -Original Message- From: Joshua Wiley [mailto:jwiley.ps...@gmail.com] Sent: Monday, May 24, 2010 6:33 PM To: arnaud Gaboury Cc: r-help@r-project.org Subject: Re: [R] writing function My guess is that either ls(), called inside grep

  1   2   >