Re: [R] R emulation of FindRoot in Mathematica

2023-01-19 Thread Berend Hasselman
If you need to solve a nonlinear system of equations you could have a look at the CRAN Task View: Numerical Mathematics: https://cran.r-project.org/view=NumericalMathematics Specifically look in the subsection "Root Finding and Fixed Points". Berend Hasselman > On 19 Jan 2

Re: [R] Using multiroot for root solution for a matrix based function

2020-11-17 Thread Berend Hasselman
other solvers. Such as nleqslv like this library(nleqslv) nleqslv(q.start,f.mod,m=m) # uses Broyden nleqslv(q.start,f.mod,m=m,method="Newton") # uses Newton The second call of nleqslv uses less iterations that multiroot. You can check the answers. Berend Hasselman > On 17 Nov 2020, at

Re: [R] open file on R GUI results in spinning wheel and frozen R - Mac OS

2020-09-21 Thread Berend Hasselman
> On 21 Sep 2020, at 20:24, Gonçalo Ferraz wrote: > > Hello, > > I’ve been using R-studio for a while and today I needed to try something > directly on the R-GUI. > > But when I try to open any *.R file I get a spinning wheel and R freezes. I > can only shut it down with ‘force quit’. >

Re: [R] crash when opening existing scripts

2020-07-07 Thread Berend Hasselman
hz.ch/pipermail/r-sig-mac/2020-June/013575.html and the solution: https://stat.ethz.ch/pipermail/r-sig-mac/2020-July/013641.html Berend Hasselman __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-

Re: [R] How to convert European short dates to ISO format?

2020-06-10 Thread Berend Hasselman
Luigi, Try format = "%d/%m/%y" Berend Hasselman > On 10 Jun 2020, at 10:20, Luigi Marongiu wrote: > > ISO 8601 __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-

Re: [R] I'm Working On A Data Security Article - Quick Question

2019-02-11 Thread Berend Hasselman
Just read the complete thread. That will clarify. Nothing wrong with R or RGUI; the virus checker is wrong. regards, Berend Hasselman > On 10 Feb 2019, at 15:57, Murris Johnson wrote: > > > > Hi, > > > I have a quick question for you about a page on your site

Re: [R] (no subject)

2019-02-02 Thread Berend Hasselman
> is there a function in R for solve it or i have to programme it > What is the relation between the function argument x and variables X2 and X3? As it stands this is incomprehensible. The function argument x is not used anywhere in the function body. Berend Hasselman > >

Re: [R] system solver in R

2018-11-20 Thread Berend Hasselman
R package Ryacas may be what you want. Berend > On 20 Nov 2018, at 09:42, Engin Yılmaz wrote: > > Dea(R) > > Do you know any system solver in R ? > > For example, in matlab, is very easy > > syms a b c x eqn = a*x^2 + b*x + c == 0; sol = solve(eqn) > > How can I find this type code in

Re: [R] Using apply function to merge list of data frames

2018-07-25 Thread Berend Hasselman
> On 25 Jul 2018, at 08:17, Naresh Gurbuxani > wrote: > > I have a list whose components are data frames. My goal is to construct a > data frame by merging all the list components. Is it possible to achieve > this using apply and without a for loop, as used below? > > Thanks, > Naresh >

Re: [R] copy/paste of large amount of code to terminal leads to scrambled/missing characters

2018-02-04 Thread Berend Hasselman
exit_show_tool_tip "Save file first!" fi R CMD BATCH --encoding=UTF-8 --no-save --no-timing ${TM_FILENAME} mate ${TM_FILENAME}out Berend Hasselman > On 4 Feb 2018, at 01:23, Martin Batholdy via R-help <r-help@r-project.org> > wrote: > > Dear R-users, > > Thi

Re: [R] application of R

2018-01-11 Thread Berend Hasselman
king bad > questions > Google with the phrase "opensource why" and start reading. Berend Hasselman __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the p

Re: [R] Errors in reading in txt files

2017-12-14 Thread Berend Hasselman
> On 14 Dec 2017, at 20:01, Ista Zahn <istaz...@gmail.com> wrote: > > On Thu, Dec 14, 2017 at 1:58 PM, Berend Hasselman <b...@xs4all.nl> wrote: >> >>> On 14 Dec 2017, at 19:36, lily li <chocol...@gmail.com> wrote: >>> >>> Hi R use

Re: [R] Errors in reading in txt files

2017-12-14 Thread Berend Hasselman
> On 14 Dec 2017, at 19:36, lily li wrote: > > Hi R users, > > I have a question about reading from text files. The file has the structure > below: > > TimeColumn1 Column2 > 01.01.2001-12:00:00 This line does not contain 3 elements; only

