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

2023-10-17 Thread arnaud gaboury
ake a suggestion, if you really 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.

[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
or your answer. Why not use > factors? 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

[R] replace character by numeric value

2023-09-27 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 = c("ET

[R] apply a function to a list of lists

2023-09-19 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 <- funct

[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

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, format="%d.%

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 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("30.09.2015", &q

[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", "Grains",

[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 Rprofi

Re: [R] Build R with optimized BLAS library

2015-08-22 Thread arnaud gaboury
--- Sent from my phone. Please excuse my brevity. On August 22, 2015 7:51:39 AM PDT, arnaud gaboury wrote: >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)

[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 method

Re: [R] Running R in Server

2015-08-18 Thread arnaud gaboury
On Sun, Aug 16, 2015, 2:29 PM Swagato Chatterjee 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 server so that the results

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

2015-04-20 Thread arnaud gaboury
adley Wickham " > to report problems in a user-contributed package. > > > > Bill Dunlap > TIBCO Software > wdunlap tibco.com > > On Mon, Apr 20, 2015 at 12:10 AM, arnaud gaboury > wrote: > >> R 3.2.0 on Linux >> >&

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

2015-04-20 Thread arnaud gaboury
-- extract_numeric function (x) { as.numeric(gsub("[^0-9.-]+", "", as.character(x))) } - Is there any particular reason for the hyphen in gsub() ? Why not remove it thus ? TY much Jim > > Jim

[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 Ca

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 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

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 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 > '/developemen

[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 f

Re: [R] Running R Remotely on LINUX

2015-04-14 Thread arnaud gaboury
On Tue, Apr 14, 2015 at 10:09 PM, John Sorkin 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 need > some help configurin

Re: [R] Running R Remotely on LINUX

2015-04-14 Thread arnaud gaboury
On Tue, Apr 14, 2015 at 7:09 PM, Sarah Goslee wrote: > > Hi Michael, > > On Tue, Apr 14, 2015 at 12:57 PM, Michael Haenlein > 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 time I am now trying to move to a

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 dupl

[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 histor

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 wrote: > On Thu, Feb 12, 2015 at 3:40 PM, arnaud gaboury > wrote: >> I have two df (and dt): >> >> df1 >> structure(list(name = c("poisonivy", "poisonivy", "poisonivy", >&

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 wrote: > I have two df (and dt): > > df1 > structure(list(name = c("poisonivy", "poisonivy", "poisonivy", > "poisonivy", "poisonivy", "poisonivy", "poisonivy&

[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

[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", "

[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 LC_NAM

Re: [R] Best Beginner Books?

2014-10-01 Thread arnaud gaboury
On Thu, Oct 2, 2014 at 4:54 AM, Jason Eyerly 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 > > Are there an

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 https://stat.ethz.ch/mailman/listinf

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-mk

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 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 me.) > Thanks and best,

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 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. __

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_test""y_train" > > > R> gsub("df\\.(.*)\\.RData", "\\1", my.cache.list) > [1] "subject_test" "subject_train" "y_test""y_train" > > > Note that "." will match any

[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

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

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

2012-02-27 Thread Arnaud Gaboury
vance which of my two df will have the greates 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: A

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

2012-02-27 Thread Arnaud Gaboury
ot;Coffee C", "GC", "Sugar No 11", "ZS", "ZS"), Price = c(2331, 2356, 2440, 204.55, 205.45, 17792, 24.81, 1273.5, 1276.25, 2331, 2356, 2440, 2450, 204.55, 205.45, 17792, 24.81, 1273.5, 1276.25), Nbr.Lots = c(-61, -61, 6, 40, 40, -1, -1, -1, 1, -61, -

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.

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

2012-02-27 Thread Arnaud Gaboury
s = "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. Ar

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

Re: [R] install rJava in Ubuntu 11.10

2012-02-24 Thread Arnaud Gaboury
could try: add 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: [

Re: [R] data frame manipulation with condition

2012-02-24 Thread Arnaud Gaboury
B","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. -Original Mes

Re: [R] data frame manipulation with condition

2012-02-24 Thread Arnaud Gaboury
, 3L, -3L, -89L, -1L, -1L, -51L, -51L)), .Names = c("Product", "reported.Price", "reported.Nbr.Lots" ), row.names = c(7L, 4L, 5L, 6L, 13L, 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, 2

Re: [R] data frame manipulation with condition

2012-02-24 Thread Arnaud Gaboury
e") Row will change. I am looking to multiply reported.Price by 100 IF Product=CL, multiply by 10 IF product=GC, multiply by 100 IF product=HG, multiply by 1000 IF Product=NG, multiply by 100 IF product=RB. I hope I am clear enough, and YES I have tried many workarounds myself before pos

Re: [R] data frame manipulation with condition

2012-02-24 Thread Arnaud Gaboury
e longer than the chosen example shown here. It seems your tip didn't do the job. I am expecting 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

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 Ga

[R] data frame manipulation with condition

2012-02-24 Thread Arnaud Gaboury
en df$y=df$y*10 if df$x=="BB" then df$y=df$y*25 and so on with other conditions. 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

[R] data frame colnames through ddply

2012-02-23 Thread Arnaud Gaboury
sum the Filled.Qty column 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

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] 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

[R] loading packages in a function

2012-02-09 Thread Arnaud Gaboury
red 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. _

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 proble

[R] ifelse

2012-02-09 Thread Arnaud Gaboury
ot;), cat("NO\n")) : replacement has length zero I have the correct answer, YES, 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

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

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
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

[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 the

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 o

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

Re: [R] replace elements of a data frame

2012-02-07 Thread Arnaud Gaboury
df names price 1 BOO10 2 C25 3CL20 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

[R] replace elements of a data frame

2012-02-07 Thread Arnaud Gaboury
y "BOB", "C" by "CR", "CL" by "CLO", and the list is more long. I can do that for each element: >df[df=="BO"]<-"BOB" But my df is bigger indeed with other elements. I was thinking using replace(), but can't get a

Re: [R] merge two data frames

2010-08-04 Thread arnaud gaboury
;> 978, 0, 0, 0)), .Names = c("DESCRIPTION", "pl", "PL", "POSITION", >> "SETTLEMENT"), row.names = c(NA, -13L), class = "data.frame") >> >> I am looking for one data frame with the column $PL=zz$PL+av$PL. >> I have

[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

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

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

Re: [R] bind select data frames

2010-06-02 Thread arnaud Gaboury
et(paste("DailyPL", sel[-1], sep = ""), 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

Re: [R] bind select data frames

2010-06-02 Thread arnaud Gaboury
;, "100421"), "dd" is only equal to "DailyPL100421" > -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

Re: [R] bind select data frames

2010-06-02 Thread arnaud Gaboury
lyPL100421) > -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 look

[R] bind select data frames

2010-06-02 Thread arnaud Gaboury
Dear group, Here is my environment: > ls() [1] "DailyPL100419" "DailyPL100420" "DailyPL100421" "dd""i" "l" "PLglobal" "Pos100416" "Pos100419" "Pos100420" "Pos100421" "position" [13] "result""sel" "Trad100416""Trad100419" "Trad10

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 Bria

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: 

[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", "1005

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: a

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 > > > > Whe

[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

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

Re: [R] data frame manipulation ddply

2010-06-01 Thread arnaud Gaboury
to aggregate > -Original Message- > From: Patrick Hausmann [mailto:patrick.hausm...@uni-bremen.de] > Sent: Tuesday, June 01, 2010 11:38 AM > To: arnaud Gaboury > Subject: Re: [R] data frame manipulation ddply > > Hi Arnaud, > > maybe "agg

[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

Re: [R] data frame manipulation with zero rows

2010-06-01 Thread arnaud Gaboury
0 9:47 AM > 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 <

[R] data frame manipulation with zero rows

2010-05-31 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 N

Re: [R] switch function

2010-05-27 Thread arnaud Gaboury
> From: jim holtman [mailto:jholt...@gmail.com] > Sent: 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.Sel

Re: [R] switch function

2010-05-27 Thread arnaud Gaboury
, 2L, 1L), Price = c("15.2500", "368.", "368.5000"), Net.Charges..sum. = c(4.01, -8.64, -4.32)), .Names = c("Trade.Status", "Instrument.Long.Name", "Delivery.Prompt.Date", "Buy.Sell..Cleared.", "Volume", "Price

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

2010-05-27 Thread arnaud Gaboury
..@gmail.com] Sent: Thursday, May 27, 2010 10:38 AM 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

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

2010-05-27 Thread arnaud Gaboury
, 2L, 1L), Price = c("15.2500", "368.", "368.5000"), Net.Charges..sum. = c(4.01, -8.64, -4.32)), .Names = c("Trade.Status", "Instrument.Long.Name", "Delivery.Prompt.Date", "Buy.Sell..Cleared.", "Volume", "Price"

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

2010-05-27 Thread arnaud Gaboury
[1] "Buy" $Volume [1] "Buy" $Price NULL $Net.Charges..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 manipulat

[R] data frame change elements meeting criteria

2010-05-27 Thread arnaud Gaboury
] "Buy" $Volume [1] "Buy" $Price NULL $Net.Charges..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 el

[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", "

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

2010-05-26 Thread arnaud Gaboury
<- X for (i in which(Y=="DEL")){     new.vect[i]<-switch(   EXPR = X[i],   Sell="Buy",       Buy="Sell",   X[i]) } cbind(new.vect,X,Y) On Wed, May 26, 2010 at 7:43 PM, arnaud Gaboury wrote: Dear group, Here is my df : trade <- structure(list(Tr

[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",

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

2010-05-26 Thread arnaud Gaboury
se in fact (minimum of one 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 w

[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 dat

[R] (no subject)

2010-05-26 Thread arnaud Gaboury
ge if one of the element of the POSITION column is different from zero. I tried using mapply with some line like this : > mapply(if,u$POSITION,==0,print("WARNING:POSITIONS ARE WRONG",quote=F)) But it seems it is not the correct way to pass the various arguments. Any help is appreci

[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

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 ei

[R] writing function

2010-05-24 Thread arnaud Gaboury
Dear group, Here is my environment after I run a function, myfun() >myfun() > ls() [1] "allcon""avprix16" "DailyPL100416" "DailyPL100419" "DailyPL100420" "l" "ll""myl" "PL" "PLdaily" "PLglobal" "PLmonthly" [13] "Pos100415" "Pos100

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

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 Gab

Re: [R] writing function:loop and rbind

2010-05-24 Thread arnaud Gaboury
[,2] [,3] [1,] "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

[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 Data.

  1   2   >