[R] refresh.console() function?

2024-03-13 Thread Christofer Bogaso
Hi, I run a lengthy for loop and I want to display loop status for each step in my loop. I previously heard of a R function namely refresh.console() which would print the status within the loop as it progresses. However I see this > help.search("refresh.console") No vignettes or demos or help

[R] Generating mouse click and hold using R

2024-03-13 Thread Christofer Bogaso
Hi, I wonder if R can provide any functionality where I need simulate mouse click in windows machine at certain coordinate on screen and hold the click for certain seconds e.g. for 5 seconds Really appreciate if I can have someone suggestion how above can be simulated with R Thanks and regards,

Re: [R] Code editor for writing R code

2023-11-29 Thread Christofer Bogaso
Hi Sergei, Where can I find TeX Comments extension in VS Code? On Wed, Nov 29, 2023 at 9:34 PM Sergei Ko wrote: > > TeX Comments extension in VS Code > > > > > Sent from my phone > > > Original message > From: Christofer Bogaso > Date:

[R] Code editor for writing R code

2023-11-29 Thread Christofer Bogaso
Hi, Currently I use VS-Code to write codes in R. While it is very good, it does not allow me to write Latex expressions in comments, which I am willing to have to write corresponding mathematical expressions as comments in my code files. Does there exist any Code editor for R, that allows me to

Re: [R] if-else that returns vector

2023-10-13 Thread Christofer Bogaso
ot;true"), stop("false")) > => c(NA,NA). > > At any rate, what you want is if () else > > > > On Fri, 13 Oct 2023 at 09:22, Christofer Bogaso > wrote: >> >> Hi, >> >> Following expression returns only the first element >> >> ifels

[R] if-else that returns vector

2023-10-12 Thread Christofer Bogaso
Hi, Following expression returns only the first element ifelse(T, c(1,2,3), c(5,6)) However I am looking for some one-liner expression like above which will return the entire vector. Is there any way to achieve this? __ R-help@r-project.org mailing

[R] Finding combination of states

2023-09-04 Thread Christofer Bogaso
Let say I have 3 time points.as T0, T1, and T2.(number of such time points can be arbitrary) In each time point, an object can be any of 5 states, A, B, C, D, E (number of such states can be arbitrary) I need to find all possible ways, how that object starting with state B (say) at time T0, can

Re: [R] Could not read time series data using read.zoo()

2023-08-03 Thread Christofer Bogaso
Hi, I just provided a snapshot of my CSV file. Attaching the full file here (not sure if R-help would accept the attachment). Thanks and regards, On Thu, Aug 3, 2023 at 8:35 PM Jeff Newmiller wrote: > > no commas? > > On August 3, 2023 7:53:07 AM PDT, Christofer Bogaso >

[R] Could not read time series data using read.zoo()

2023-08-03 Thread Christofer Bogaso
Hi, I have a CSV which contains data like below (only first few rows), Date Adj Close lret 02-01-1997 737.01 03-01-1997 748.03 1.48416235 06-01-1997 747.65 -0.050813009 07-01-1997 753.23 0.743567202 08-01-1997 748.41 -0.64196699 09-01-1997 754.85 0.856809786 10-01-1997 759.5 0.614126802 However

Re: [R] Adding comment in C++ code for debugging purpose

2022-12-17 Thread Christofer Bogaso
_a),max_entries(max_entries_a),default_distr(default_distr_a),link_function(link_function_a),calc_rc(calc_rc_a),loss_thr(loss_thr_a); List ret; etc This still does not print in the console. Not sure if I am missing something. Thanks and regards, On Sat, Dec 17, 2022 at 6:57 PM Rui Barradas w

Re: [R] Adding comment in C++ code for debugging purpose

2022-12-17 Thread Christofer Bogaso
11:39 AM Rui Barradas wrote: > > Às 23:32 de 16/12/2022, Christofer Bogaso escreveu: > > Hi, > > > > I am using an R package where there are some C++ code. > > > > To check some intermediate values generated by that C++ code, I added > > a line like > >

Re: [R] Adding comment in C++ code for debugging purpose

2022-12-17 Thread Christofer Bogaso
Hi Ivan, This is a very nice point. I will check this out. Thanks and regards, On Sat, Dec 17, 2022 at 1:53 PM Ivan Krylov wrote: > > On Sat, 17 Dec 2022 05:02:33 +0530 > Christofer Bogaso wrote: > > > I am using an R package where there are some C++ code. > > > &

[R] Adding comment in C++ code for debugging purpose

2022-12-16 Thread Christofer Bogaso
Hi, I am using an R package where there are some C++ code. To check some intermediate values generated by that C++ code, I added a line like std::cout << "My values"; Now with this modification, I next build a modified package (source) using R CMD build Next I install this modified package

