Re: [R] Estimating regression with constraints in model coefficients

2025-04-30 Thread Christofer Bogaso
ion > that fits this updated structure and constraint logic. > As always – no promises. > r/ > Gregg Powell > Sierra Vista, AZ > > > > > On Tuesday, April 29th, 2025 at 1:51 PM, Christofer Bogaso > wrote: > > > > > > > > > Hi Gregg

Re: [R] Estimating regression with constraints in model coefficients

2025-04-24 Thread Christofer Bogaso
e. > > I can use the UCLA ologit.dta dataset as a basis if that's easiest to demo > on, or if you have another dataset you’d prefer – again, let me know. > > All the best! > > gregg > > > > > > > On Monday, April 21st, 2025 at 11:25 AM, Christofer Bogaso

Re: [R] Estimating regression with constraints in model coefficients

2025-04-21 Thread Christofer Bogaso
Hi Gregg, I am sincerely thankful for this workout. Could you please suggest any text book on how to create log-likelihood for an ordinal model like this? Most of my online search point me directly to some R function etc, but a theoretical discussion on this subject would be really helpful to con

Re: [R] Estimating regression with constraints in model coefficients

2025-04-21 Thread Christofer Bogaso
> > family = cumulative(parallel = TRUE), > > constraints = constraint, > > data = dat) > > summary(model_constrained) > > > For more complex constraints, you might need to work with optimization &g

[R] Estimating regression with constraints in model coefficients

2025-04-08 Thread Christofer Bogaso
Hi, I have below fit with ordinal logistic regression dat = foreign::read.dta("https://stats.idre.ucla.edu/stat/data/ologit.dta";) summary(MASS::polr(formula = apply ~ pared + public + gpa, data = dat)) However, instead of obtaining unconstrained estimates of model parameters, I would like to i

Re: [R] Number changed weirdly when converting to numeric

2025-03-09 Thread Christofer Bogaso
g on arm64. Note that I get > >the same result with > > > >> x <- -17725.33343267441 > > > >so it's not specific to as.numeric(). > > > >Best, > >Stephanie > > > > > > > > > >> On 9 Mar 2025, at 18:4

[R] Number changed weirdly when converting to numeric

2025-03-09 Thread Christofer Bogaso
Hi, I have below simple conversion > sprintf("%0.15f", as.numeric("-17725.33343267441")) [1] "-17725.33373069763" I could not figure out why the input and output is different? Clearly this conversion is incorrect. Is there any way to convert to numerical properly? > sessionInf

Re: [R] Failed to convert data to numeric

2025-03-02 Thread Christofer Bogaso
Hi Ivan, Thanks for your solution. Is there any way to remove all possible "Unicode character" that may be present in the array at once? On Mon, Mar 3, 2025 at 12:18 PM Ivan Krylov wrote: > > В Mon, 3 Mar 2025 12:08:43 +0530 > Christofer Bogaso пишет: > > > d

[R] Failed to convert data to numeric

2025-03-02 Thread Christofer Bogaso
Hi, I have below data dat2 = c("-24.43728533300", "4.8506950", "-1.91849566670", "2.6418180", "6.77752766670", "3.2080840", "4.19328766670", "0.3782577", "4.6589550", "-9.8814740") Now when I try to convert this data to numeric,

Re: [R] Extract estimate of error variance from glm() object

2024-12-24 Thread Christofer Bogaso
I think vcov() gives estimates of VCV for coefficients. I want estimate of SD for residuals On Tue, Dec 24, 2024 at 7:24 PM Ben Bolker wrote: > > vcov(). ? > > > On Tue, Dec 24, 2024, 8:45 AM Christofer Bogaso > wrote: >> >> Hi, >> >> I have

[R] Extract estimate of error variance from glm() object