Re: [R] weighted average grouped by variables

2017-11-11 Thread Berend Hasselman
d slightly into sapply(split(mydf, mydf$type), function(Z) sum(Z$speed*Z$n_vehicles)/sum(Z$n_vehicles)) Calculations are done on the elements of the list provided by split. The result now is: car light_duty heavy_duty motorcycle 36.39029 38.56522 37.5 36.08696 Obviously now th

Re: [R] changing "," to "." in data.frame

2017-10-11 Thread Berend Hasselman
2, function(x){ > if(!is.numeric(x[[1]]){ > gsub(",", ".", x[[1]]) > }else{ > x[[1]] > } > }) > > and got the unwelcome error > > Error: unexpected '{' in: > "adply(AX, 2, function(x){ > if(!is.numeric(x[[1]]){" > Missing ) in i

Re: [R] valid package repositories

2017-10-02 Thread Berend Hasselman
cked with R CMD check with no errors (preferably with the --as-cran option). In addition I would also insist that packages have been sent to the winbuilder and passed all checks without error or warning. Berend Hasselman __ R-help@r-project.org ma

Re: [R] gsDesign Pocock & OBF boundary

2017-09-23 Thread Berend Hasselman
e is a complete mess. Do NOT post in html. This is a plain text mailing list. Read the Posting Guide (https://www.r-project.org/posting-guide.html). Berend Hasselman] > __ > R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see > h

Re: [R] require help

2017-09-16 Thread Berend Hasselman
zts # turn data into a zoo timeseries and an xts timeseries library(zoo) z.zoo <- as.zoo(zts) z.zoo library(xts) z.xts <- as.xts(zts) z.xts Berend Hasselman > Yadawananda Neog > Research Scholar > Department of Economics > Banaras H

Re: [R] require help

2017-09-15 Thread Berend Hasselman
> On 15 Sep 2017, at 16:35, Berend Hasselman <b...@xs4all.nl> wrote: > >> >> On 15 Sep 2017, at 11:38, yadav neog <yadavn...@gmail.com> wrote: >> >> hello to all. I am working on macroeconomic data series of India, which in >> a yearly basis

Re: [R] require help

2017-09-15 Thread Berend Hasselman
<- data.frame(year=c(2000,2002,2003), x=c(1,2,3),y=c(10,11,12)) xy.ts <- as.ts(tsdata) library(zoo) as.zoo(xy.ts) Berend Hasselman > $ wlth: num 60.3 60.5 60.2 60.1 60.7 ... > -- > Yadawananda Neog > Research Scholar > Department of Economics > Banaras Hindu University

Re: [R] (no subject)

2017-09-13 Thread Berend Hasselman
s > checking for gcc option to accept ISO C89... none needed > configure: error: Need GSL version >= 1.12 > ERROR: configuration failed for package �gsl� > Why don't you send an email to the maintainer of the package? Berend Hasselman ___

Re: [R] Package nleqslv ERROR

2017-08-11 Thread Berend Hasselman
already pointed out how to resolve the error. Berend Hasselman __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.

Re: [R] R Programming help needed - Returning dataframes + 2 Variables dynamically

2017-07-28 Thread Berend Hasselman
u are now printing the original values of x and y. R cannot read your mind and know that x and y are part of the return list. Why does the function return x and y? Isn't returning test_data sufficient? Berend Hasselman > > Wrong output : > [1] "Passed Values" >

Re: [R] R Programming help needed - Returning dataframes + 2 Variables dynamically

2017-07-28 Thread Berend Hasselman
(x,y) > test_data <- data.frame(test_data) > return(test_data) > return(c(x,y)) > } > > for ( i in 1:1) { > test_data <- Logic_fn(c(x,y)) Use Logic_fn(x,y) instead of c(x,y), which is wrong. > test_data[1] > test_data[2] > test_data > > } You'll get other err

Re: [R] Matrix logical operator

2017-07-16 Thread Berend Hasselman
> [1,] TRUE FALSE FALSE > [2,] FALSE TRUE TRUE >> !b & > [1] TRUE > Read the help for &&. You can see it like this: ?`&&` Try !b[1] && TRUE and !b[2] && TRUE Berend hasselman > Best regards, > > Jeremie > > _

Re: [R] Question on Simultaneous Equations & Forecasting

2017-07-13 Thread Berend Hasselman
> One can indeed sometimes approximate without too much harm. But not always. Berend > Best, > Bernhard > > -----Ursprüngliche Nachricht- > Von: Berend Hasselman [mailto:b...@xs4all.nl] > Gesendet: Donnerstag, 13. Juli 2017 10:53 > An: OseiBonsu, Frances > Cc

Re: [R] Question on Simultaneous Equations & Forecasting