[R] How to access source code

2022-12-08 Thread Christofer Bogaso
Hi, I am trying to access the source code from package GCPM, where I am interested to look into the source code of one function called LGD. So I did below > LGD standardGeneric for "LGD" defined from package "GCPM" function (this) standardGeneric("LGD") Methods may be defined for

Re: [R] Fixing the size of R's Graphic Device

2022-08-25 Thread Christofer Bogaso
e a 300 > inch display? > > On August 25, 2022 12:05:00 PM PDT, Christofer Bogaso > wrote: > >Thanks. > > > >But this is woking upto some number > > > >For example > > > >options(device=function()windows(width=303,height=354,xpos=-5,ypos

Re: [R] Fixing the size of R's Graphic Device

2022-08-25 Thread Christofer Bogaso
ypos=100)) > graphics.off() > plot(1:10) > > > -Bill > > > On Thu, Aug 25, 2022 at 11:11 AM Christofer Bogaso > wrote: >> >> Hi, >> >> I am wondering if there is any way to fix the size (i.e. height and >> width) of R's graphic device permanently.

Re: [R] Fixing the size of R's Graphic Device

2022-08-25 Thread Christofer Bogaso
device? That is, what OS are you using? > > On August 25, 2022 11:10:45 AM PDT, Christofer Bogaso > wrote: > >Hi, > > > >I am wondering if there is any way to fix the size (i.e. height and > >width) of R's graphic device permanently. Every time I open R, and &g

[R] Fixing the size of R's Graphic Device

2022-08-25 Thread Christofer Bogaso
Hi, I am wondering if there is any way to fix the size (i.e. height and width) of R's graphic device permanently. Every time I open R, and create my first plot, the default size of the graphic device is fairly small, and I need to adjust it manually to make it of comfortable size. Any help is

Re: [R] Fitted values from AR model

2022-08-13 Thread bogus christofer
values, the > fits are extremely close.) > > HTH, > Eric > > On Thu, Aug 11, 2022 at 9:53 PM bogus christofer > wrote: > > > > Hi, > > > > I have below AR model and fitted values from the forecast package > > > > library(forecast) > > dta

[R] Fitted values from AR model

2022-08-11 Thread bogus christofer
Hi, I have below AR model and fitted values from the forecast package library(forecast) dta = c(5.0, 11, 16, 23, 36, 58, 29, 20, 10, 8, 3, 0, 0, 2, 11, 27, 47, 63, 60, 39) fit <- arima(dta, order=c(2,0,0)) fitted(fit) This gives fitted values as Time Series: Start = 1 End = 20 Frequency = 1

[R] Cumulative probability from binomial distribution

2022-06-30 Thread Christofer Bogaso
Hi, I have the below output. > pbinom(0.10, 1, 0.40) [1] 0.6 I am curious what it means to serve a fraction as the first argument in pbinom()? Thanks for your time __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see

Re: [R] Connection to Oracle DB failing from R

2020-08-31 Thread Christofer Bogaso
iam Dunlap wrote: > > Which version of java do you have installed? Oracle's web site says > ojdbc5.jar is for Java 1.5 and ojdbc6.jar is for more recent versions. > > Bill Dunlap > TIBCO Software > wdunlap tibco.com > > On Mon, Aug 31, 2020 at 3:56 AM Christofer Bogaso >

[R] Connection to Oracle DB failing from R

2020-08-31 Thread Christofer Bogaso
Hi, I am trying to establish a connection to a Oracle DB from R and used below code which is failing every time I try - > library(RJDBC) Loading required package: DBI > jdbcDriver =JDBC("oracle.jdbc.OracleDriver",classPath="ojdbc5.jar") *** caught segfault *** address 0x854961, cause 'memory

[R] Bayesian estimation with MCMC

2020-05-23 Thread Christofer Bogaso
Hi, In python there is a package called pymc3 for Bayesian parameter estimation with MCMC. I am curious if there is any equivalent package available for R. Any pointer will be highly appreciated. __ R-help@r-project.org mailing list -- To UNSUBSCRIBE

[R] Notational derivative in R

2020-05-14 Thread Christofer Bogaso
Hi, I was wondering if R can perform notational derivative something like Mathematica does as explained in https://reference.wolfram.com/language/howto/TakeADerivative.html Any pointer will be highly appreciated. Thanks, __ R-help@r-project.org

[R] Fitting Richards' curve

2020-05-13 Thread Christofer Bogaso
Hi, Is there any R package to fit Richards' curve in the form of https://en.wikipedia.org/wiki/Generalised_logistic_function I found there is one package grofit, but currently defunct. Any pointer appreciated. __ R-help@r-project.org mailing list --

Re: [R] save() unable to find object