2024-12-24 Thread Christofer Bogaso
Hi, I have below GLM fit clotting <- data.frame( u = c(5,10,15,20,30,40,60,80,100), lot1 = c(118,58,42,35,27,25,21,19,18), lot2 = c(69,35,26,21,18,16,13,12,12)) summary(glm(lot1 ~ log(u), data = clotting, family = gaussian)) Is there any direct function to extract estimate of Error s

[R] outer() is not working with my simple function

2024-12-10 Thread Christofer Bogaso
Hi, I have below code FN1 = function(x, y) 3 outer(1:9, 1:9, FN1) With above I get error as below Error in dim(robj) <- c(dX, dY) : dims [product 81] do not match the length of object [1] Could you please help to understand why is it failing? I am just expecting to get a matrix with all el

[R] How to install this package

2024-09-25 Thread Christofer Bogaso
Hi, I would like to install an R library from https://cran.r-project.org/src/contrib/Archive/termstrc/ I executed below code without success. Any help would be appreciated. > install.packages('/Users/termstrc_1.3.tar.gz', repos = NULL, type="source") * installing *source* package ‘termstrc’ ..

[R] Reading a txt file from internet

2024-09-07 Thread Christofer Bogaso
Hi, I am trying to the data from https://online.stat.psu.edu/onlinecourses/sites/stat501/files/ch15/employee.txt without any success. Below is the error I am getting: > read.delim('https://online.stat.psu.edu/onlinecourses/sites/stat501/files/ch15/employee.txt') Error in make.names(col.names, un

[R] How R calculates SE of prediction for Logistic regression?

2024-09-03 Thread Christofer Bogaso
Hi, I have below logistic regression Dat = read.csv('https://raw.githubusercontent.com/sam16tyagi/Machine-Learning-techniques-in-python/master/logistic%20regression%20dataset-Social_Network_Ads.csv') head(Dat) Model = glm(Purchased ~ Gender, data = Dat, family = binomial()) How I can get Standar

[R] Adding parameters for Benchmark normal distribution in shapiro.test

2024-09-02 Thread Christofer Bogaso
Hi, In ?shapiro.test, there seems to be no option to pass mean and sd information of the Normal distribution which I want to compare my sample data to. For example in the code below, I want to test my sample to N(0, 10). shapiro.test(rnorm(100, mean = 5, sd = 3)) Is there any way to pass the in

Re: [R] Prediction from Arima model

2024-08-31 Thread Christofer Bogaso
rence between a CI and a PI is that the PI is > constructed for data > that hasn't been seen yet. The CI is constructed for data that's already > there. I hope this helps. > > > On Sat, Aug 31, 2024 at 2:38 PM Christofer Bogaso > wrote: >> >> I want to

Re: [R] Prediction from Arima model

2024-08-31 Thread Christofer Bogaso
I want to obtain confidence interval for a new data as well as estimate of SE for the new data On Sat, Aug 31, 2024 at 11:58 PM David Winsemius wrote: > > > Sent from my iPhone > > > On Aug 31, 2024, at 10:55 AM, Christofer Bogaso > > wrote: > > > > Hi,

[R] Prediction from Arima model

2024-08-31 Thread Christofer Bogaso
Hi, I have run following code to obtain one step ahead confidence interval from am arima model library(forecast) set.seed(100) forecast(Arima(rnorm(100), order = c(1,0,1), xreg = rt(100, 1)), h = 1, xreg = 10) However this appear to provide the Prediction interval, however I wanted to get the

[R] A question on Statistics regarding regression

2024-08-24 Thread Christofer Bogaso
Hi, I have asked this question elsewhere however failed to get any response, so hoping to get some insight from experts and statisticians here. Let say we are fitting a regression equation where one explanatory variable is categorical with 2 categories. However in the sample, one category has 95%

[R] Using optim() function to find MLE