2017-07-13 Thread Berend Hasselman
ide) You can then include identities naturally. You would have to make the model dynamic but that shouldn't be too difficult using vector indexing. Berend Hasselman > On 13 Jul 2017, at 10:06, Pfaff, Bernhard Dr. > <bernhard_pf...@fra.invesco.com> wrote: > > Hi Frances, > > I ha

Re: [R] display double dot over character in plotmath?

2017-05-13 Thread Berend Hasselman
> On 13 May 2017, at 20:10, David Winsemius wrote: > >> >> On May 13, 2017, at 5:47 AM, Ranjan Maitra wrote: >> >> On Fri, 12 May 2017 23:39:14 -0700 Daniel Nordlund >> wrote: >> >>> On 5/12/17 4:55 PM, Ranjan Maitra wrote:

Re: [R] Solve system of non linear equations using nasted loops

2017-05-11 Thread Berend Hasselman
Your code looks needlessly complicated and inefficient in my view. Even if you don't need or use nested for loops it can still be simplified. 1: First define some new constants to avoid the the M? stuff in your function pME <- ME[2:9]/ME[1] pMI <- MI[2:9]/MI[1] pMA <- MA[2:9]/MA[1] pMAE <-

Re: [R] install lapack for mac

2017-05-03 Thread Berend Hasselman
homebrew? You homebrewed your R? Please: do not post in html as the Posting guide requests. Berend Hasselman > On 2 May 2017, at 20:51, Assa Yeroslaviz <fry...@gmail.com> wrote: > > Hi, > > I am running R under Rstudio for the analysis of single-cell RNA-Seq data. >

Re: [R] R 3.4.0 problem installation

2017-04-25 Thread Berend Hasselman
is annoying situation. > This should have been sent to the R-SIG-Mac mailinglist. If you look on CRAN for the packages Rmpfr and gmp you will see that both packages are not available in binary form for OS X El Capitan. You'll have to wait or try to compile gmp and mpfr relevant pac

Re: [R] A new -up?

2017-04-19 Thread Berend Hasselman
ng this and to use the official help. Apparently to no avail. Seems like a good idea to give these mails the same treatment as stuff from nabble. Berend Hasselman > cheers, > > Rolf Turner > > -- > Technical Editor ANZJS > Department of Statistics > University of Au

Re: [R] Setting .Rprofile for RStudio on a Windows 7 x64bit

2017-04-17 Thread Berend Hasselman
> On 17 Apr 2017, at 18:39, BR_email wrote: > > Bill, part II: > >> source(echo=TRUE, ""C:/Users/BruceRatner/Documents/.Rprofile.site") > Error: unexpected symbol in "source(echo=TRUE, ""C" > You have a double quote sign ("") preceding C:/. Make it a single double quote so

Re: [R] Difference between R for the Mac and for Windows

2017-03-31 Thread Berend Hasselman
> On 31 Mar 2017, at 19:28, John McKown <john.archie.mck...@gmail.com> wrote: > > On Fri, Mar 31, 2017 at 12:15 PM, Berend Hasselman <b...@xs4all.nl> wrote: > > I have noted a difference between R on macOS en on Kubuntu Trusty (64bits) > with complex division. &g

Re: [R] Difference between R for the Mac and for Windows

2017-03-31 Thread Berend Hasselman
i) [1] NaN+NaNi KubuntuTrusty - > (1+2i)/0 [1] Inf+Infi > (-1+2i)/0 [1] -Inf+Infi > > 1i/0 [1] NaN+Infi > 1i/(0+0i) [1] NaN+Infi Interesting to see what R on Windows delivers. Berend Hasselman __ R-help@r-project.org mailing list -

Re: [R] Assistance would be appreciated

2017-03-27 Thread Berend Hasselman
cum_wt. > Assistance would be appreciated. mean_decc_0 is a matrix? No it isn't. Use str(mean_decc_0) to see what it actually is. Then try setting the required element to NULL. And ponder your goal. Berend Hasselman > Bruce > --- Code --- > > yhat <-

Re: [R] Modeling Time Series with Missing Observations

2017-03-24 Thread Berend Hasselman
There is also a package imputeTS, which may be able to do what you want. It has a nice Introduction vignette and also appears to have nice plot functions Berend Hasselman > On 24 Mar 2017, at 02:11, David Winsemius <dwinsem...@comcast.net> wrote: > > There's also an irts-pac

Re: [R] Percent transformation

2017-03-15 Thread Berend Hasselman
"round_any") : > no applicable method for 'round_any' applied to an object of class > “data.frame" > Did you read the Posting Guide. DO NOT post in html. Your data are mangled. Your code is incomprehensible. Reproducible example please. Where does percent come from? Beren