2019-10-31 Thread Christofer Bogaso
Thanks Duncan. It worked. On Thu, Oct 31, 2019 at 3:02 PM Duncan Murdoch wrote: > > On 31/10/2019 5:17 a.m., Christofer Bogaso wrote: > > As I said the name 'AAA31' is itself a variable. So I cant hard-code > > it within the save() function > > Use the list= argume

Re: [R] save() unable to find object

2019-10-31 Thread Christofer Bogaso
As I said the name 'AAA31' is itself a variable. So I cant hard-code it within the save() function On Thu, Oct 31, 2019 at 2:45 PM Jim Lemon wrote: > > Hi Christofer, > This is a guess, but have you tried: > > save(AAA31,file="Save.RData") > > Jim > > On Th

[R] save() unable to find object

2019-10-31 Thread Christofer Bogaso
Hi, I wanted to save a few R objects in RData file for some future use. The names of such R objects are actually dynamic so I used below code to save them - Date = Sys.Date() assign(paste('AAA', format(Date, "%d"), sep = ""), 5) save('Date', paste('AAA', format(Date, "%d"), sep = ""), file =

[R] How to use breaks argument in hist() function correctly?

2019-09-18 Thread Christofer Bogaso
Hi, I have a numerical vector as below x = c(92958.2014593977, -379826.025677203, 881937.411562002, 25761.5278163719, -11837.158273897, 48450.8089746788, -415505.62910869, -168462.98512054, 328504.255373387, -298966.051027528, 237133.794811816, -49610.1148173768, -92459.1170329526,

Re: [R] A question on regular expression

2019-09-13 Thread Christofer Bogaso
gt; [[1]] > [1] "{cd$ }" "{cad$ }" > > Cheers, > Bert > > On Thu, Sep 12, 2019 at 10:12 AM Christofer Bogaso > wrote: >> >> Thanks Bert, >> >> This works, but if in my text there are more than one patterns then >> fails to gene

Re: [R] A question on regular expression

2019-09-12 Thread Christofer Bogaso
ay, this will do what you want I think: > > z <- paste("ab{cd$ }ed", "ab{cad$ }ed", collapse = " ") ## just for > readability > > > str_extract_all(z,"\\{[^}]*\\}") > [[1]] > [1] "{cd$ }" "{cad$ }" > > Ch

Re: [R] A question on regular expression

2019-09-12 Thread Christofer Bogaso
sks. > > > Bert Gunter > > "The trouble with having an open mind is that people keep coming along and > sticking things into it." > -- Opus (aka Berkeley Breathed in his "Bloom County" comic strip ) > > > On Thu, Sep 12, 2019 at 9:31

[R] A question on regular expression

2019-09-12 Thread Christofer Bogaso
Hi, I am wondering on what is the correct way to select a pattern which goes as - {"(any character with any length)"} The expressions " {" " and " "} " both are included in the pattern. For example, the lookup of the above pattern in the text " {"asaf455%"}57573blabla " will result in

[R] Partition a vector into select groups with fixed length

2019-08-18 Thread Christofer Bogaso
Hi, Let say I have a vector as below Vec = LETTERS Now I want to break this vector into groups of the same length of 5. So, 1st group consists - "A" "B" "C" "D" "E" 2nd group - "F" "G" "H" "I" "J" and so on.. last group will consist only the leftover elements I have a very large initial

[R] Extract row as NA with no matching name

2019-08-08 Thread Christofer Bogaso
Hi, Let say I have below matrix mdat <- matrix(c(1,2,3, 11,12,13), nrow = 2, ncol = 3, byrow = TRUE, dimnames = list(c("row1", "row2"), c("C.1", "C.2", "C.3"))) Now I can extract a raw by rowname as > mdat['row1', ] C.1 C.2 C.3 1 2 3

[R] A question on generating Error message upon Timeout

2019-05-09 Thread Christofer Bogaso
Hi, I have created a function called myFn() which should be acting as below: 1. If function takes too long, then it will timeout and a specific message will be displayed 2. This function may generate error on its own, so if it evaluates before that specific time and fails then another specific

[R] Snapshot of a shiny app

2019-04-16 Thread Christofer Bogaso
Hi, I have a Shiny app with address like http://xx.xx.xx.xx:1080/remotepp/ When I try to get a PDF snapshot of this app using webshot() function from webshot package, I see a blank PDF file saved. I also tried with appshot() function as below, however getting error: appshot("

[R] Complete month name from as.yearmon()

2019-04-13 Thread Christofer Bogaso
Hi, I am wondering if there is any way to get the full name from as.yearmon() function. Please consider below example: library(quantmod) as.yearmon(Sys.Date()) This gives: [1] "Apr 2019". How can I extract the full name ie. 'April 2019' Appreciate your pointer. Thanks, [[alternative

[R] Memory usage

2019-02-18 Thread Christofer Bogaso
Hi, I have below lines of code to understand how R manages memory. > library(pryr) *Warning message:* *package ‘pryr’ was built under R version 3.4.3 * > mem_change(x <- 1:1e6) 4.01 MB > mem_change(y <- x) 976 B > mem_change(x[100] < NA) 976 B > mem_change(rm(x)) 864 B >

[R] TIme Zone error

2019-01-26 Thread Christofer Bogaso
Hi, I want to set a specific Timezone for my R environment, with below syntax: > Sys.getenv("Asia/Calcutta") [1] "" > But it sets to some blank timezone. I checked with OlsonNames(), to see available zones for R, where I found "Asia/Calcutta" available. I idea why R failed to set timezone

Re: [R] Webshot failed to take snapshot in Ubuntu machine

2019-01-06 Thread Christofer Bogaso
Thanks Martin, I reinstalled PhantomJS and now it works fine. Regards, On Thu, Dec 20, 2018 at 5:30 PM Martin Maechler wrote: > >>>>> Marc Girondot via R-help > >>>>> on Tue, 18 Dec 2018 13:53:34 +0100 writes: > > > Hi Christofer, I just

[R] Failed to install RQuantLib in Ubuntu machine

2019-01-02 Thread Christofer Bogaso
Hi, I was trying to install RQuantLib in my Ubuntu machine which failed with below information : *> install.packages('RQuantLib', INSTALL_opts = c('--no-lock'))* *Installing package into ‘/usr/local/lib/R/site-library’* *(as ‘lib’ is unspecified)* *trying URL

Re: [R] Webshot failed to take snapshot in Ubuntu machine

2018-12-18 Thread Christofer Bogaso
Is there any alternative to webshot? On Tue, Dec 18, 2018 at 6:23 PM Marc Girondot wrote: > Hi Christofer, > I just try on MacOSX and ubuntu and it works on both: > > For ubuntu: > > Sys.info() >sysname >

Re: [R] Webshot failed to take snapshot in Ubuntu machine

2018-12-18 Thread Christofer Bogaso
1.5 pillar_1.3.0 [9] rlang_0.2.2 debugme_1.1.0callr_3.0.0 tools_3.4.4 [13] compiler_3.4.4 processx_3.2.0 base64enc_0.1-3 tibble_1.4.2 On Tue, Dec 18, 2018 at 6:07 PM Christofer Bogaso < bogaso.christo...@gmail.com> wrote: > Hi, > > I was using webshot package to take sna

[R] Webshot failed to take snapshot in Ubuntu machine

2018-12-18 Thread Christofer Bogaso
Hi, I was using webshot package to take snapshot of a webpage as below: library(webshot) webshot(' https://www.bseindia.com/stock-share-price/asian-paints-ltd/asianpaint/500820/', 'bb.pdf') However what I see is a Blank PDF file is saved. However if I use the same code in my windows machine it

[R] Width of a text

2018-12-12 Thread Christofer Bogaso
Hi, In HTML there is a way to measure the width of a Text before printing it on screen as in https://www.w3schools.com/tags/canvas_measuretext.asp In R we have nchar() function which just measures the number of letters in a Text, but I wonder if we can measure the width of text as well. I have

[R] POSIXct format

2018-12-04 Thread Christofer Bogaso
Hi, I am trying to format my Character strings to POSIXct as below : > as.POSIXct('2018-11-2700:00:00', format = "%Y-%m-%d%H:%M:%S", tz = 'UTC') [1] "2018-11-27 UTC" > as.POSIXct('2018-11-2701:00:00', format = "%Y-%m-%d%H:%M:%S", tz = 'UTC') [1] "2018-11-27 01:00:00 UTC" For the first case, I

[R] Drawing a random number

2018-11-29 Thread Christofer Bogaso
Hi, I would like to draw an Integer from a range of [10, 1000] inclusive, however that random integer should be outside of a pre-defined vector of integers. Let say I draw an integer as below as.integer(runif(1, 10, 1000)) and my pre-defined vector is Vec = c(563, 453, 897, 567) The policy

[R] How to remove backslash

2018-09-21 Thread Christofer Bogaso
Hi, I have below string where I am trying to remove Backslash from. I tried with gsub() function, however failed to remove that: > str = ' gsub("\\", "", str) Error in gsub("\\", "", str) : invalid regular expression '\', reason 'Trailing backslash' Any pointer to the right approach? Thanks

[R] Obtaining exact pattern in list.files()

2018-09-12 Thread Christofer Bogaso
Hi, In the list.files() function, there is an argument 'pattern' to locate the desired files. However I failed to see if I can manage to fetch those files that having an exact match. For example, if there are 2 files that contain the expression 'File' and 'Second_File', then I should get the 1st

[R] Cant schedule R job using taskscheduleR

2018-08-24 Thread Christofer Bogaso
Hi, I am trying to schedule an R job using taskscheduler_create() function available in package taskscheduleR. Below is my code: > library(taskscheduleR) Warning message: package ‘taskscheduleR’ was built under R version 3.5.1 > taskscheduler_create(taskname = "ABC", rscript =

Re: [R] [FORGED] Adding % sign to ticks in persp()

2018-08-05 Thread Christofer Bogaso
t; } > lapply(labelGrobs, addPercent) > grid.refresh() > > ... is that what you meant? The positioning of the labels relative to > the tick marks is imperfect and could perhaps be improved by also > editing the 'cex' for the labels, but hopefully this gets close enough > to be useful. &

[R] Adding % sign to ticks in persp()

2018-08-05 Thread Christofer Bogaso
Hi, Is there any way to add styles to the tick marks in persp() function? For eample I want to add '%' suffix to the z-axis tick marks.in below plot : x <- seq(-10, 10, length= 30) y <- x f <- function(x, y) { r <- sqrt(x^2+y^2); 10 * sin(r)/r } z <- outer(x, y, f) z[is.na(z)] <- 1 op <- par(bg

Re: [R] dbGetQuery() returns wrong value

2018-07-30 Thread Christofer Bogaso
The data type is defined as bigint On Mon, Jul 30, 2018 at 4:45 PM Eric Berger wrote: > The ID matches in the first 16 characters. > How is your table declared? > > > On Mon, Jul 30, 2018 at 2:00 PM, Christofer Bogaso < > bogaso.christo...@gmail.com> wrote:

Re: [R] dbGetQuery() returns wrong value

2018-07-30 Thread Christofer Bogaso
0.0 loaded via a namespace (and not attached): [1] compiler_3.5.0 tools_3.5.0 On Mon, Jul 30, 2018 at 2:27 PM Christofer Bogaso < bogaso.christo...@gmail.com> wrote: > Hi, > > I used following SQL query to fetch information from DB > > > dbGetQuery(Conn, "select ID fr

[R] dbGetQuery() returns wrong value

2018-07-30 Thread Christofer Bogaso
Hi, I used following SQL query to fetch information from DB > dbGetQuery(Conn, "select ID from where date = '2018-07-18' and ID = '72075186224672770' limit 10") ID 1 72075186224672768 As you see, it is returning a different result from what actual query string contains. However

[R] Saving objects in RData file in different name

2018-07-28 Thread Christofer Bogaso
Hi, Let say I have 2 objects as below x1 = 1:3 x2 = 5:4 Now I want to save both x1 and x2 in some RData file, however x1 will be saved with a different name e.g. y I tried below save(y = x1, x2, file = "file.RData") However still they are saved in their original names i.e. x1 and x2, not y

[R] Stop a loop if it takes long time

2018-07-24 Thread Christofer Bogaso
Hi, Let say I am implementing a loop using for() / apply()-family etc. Now, the calculation-time within a particular loop is not fixed, means, some loop takes a long time to finish calculation, and next loop perhaps very quick to finish. I am exploring if there is any way, to check if the

Re: [R] Zoo changing time-zone when I merge 2 zoo time series

2018-07-09 Thread Christofer Bogaso
My default is set as GMT. On Mon, Jul 9, 2018 at 4:01 PM David Wolfskill wrote: > On Mon, Jul 09, 2018 at 03:52:02PM +0530, Christofer Bogaso wrote: > > Hi, > > > > Below is my code : > > > > library(zoo) > > Dat1 = structure(c(17890, 17770.01, 17600, 17

[R] Zoo changing time-zone when I merge 2 zoo time series

2018-07-09 Thread Christofer Bogaso
Hi, Below is my code : library(zoo) Dat1 = structure(c(17890, 17770.01, 17600, 17593, 17630.01), index = structure(c(1512664740, 1512664800, 1512664860, 1512664920, 1512664980), class = c("POSIXct", "POSIXt"), tzone = "America/Los_Angeles"), class = "zoo") Dat2 = structure(c(15804.28, 15720.61,

[R] R couldnt recognize US Pasific timezome

2018-07-09 Thread Christofer Bogaso
Hi, I wanted to convert Epoch time to readable time with US Pacific Time Zone using 'anytime' package, as below: > library(anytime) > anytime(1417411980, tz = 'PST') [1] "2014-12-01 05:33:00 GMT" Warning message: In as.POSIXlt.POSIXct(x, tz) : unknown timezone 'PST' However it appears that R

Re: [R] parallel processing in r...

2018-07-01 Thread Christofer Bogaso
Hi, On ' how to use "top" inside the R prompt? ' you can use system('top') command. Thanks, On Sun, Jul 1, 2018 at 9:53 PM Benoit Vaillant wrote: > Hello, > > On Sun, Jul 01, 2018 at 11:31:29AM +, akshay kulkarni wrote: > > I tried "top" at the bash prompt, but it provides a way to

Re: [R] A question on Statistics

2018-07-01 Thread Christofer Bogaso
may need to reconsider Jeff's advice. > > > Cheers, > Bert > > > > Bert Gunter > > "The trouble with having an open mind is that people keep coming along and > sticking things into it." > -- Opus (aka Berkeley Breathed in his "Bloom County" comic str

Re: [R] A question on Statistics

2018-07-01 Thread Christofer Bogaso
opinion on my question. Answer to Jeff's pointer - yes my distribution is assumed to be centered at 0. Thanks, On Sun, Jul 1, 2018 at 8:04 AM Hasan Diwan wrote: > Christofer, > On Sat, 30 Jun 2018 at 12:54, Jeff Newmiller > wrote: > > > > You should use Stack Exchang

[R] A question on Statistics

2018-06-30 Thread Christofer Bogaso
Hi, I have a quick question on Statistical distribution as follows, hoping Statisticians here would give me very insightful feedback. Say, I have a large sample from a highly asymmetric distribution ranging from -Inf to +Inf. Now I wish to calculate sample X1 and X2 within which middle 70%

Re: [R] Correctly executing system code using R in Ubuntu server

2018-06-25 Thread Christofer Bogaso
:10") > > x11() > Warning message: > In x11() : cairo-based types may only work correctly on TrueColor visuals > > > > Bill Dunlap > TIBCO Software > wdunlap tibco.com > > On Mon, Jun 25, 2018 at 2:04 PM, Christofer Bogaso < > bogaso.christo...@gmail.co

[R] Correctly executing system code using R in Ubuntu server

2018-06-25 Thread Christofer Bogaso
Hi, I am curious on how to correctly run System code with R under Ubuntu. I tried to execute below 2 lines of code using system() functions in Ubuntu server, however could not achieve the desired result. system('Xvfb :10 -ac &') system('export DISPLAY=:10') System parameters: > Sys.info()

Re: [R] Efficient manipulation with list object

2018-06-10 Thread Christofer Bogaso
> Rui Barradas > > > > Enviado a partir do meu smartphone Samsung Galaxy. > Mensagem original > De: Christofer Bogaso > Data: 10/06/2018 16:33 (GMT+00:00) > Para: r-help > Assunto: [R] Efficient manipulation with list object > > Hi, > > I

[R] Efficient manipulation with list object

2018-06-10 Thread Christofer Bogaso
Hi, I have a list of length 10,000, and each element of that list is a matrix with 3 columns and 2,000 rows. Now when I tried to make a Matrix object with that list using Reduce('rbind', list), my code is taking a considerable amount of time. Is there any way to implement same above task in

[R] Time and date conversion

2018-06-04 Thread Christofer Bogaso
Hi, I have an automatic data feed and I obtained a Date vector in the following format: > Date [1] "03 Jun 2018 10:01 am CT""01 Jun 2018 22:04:25 pm CT" I now like to convert it to UTC time-zone Is there any easy way to convert them so, particularly since 1st element doesnt have any Second

Re: [R] Unable to take correct Web-snapshot

2018-06-01 Thread Christofer Bogaso
Thanks for that information. However how can I use R to directly get data from that API? On Fri, Jun 1, 2018 at 8:36 PM Martin Møller Skarbiniks Pedersen < traxpla...@gmail.com> wrote: > On 1 June 2018 at 15:08, Christofer Bogaso > wrote: > > Hi again, > > > &g

[R] Unable to take correct Web-snapshot

2018-06-01 Thread Christofer Bogaso
Hi again, I use the *webshot* package to take snapshot from Webpage. However, when I try to take snapshot from* https://www.coinbase.com/ *, this fails to take the full snapshot of that page. I tried following : > library(webshot) >

[R] Wired result when I convert from Character to Numeric

2018-05-23 Thread Christofer Bogaso
Hi, Below is my simple result in R > x = "1282553.821000" > as.numeric(x) [1] 1282554 Any idea where all numbers in the decimal places (ie 8, 2, 1) are gone? Thanks, __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see

[R] Split a data.frame

2018-05-19 Thread Christofer Bogaso
Hi, I am struggling to split a data.frame as will below scheme : DF = data.frame(name = c('a', 'v', 'c'), val = 0); DF split_str = c('a', 'c') Now, for each element in split_str, R should find which row of DF contains that element, and return DF with all rows starting from next row of the

[R] Quandl data download error

2018-05-14 Thread Christofer Bogaso
Hi, I use Quandl package to download data from Quandl https://www.quandl.com Today when I tried to download data from there, I received below error : > Quandl('LME/PR_CO') Error in curl::curl_fetch_memory(url, handle = handle) : gnutls_handshake() failed: An unexpected TLS packet was

[R] Rolling window difference for zoo time series

2018-04-24 Thread Christofer Bogaso
Hi, I have a 'zoo' time series as below : Zoo_TS = zoo(5:1, as.Date(Sys.time())+0:4) Now I want to calculate First order difference of order 1, rolling window basis i.e. (Zoo_TS[2] - Zoo_TS[1] ) / Zoo_TS[1] (Zoo_TS[3] - Zoo_TS[2] ) / Zoo_TS[2] . Is there any direct function available to

Re: [R] Empirical density estimation

2018-03-11 Thread Christofer Bogaso
is that people keep coming along and > sticking things into it." > -- Opus (aka Berkeley Breathed in his "Bloom County" comic strip ) > > On Sun, Mar 11, 2018 at 11:45 AM, Christofer Bogaso > <bogaso.christo...@gmail.com> wrote: >> >> Hi, >> >&g

[R] Empirical density estimation

2018-03-11 Thread Christofer Bogaso
Hi, Let say I have below vector of data-points : Dat = c(-0.444, -0.25, -0.237449799196787, -0.227467046669042, -0.227454464682363, -0.22, -0.214876033057851, -0.211781206171108, -0.199891067538126, -0.192920353982301, -0.192307692307692, -0.186046511627907, -0.184418145956608,

Re: [R] Change Function based on ifelse() condtion

2018-03-04 Thread Christofer Bogaso
t;..." list > before calling FUN, so FUN is being called with zero arguments, exactly as > it is declared. > > A quick workaround is to change the line > > Lapply_me(as.list(1:4), function(xx) { > > to > > Lapply_me(as.list(1:4), function(xx,dummyList) { > >

Re: [R] Change Function based on ifelse() condtion

2018-03-04 Thread Christofer Bogaso
red? > You have not shown that in your email. > > > > > On Sun, Mar 4, 2018 at 7:11 PM, Christofer Bogaso > <bogaso.christo...@gmail.com> wrote: >> >> My modified function looks below : >> >> Lapply_me = function(X = X, FUN = FUN, Apply_MC = FALSE, ..

Re: [R] Change Function based on ifelse() condtion

2018-03-04 Thread Christofer Bogaso
am not passing ... anymore rather passing myList On Sun, Mar 4, 2018 at 10:37 PM, Eric Berger <ericjber...@gmail.com> wrote: > Hi Christofer, > Before you made the change that I suggested, your program was stopping at > the statement: list(...) = list(..) .etc > This means t

Re: [R] Change Function based on ifelse() condtion

2018-03-04 Thread Christofer Bogaso
@Eric - with this approach I am getting below error : Error in FUN(X[[i]], ...) : unused argument (list()) On Sun, Mar 4, 2018 at 10:18 PM, Eric Berger <ericjber...@gmail.com> wrote: > Hi Christofer, > You cannot assign to list(...). You can do the following > > myList <-

Re: [R] Change Function based on ifelse() condtion

2018-03-04 Thread Christofer Bogaso
dun...@gmail.com> wrote: > On 04/03/2018 10:39 AM, Christofer Bogaso wrote: >> >> Hi again, >> >> I am looking for some way to alternately use 2 related functions, >> based on some ifelse() condition. >> >> For example, I have 2 functions mclapply() and lapply

[R] Change Function based on ifelse() condtion

2018-03-04 Thread Christofer Bogaso
Hi again, I am looking for some way to alternately use 2 related functions, based on some ifelse() condition. For example, I have 2 functions mclapply() and lapply() However, mclapply() function has one extra parameter 'mc.cores' which lapply doesnt not have. I know when mc.cores = 1, these 2

Re: [R] How to programmatically save a web-page using R (mimicking Command+S)

2018-01-13 Thread Christofer Bogaso
wondering if there is any other direct ways to achieve the same. Thanks, On Sat, Jan 6, 2018 at 7:14 PM, Henrik Bengtsson <henrik.bengts...@gmail.com> wrote: > The 'webshot' package (on CRAN) can do this. > > Henrik > > On Jan 6, 2018 05:27, "Christofer Bogaso" <bo

[R] How to programmatically save a web-page using R (mimicking Command+S)

2018-01-06 Thread Christofer Bogaso
Hi, I would appreciate if someone can give me a pointer on how to save a webpage programmatically using R. For example, let say I have this webpage open in my browser: http://www.bseindia.com/stock-share-price/dabur-india-ltd/dabur/500096/ When manually I save this page, I just press Command+S

[R] Help with Regular expression

2018-01-03 Thread Christofer Bogaso
Hi, I was working on following expression : "\":\"03-JAN-2018 16:00:00\"" This is basically a combination of Date and Time mixed with some Noise. I want to extract only Date and Time part i.e. "03-JAN-2018 16:00:00 I tried following :

Re: [R] load() failed to load .Rdata file in AWS-Ububtu

2017-10-09 Thread Christofer Bogaso
shiny app is working but not with AWS. On Mon, Oct 9, 2017 at 12:37 PM, Eric Berger <ericjber...@gmail.com> wrote: > Hi Christofer, > The shiny code you have written does not depend on loading the Dat.RData > file. > I commented out that line and ran your shiny app on my machine a

Re: [R] load() failed to load .Rdata file in AWS-Ububtu

2017-10-08 Thread Christofer Bogaso
e setup when I deploy my shiny app I get below error : 18.221.184.94:3838 says The application unexpectedly exited Diagnostic information has been dumped to the JavaScript error console. appreciate any help to get rid of this error. Thanks for your time. On Sun, Oct 8, 2017 at 12:39 AM, Eric Berger

[R] load() failed to load .Rdata file in AWS-Ububtu

2017-10-07 Thread Christofer Bogaso
Hi again, I hope this is the right place to post my question on running R within Ubuntu, however if not, any pointer on right distribution list will be helpful. I am currently using R in Ubuntu which is hosted in Amazon - AWS. I have a .Rdata file in AWS which I am trying to load in R. Used

[R] Getting all possible combinations

2017-08-23 Thread Christofer Bogaso
Hi again, I am exploring if R can help me to get all possible combinations of members in a group. Let say I have a group with 5 members : A, B, C, D, E Now I want to generate all possible unique combinations with all possible lengths from that group e.g. 1st combination : A 2nd combination : B

Re: [R] Zoo rolling window with increasing window size

2017-08-10 Thread Christofer Bogaso
r in your response. > > r <- rollapplyr(x, seq_along(x), yourCustomFunctionGoesHere) > > On Thu, Aug 10, 2017 at 1:39 PM, Christofer Bogaso > <bogaso.christo...@gmail.com> wrote: >> Hi Joshua, thanks for your prompt reply. However as I said, sum() >> function

Re: [R] Zoo rolling window with increasing window size

2017-08-10 Thread Christofer Bogaso
R> cs <- cumsum(x) > R> identical(rs, cs) > [1] TRUE > > > On Thu, Aug 10, 2017 at 1:28 PM, Christofer Bogaso > <bogaso.christo...@gmail.com> wrote: >> Hi again, >> >> I am wondering there is any function for 'zoo' time series, where I >> can

[R] Zoo rolling window with increasing window size

2017-08-10 Thread Christofer Bogaso
Hi again, I am wondering there is any function for 'zoo' time series, where I can apply a user defined function rolling window basis, wherein window size is ever increasing i.e. not fixed. For example, let say I have below user defined function and a zoo time series : > library(zoo) > UDF =

[R] Strange behaviour to download zip file using R

2017-08-03 Thread Christofer Bogaso
Hi again, I was trying to download stock market data from below link : https://www.nseindia.com/products/content/equities/equities/archieve_eq.htm Input choice : Select Report: Bhavcopy Date(DD-MM-): 03-03-2010 If you put manual input as above, then we will get option for manual download

[R] Extracting numeric part from a string

2017-08-02 Thread Christofer Bogaso
Hi again, I am struggling to extract the number part from below string : "\"cm_ffm\":\"563.77\"" Basically, I need to extract 563.77 from above. The underlying number can be a whole number, and there could be comma separator as well. So far I tried below : > library(stringr) >

Re: [R] Creating/Reading a complex string in R

2017-07-18 Thread Christofer Bogaso
Thanks for your pointer. Is there any way in R how to replace " ' " with " /' " programmatically? My actual string is quite lengthy, so changing it manually may not be possible. I am aware of gsub() function, however not sure I can apply it directly on my original string. Regards, On Tue, Jul

[R] Creating/Reading a complex string in R

2017-07-18 Thread Christofer Bogaso
Hi again, Let say I have below string (arbitrary)

[R] Matching values between 2 data.frame.

2017-05-20 Thread Christofer Bogaso
Hi again, Let say I have below 2 data frames. OriginalData = data.frame('Value1' = 1:12, 'Value2' = 11:22, 'AA1' = c('AA4', 'AA3', 'AA4', 'AA1', 'AA2', 'AA1', 'AA6', 'AA6', 'AA3', 'AA3', 'AA4', 'AA3'), 'Value' = NA) TargetValue = data.frame('AA' = c('AA1', 'AA2', 'AA3', 'AA4', 'AA5', 'AA6'),

  1   2   3   4   >