2024-07-28 Thread Christofer Bogaso
Hi, I am trying to fit a GLM on below data. While R does provide direct estimation, I wanted to go with manual calculation as below dat = structure(list(PurchasedProb = c(0.37212389963679, 0.572853363351896, 0.908207789994776, 0.201681931037456, 0.898389684967697, 0.944675268605351, 0.66079779248

Re: [R] Obtaining predicted probabilities for Logistic regression

2024-07-13 Thread Christofer Bogaso
Many thanks. May be I need to check my eyes before anything!!! On Sat, Jul 13, 2024 at 6:46 PM Rui Barradas wrote: > > Às 12:13 de 13/07/2024, Christofer Bogaso escreveu: > > Hi, > > > > I ran below code > > > > Dat = > > read.csv('https://raw.gi

[R] Obtaining predicted probabilities for Logistic regression

2024-07-13 Thread Christofer Bogaso
Hi, I ran below code Dat = read.csv('https://raw.githubusercontent.com/sam16tyagi/Machine-Learning-techniques-in-python/master/logistic%20regression%20dataset-Social_Network_Ads.csv') head(Dat) Model = glm(Purchased ~ Gender, data = Dat, family = binomial()) head(predict(Model, type="response"))

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

Re: [R] if-else that returns vector

2023-10-13 Thread Christofer Bogaso
> if some element of the test is false. > ifelse(c(NA,NA), stop("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, >>

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

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

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
rote: > > Às 11:05 de 17/12/2022, Christofer Bogaso escreveu: > > Hi Rui, > > > > Unfortunately, the code Rcpp::Rcout << "-->>>>>.My values" << > > "\n"; still not printing the value. > > > > Regarding

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 us

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

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

2022-08-25 Thread Christofer Bogaso
y have 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

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 permane

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 >

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

[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 https://stat.eth

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 no

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

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

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 li

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

2019-10-31 Thread Christofer Bogaso
> On Thu, Oct 31, 2019 at 8:10 PM Christofer Bogaso > wrote: > > > > 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 - > > &g

[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 = 'Sav

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

Re: [R] A question on regular expression

2019-09-13 Thread Christofer Bogaso
}") > [[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 >> fai

Re: [R] A question on regular expression

2019-09-12 Thread Christofer Bogaso
> Anyway, 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$ }" &g

Re: [R] A question on regular expression

2019-09-12 Thread Christofer Bogaso
; these tasks. > > > 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 {"asaf455

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

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

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

[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(" http://xx.xx.xx.xx

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

[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 > mem_change(rm(

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

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

2019-01-06 Thread Christofer Bogaso
version of 'phantomjs' on your > computer, i.e., the one that webshot() will then try to use and > somehow fails. > > I'd recommend you run webshot::install_phantomjs() > which then should install a "better" version of the 'phantomjs' > executabl

[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 'https://cloud.r-project.org/src/c

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

2018-12-18 Thread Christofer Bogaso
nodename > "lepidochelys" >machine > "x86_64" > > Not sure what to do... > > Marc > > Le 18/12/2018 à 13:37, Christofer Bogaso a écrit : >

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 a

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

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

[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 = paste("C:\\ABC.R")

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

2018-08-05 Thread Christofer Bogaso
LSE) > } > 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

[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 from XX

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

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

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

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

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

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 measure

Re: [R] A question on Statistics

2018-07-01 Thread Christofer Bogaso
k you 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"

Re: [R] A question on Statistics

2018-07-01 Thread Christofer Bogaso
Hi, I could post in StackExchange for sure, however I dont think R-help posting guide discourage asking a question about Statistics, atleast formally. I could further clarify if my question is not elaborate enough. And many apologies if it is very trivial - however still I am looking for 2nd opin

[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% probab

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

2018-06-25 Thread Christofer Bogaso
LAY=":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..

[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
s, > > 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, &

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

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

[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) > webshot("https://www.coinbase.com/";

[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 https://sta

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

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

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

Re: [R] Empirical density estimation

2018-03-11 Thread Christofer Bogaso
oming 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 > wrote: >> >> Hi, >> >> Let say I have below vector of data-points : >> >>

[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, -0.

  1   2   3   4   >