Re: [R] Averaging without NAs

2017-03-02 Thread Berend Hasselman
ber of NAs. > > $X2016.Q1 : int 47 53 75 97 NA NA 23 NA 43 NA > > Does anyone know how to do that? Have you tried looking in the help for mean? ?mean Berend Hasselman > Thanks for any help > Elahe > > __ > R-help@r-pr

Re: [R] A strange arithmetic error in R (maybe a bug)

2017-02-18 Thread Berend Hasselman
any of you test whether you have same outputs as mine? And does anyone > know what is wrong with these? My guess is that R has a bug in processing > double numbers. Thanks! > Not a bug. See the R FAQ section 7.31. Berend Hasselman > TZ > ___

Re: [R] non-linear optimisation ODE models

2017-02-15 Thread Berend Hasselman
)}# parameter fitting using > levenberg marquart#initial guess for > parametersmyparms=c(k1=0.5,k2=0.5,k3=3,1)cinit=c(A=unname(myparms[4],B=0,C=0))print(cinit)#fittingfitval=nls.lm(par=par! ms,fn=ssq)#summary of fitsummary(fitval) Totally unreadable code because you did not read the P

Re: [R] Error loading largeVis

2017-02-13 Thread Berend Hasselman
org/web/checks/check_results_largeVis.html) and you will see that on most systems the same error is generated. So it may be best to send an email to the maintainer. Berend hasselman __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https

Re: [R] Help with implementing Whittaker-Henderson graduation for raw-data

2017-02-02 Thread Berend Hasselman
Why don't you just try the function whittaker from the pracma R package? There is an example which should be adequate for finding out what to do. Berend Hasselman > On 2 Feb 2017, at 03:44, Percival Bueser <percival_bue...@cocolife.com> wrote: > > Good day everyone! > &g

Re: [R] "Patched " version listed on CRAN mirrors is actually Oct RC version

2016-12-21 Thread Berend Hasselman
n, > (R version 3.3.2 RC (2016-10-26 r71594). It has been doing this since 3.3.2 > has been released. Is there a real patched version somewhere? > Send this message to the R-SIG-Mac mailinglist. More likely to get response. Berend Hasselman > David Watson > NASA - MSFC > Mail

Re: [R] Computing growth rate

2016-12-15 Thread Berend Hasselman
> On 15 Dec 2016, at 13:34, Brijesh Mishra wrote: > > Dear Mr Hasselman, > > I missed you mail, while I was typing my own mail as a reply to Mr. > Barradas suggestion. In fact, I implemented your suggestion even > before reading it. But, I have a concern that I have

Re: [R] Computing growth rate

2016-12-15 Thread Berend Hasselman
But it can be done more easily since the fyear1 and co_code1 are synchronized. Add a new column to df1 like this df1$growth <- c(NA, ifelse(diff(df1$fyear1)==1, (exp(diff(log(df1$sales1)))-1)*100, NA ) ) and display df1

Re: [R] about data manipulation

2016-11-30 Thread Berend Hasselman
521 2006 632 2007 34.1 2007 44.4 ", header=TRUE) df aggregate(flow~year, data=df, sum) I get a correct answer. So you are likely doing something weird and not showing us all. > [[alternati

Re: [R] nls for R version 3.3.2

2016-11-29 Thread Berend Hasselman
> > Did I do something wrong? Will a binary appear eventually? Would I have to > make it myself? > Indeed you did something wrong. nls is part of the stats package in R. Just do ?nls to see the help. Berend Hasselman > Best wishes > > Troels Ring > > Aalborg, Denmark >

Re: [R] question on mean, sum

2016-11-13 Thread Berend Hasselman
In addition to Petr's remarks: - why are you doing sum(mtcars)[1]? Do you want the sum of first column of mtcars? In that case you should do sum(mtcars[,1]). - similar remarks apply to your use of mean and sd. Have you read an introduction to R? Berend > On 14 Nov 2016, at 04:01,

Re: [R] multiplying a matrix by a vector

2016-11-04 Thread Berend Hasselman
> On 4 Nov 2016, at 19:27, Berend Hasselman <b...@xs4all.nl> wrote: > >> >> On 4 Nov 2016, at 16:41, Jeff Newmiller <jdnew...@dcn.davis.ca.us> wrote: >> >> Sara wins on memory use. >> >> Rui wins on speed. >> >> Bert win

Re: [R] multiplying a matrix by a vector

2016-11-04 Thread Berend Hasselman
> On 4 Nov 2016, at 16:41, Jeff Newmiller wrote: > > Sara wins on memory use. > > Rui wins on speed. > > Bert wins on clarity. > > library(microbenchmark) > > N <- 1000 > x <- matrix( runif( N*N ), ncol=N ) > y <- seq.int( N ) > > microbenchmark( { t( y * t(x) ) }

Re: [R] nls.lm

2016-10-21 Thread Berend Hasselman
> On 21 Oct 2016, at 06:00, Mike meyer <1101...@gmx.net> wrote: > > Let's take a different view of the problem. > Given f=(f_1,...,f_m):R^n -> R^m we want to minimize ||f(x)||. > > What distinguishes this from a general minimization problem is that you know > the structure of the > objective

Re: [R] nls.lm

2016-10-19 Thread Berend Hasselman
> On 19 Oct 2016, at 19:12, Mike meyer <1101...@gmx.net> wrote: > >> From my reading of the above cited document I get the impression that the >> algorithm > (algorithm 3.16, p27) can easily be adapted to handle the case m In this case the Jacobian Jf(x) is mxn and the matrix A(x)=Jf(x)'Jf(x)

Re: [R] nls.lm

2016-10-19 Thread Berend Hasselman
> On 19 Oct 2016, at 14:09, Mike meyer <1101...@gmx.net> wrote: > > @pd: you know that a System of equations with more variables than equations > is always solvable > and if a unique solution is desired one of mimimal norm can be used. > Not true. Take the system with 3 variables and 2

Re: [R] nls.lm

2016-10-19 Thread Berend Hasselman
> On 19 Oct 2016, at 14:09, Mike meyer <1101...@gmx.net> wrote: > > @pd: you know that a System of equations with more variables than equations > is always solvable > and if a unique solution is desired one of mimimal norm can be used. > You won't get a minimum norm solution by using a least

Re: [R] Please help me, I'm trying to update my version of R

2016-08-23 Thread Berend Hasselman
Follow up on my previous mail. See the FAQ for OS X :https://cran.r-project.org/bin/macosx/RMacOSX-FAQ.html Read the section "3.2 Installation of packages". It tells it all. (reachable from the contents entry "How to install packages"). Berend > On 23 Aug 2016, at 08:

Re: [R] Please help me, I'm trying to update my version of R

2016-08-23 Thread Berend Hasselman
> On 22 Aug 2016, at 22:17, KMNanus wrote: > > I’m a newbie running 3.2.4 on a mac equipped with Yosemite (10.10.5). > > I want to update to 3.3.1 and have downloaded the package, but have not been > able to install it. I’ve tried install.packages("R-3.3.1.tar.gz”) and >

Re: [R] store result of loop in df

2016-07-29 Thread Berend Hasselman
y code? Can anyone help? > How about for (i in 1:nrow(df)){ df$VAR[i] <- (binom.test(df[i,1],df[i,2],0.065))$estimate[[1]] } Berend Hasselman __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/lis

Re: [R] System of equations with unknowns in R

2016-07-20 Thread Berend Hasselman
You don't need the function K. From the image you need this: Well at last. You don't need the function K. From the image you only need this: G <- as.numeric(1+t(Alpha) %*% Omega %*% Alpha) G delta <- (Omega %*% Alpha) / sqrt(G) delta Berend Hasselman > On 20 Jul 2016, at 21:1

Re: [R] System of equations with unknowns in R

2016-07-20 Thread Berend Hasselman
tually intended to be a number. What I need is a way to find the > vector delta as a function of the elements of omega. > This make your problem incomprehensible (at least to me). I really haven't got a clue of what you want. Berend Hasselman > > Da: Berend Hasselman <b...@xs4all.

Re: [R] System of equations with unknowns in R

2016-07-20 Thread Berend Hasselman
> On 20 Jul 2016, at 20:07, Berend Hasselman <b...@xs4all.nl> wrote: > > > > This functions a scalar not a function Correction. This should have been This function returns a scalar not a vector. Berend Hasselman __ R-help@

Re: [R] System of equations with unknowns in R

2016-07-20 Thread Berend Hasselman
ugh information to give an answer to your question. > [[alternative HTML version deleted]] > Please do not post in HTML. Berend Hasselman > __ > R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see > https://stat.ethz.

Re: [R] Writing R package that call Fortran codes

2016-06-16 Thread Berend Hasselman
> On 16 Jun 2016, at 21:04, Eduardo M. A. M.Mendes <emammen...@gmail.com> wrote: > > >> On Jun 16, 2016, at 3:50 PM, Berend Hasselman <b...@xs4all.nl> wrote: >> >> >>> On 16 Jun 2016, at 20:02, Eduardo M. A. M.Mendes <emammen...@gmail.

Re: [R] Writing R package that call Fortran codes

2016-06-16 Thread Berend Hasselman
> On 16 Jun 2016, at 20:02, Eduardo M. A. M.Mendes <emammen...@gmail.com> wrote: > > Thanks Bill for pointing this out. I haven’t noticed it. > > Vineetha, try as.double(rep(0,n)) or as.matrix(rep(0,n)), > Why not simply numer

Re: [R] system() command not working

2016-06-05 Thread Berend Hasselman
ist. But you can try this: MRT_DATA_DIR= open -a Rstudio or MRT_DATA_DIR= open -a R Try it and see what happens. It may even be possible to put something in .Rprofile setting your environment variables. Berend Hasselman > HTH, > > -Roy > >> On Jun 4, 2016, at 11:59 AM, J Payn

Re: [R] translating function td of package tempdisagg to FORTRAN

2016-06-02 Thread Berend Hasselman
e found on CRAN: https://cran.r-project.org Follow the link "Packages" and then "Table of available packages, sorted by name". Direct address for tempdisagg: https://cran.r-project.org/web/packages/tempdisagg/index.html The source for the full package will be in the .tar.

Re: [R] EIGEN VECTOR PROBLEM

2016-04-22 Thread Berend Hasselman
0 Do not use c as a variable name. It is a builtin function. Do not use T for TRUE; it will lead to tears at some point. Berend Hasselman __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-he

Re: [R] Solving sparse, singular systems of equations

2016-04-20 Thread Berend Hasselman
> On 20 Apr 2016, at 13:22, A A via R-help wrote: > > > > > I have a situation in R where I would like to find any x (if one exists) that > solves the linear system of equations Ax = b, where A is square, sparse, and > singular, and b is a vector. Here is some code

Re: [R] Run script R

2016-04-09 Thread Berend Hasselman
Please do NOT post in html as the posting guide tells you. Post in plain text. Your R code is a complete mess and unreadable. Berend > On 10 Apr 2016, at 01:51, Mohamed Benahmed via R-help > wrote: > > hi all , > i have an problem in script R . But when I execute the

Re: [R] Help -- feed data frames, returned from function into list --

2016-03-10 Thread Berend Hasselman
> On 10 Mar 2016, at 08:56, Sunny Singha > wrote: > > Hi, > I got a problem. Using loop, I'm trying to feed data frames, returned from > the function, into the list but not all data frames are getting captured. > > I have vector with some string values which I

Re: [R] ALLOCATE in a FORTRAN subroutine

2016-03-04 Thread Berend Hasselman
> On 4 Mar 2016, at 08:51, MAURICE Jean - externe > wrote: > > Hi Berend, > > >> The question belongs on the R-devel mailinglist. > I try to find this mailing-list ... > See https://www.r-project.org/mail.html >> You are calling your Fortran routines directly

Re: [R] ALLOCATE in a FORTRAN subroutine

2016-03-03 Thread Berend Hasselman
> On 3 Mar 2016, at 13:57, MAURICE Jean - externe > wrote: > > Hi, > I am 'translating' R functions in FORTRAN subroutines. > > Very often, an R function gives an 'array' as result and you don't have to > bother with the dimension of the array : R creates

Re: [R] Plot multiple similar equations in r

2016-03-02 Thread Berend Hasselman
> On 2 Mar 2016, at 22:22, David L Carlson wrote: > > Another way would be to use matplot() or matlines(): > >> lx<-c(0.4, 0.5, 0.6, 0.7) >> x <- seq(1, 8, length.out=100) >> myfun <- function(x, k) {(log(k)-(0.37273*log(x)-1.79389))/0.17941} >> y <- sapply(lx, function(k)

Re: [R] [FORGED] Use of "quote" in Windows and Linux..

2016-02-24 Thread Berend Hasselman
> On 24 Feb 2016, at 22:12, Santosh wrote: > > Thanks all for your response. > I didn't realize I posted in HTML.. I just typed an email as I usually > do... how do I know whether it was sent in HTML? I had not changed any > settings to send out in HTML format.. > Seems

Re: [R] String Matching

2016-02-01 Thread Berend Hasselman
> On 1 Feb 2016, at 08:03, PIKAL Petr wrote: > > Hi > > Maybe I am completely wrong but do you really need regular expressions? > > You say you want to compare first nine characters of id? > >> substr(id, 1,9)==cusip > [1] TRUE >> > > or the last six? > >>

Re: [R] R editor for Mac

2016-01-21 Thread Berend Hasselman
> On 21 Jan 2016, at 19:06, Duncan Murdoch wrote: > > On 20/01/2016 1:28 PM, Duncan Murdoch wrote: >> On 20/01/2016 1:22 PM, Christofer Bogaso wrote: >> > Hi, >> > >> > Could you please suggest a good R editor for Mac OS X (10.7.5) >> > Previously my operating system

Re: [R] R editor for Mac

2016-01-20 Thread Berend Hasselman
> On 20 Jan 2016, at 20:22, Franklin Bretschneider wrote: > > Dear Christofer Bogaso, > > > Re: > > >> Could you please suggest a good R editor for Mac OS X (10.7.5) > > > > Indeed, as Roy Mendelssohn wrote, the editor built into "R.app", the GUI > program which is

Re: [R] featurised matrix factorisation in R

2016-01-16 Thread Berend Hasselman
> On 16 Jan 2016, at 12:22, Sandeep Rana > wrote: > > Hi, > I want to perform non-negative featurised Matrix factorisation in ‘R’. Is > there any ‘R' package or documentation that explains on this ? > Well I don't know about the "featurised" but googling on

Re: [R] Updating a Time Series After Forecast()

2016-01-15 Thread Berend Hasselman
> On 14 Jan 2016, at 22:36, Lorenzo Isella wrote: > > Dear All, > Perhaps I am drowning in a cup of water, since I am positive that the > answer will be a one-liner. > Consider the following short script > > >

Re: [R] Forecasting with Timeseries with Different Frequency

2016-01-12 Thread Berend Hasselman
Have a look at the midasr package available on CRAN. It might provide what you need. Berend > On 12 Jan 2016, at 17:16, Lorenzo Isella wrote: > > Dear All, > Suppose you have some time series, e.g. monthly data about > profits in a company. > I am trying to develop a

Re: [R] Solve an equation including integral

2016-01-08 Thread Berend Hasselman
> On 8 Jan 2016, at 17:47, Ravi Varadhan wrote: > > There was a mistake in the previously sent function. I had hard coded the > values of parameters `nu' and `exi'. > > Use this one: > > myroot <- function(t, nu, exi, alpha){ > fun <- function(t, exi, nu) >

Re: [R] Make a box-whiskers plot in R with 5 variables, color coded.

2015-12-15 Thread Berend Hasselman
> On 15 Dec 2015, at 18:49, John Sorkin wrote: > > On this side of the Atlantic, the symbols ( or ) are properly called > parenthesis not brackets. Consider the expression parenthetical expression, > which means something enclosed in parentheses. > John >

Re: [R] Extracting part of alpha numeric string

2015-11-30 Thread Berend Hasselman
> On 30 Nov 2015, at 14:57, phgrosj...@sciviews.org wrote: > > >> On 30 Nov 2015, at 13:09, Abhinaba Roy wrote: >> >> Hey, >> >> worked like a charm! :) >> >> Could you please explain about >> >> sub("^([0-9]*).*$", "\\1", fields) >> > > Yes. > > sub() replaces

Re: [R] Optim() and Instability

2015-11-14 Thread Berend Hasselman
> On 14 Nov 2015, at 16:15, Lorenzo Isella wrote: > > Dear All, > I am using optim() for a relatively simple task: a linear model where > instead of minimizing the sum of the squared errors, I minimize the sum > of the squared relative errors. > However, I notice that

Re: [R] Optim() and Instability

2015-11-14 Thread Berend Hasselman
> On 14 Nov 2015, at 17:02, Berend Hasselman <b...@xs4all.nl> wrote: > >> >> On 14 Nov 2015, at 16:15, Lorenzo Isella <lorenzo.ise...@gmail.com> wrote: >> >> Dear All, >> I am using optim() for a relatively simple task: a linear model where

Re: [R] using Fortran with R

2015-11-06 Thread Berend Hasselman
> On 6 Nov 2015, at 17:23, Erin Hodgess wrote: > > Hello everyone! > > Could someone recommend a good reference for Fortran with R, please? I > know that Dirk has an excellent book for C/C++, but I feel more comfortable > with Fortran (I'm old school, maybe just old!)

Re: [R] Avoiding for loops

2015-10-25 Thread Berend Hasselman
> On 25 Oct 2015, at 11:42, Maram SAlem wrote: > > Hi All, > > I wonder if I can avoid the for() loop in any of the following loops.These > loops are a part of a larger code which I'm trying to accelerate. > > n=6 > m=4 > x<-c(0,1,1) > > 1st loop > > for (i in

Re: [R] Most appropriate function for the following optimisation issue?

2015-10-20 Thread Berend Hasselman
> On 20 Oct 2015, at 15:35, Duncan Murdoch wrote: > > On 20/10/2015 6:58 AM, Andy Yuan wrote: >> Hello >> >> Please could you help me to select the most appropriate/fastest function to >> use for the following constraint optimisation issue? > > Just project S into

Re: [R] optimization problem

2015-10-17 Thread Berend Hasselman
Your model is producing -Inf entries in the vector Be (in function modl and LL) at some stage during the optimization process. You should first do something about that before anything else. Berend > On 17 Oct 2015, at 03:01, Bert Gunter wrote: > > I made no attempt

Re: [R] error with seq() used in for loop

2015-10-11 Thread Berend Hasselman
> On 11 Oct 2015, at 13:52, Maram SAlem wrote: > > Dear All, > I have a question concerning the seq() function arguments when used in a > for() loop. > I'll simplify this question to make it more clear. Suppose I have a > (5*3)matrix s (for ex.) and I need to write a

Re: [R] error with seq() used in for loop

2015-10-11 Thread Berend Hasselman
> On 11 Oct 2015, at 14:12, Maram SAlem wrote: > > Thanks a lot for your help and patience Duncan. > It seems that my questions is really a trivial one but I never realized > that 1:4 means 0 1 2 3 4 , never knew it starts from 0. > It doesn’t mean what you

Re: [R] Construct a lower-triangular matrix

2015-10-10 Thread Berend Hasselman
> On 10 Oct 2015, at 10:00, David Winsemius wrote: > > > On Oct 9, 2015, at 10:57 PM, Steven Yen wrote: > >> Dear >> How do you construct a lower triangular matrix from a vector. >> >> I want to make vector >> >> a <- 1:10 >> >> into a triangular matrix >> >> 1 0 0

Re: [R] Construct a lower-triangular matrix

2015-10-10 Thread Berend Hasselman
> On 10 Oct 2015, at 13:39, peter dalgaard <pda...@gmail.com> wrote: > >> >> On 10 Oct 2015, at 10:49 , Berend Hasselman <b...@xs4all.nl> wrote: >> >>> >>> On 10 Oct 2015, at 10:00, David Winsemius <dwinsem...@comcast.net> wrote:

Re: [R] Strange Bug in R

2015-10-06 Thread Berend Hasselman
> On 6 Oct 2015, at 09:24, Neverstop wrote: > > Hi all. > I don't understand why R works this way: >> rm(list=ls()) >> require(foreign) >> dataset <- read.dta("http://www.ats.ucla.edu/stat/data/ologit.dta;) >> min(dataset$gpa) > [1] 1.9 >> min(dataset$gpa)>=1.90 > [1]

Re: [R] Spreadsheet math problem (exponentiation)

2015-09-18 Thread Berend Hasselman
> On 18 Sep 2015, at 16:31, John McKown wrote: > > On Fri, Sep 18, 2015 at 8:39 AM, John Kane wrote: > >> It appears that at least three major spreadsheets, Excel, Apache >> OpenOffice Cal and gnumeric have a problem with the correct order of

Re: [R] Multiple if function

2015-09-17 Thread Berend Hasselman
> On 17 Sep 2015, at 01:42, Dénes Tóth wrote: > > > > On 09/16/2015 04:41 PM, Bert Gunter wrote: >> Yes! Chuck's use of mapply is exactly the split/combine strategy I was >> looking for. In retrospect, exactly how one should think about it. >> Many thanks to all for a

Re: [R] Hep with regex! - combination of ^, |, \\, _ and $

2015-09-17 Thread Berend Hasselman
> On 17 Sep 2015, at 23:11, Dimitri Liakhovitski > wrote: > > (x <- c("q10_1", "q10_2", "q10_11", "q12_1", "q12_2", "q13_1", "q13_11")) > > # Which strings start with "q10" or "q12? - WORKS > x[grep("^q10|q12", x)] > > # Which strings end with "1"? - WORKS >

Re: [R] lsqlin in pracma

2015-08-29 Thread Berend Hasselman
On 29 Aug 2015, at 20:53, Berend Hasselman b...@xs4all.nl wrote: On 29 Aug 2015, at 18:29, Ravi Varadhan ravi.varad...@jhu.edu wrote: In solve.QP(), you don't need to expand the equality into two inequalities. It can DIRECTLY handle the equality constraints. The first `meq' rows

Re: [R] lsqlin in pracma

2015-08-29 Thread Berend Hasselman
On 29 Aug 2015, at 18:29, Ravi Varadhan ravi.varad...@jhu.edu wrote: In solve.QP(), you don't need to expand the equality into two inequalities. It can DIRECTLY handle the equality constraints. The first `meq' rows of the constraint matrix are equality constraints. Here is the excerpt

Re: [R] lsqlin in R package pracma

2015-08-28 Thread Berend Hasselman
Nice and interesting! Something to remember. Lesson (for me): Always first look in Task Views on CRAN. Choose Optimization and look at Mathematical Programming Solvers. Berend On 28 Aug 2015, at 12:56, Hans W Borchers hwborch...@gmail.com wrote: I got interested in enabling the full

  1   2   3   4   5   6   7   8   9   10   >