Akhilesh,
I don't know if I am adding signal or noise here, but I installed R 3.5.0
yesterday and installed data.table just fine, but I have Rtools installed.
"Building packages from source" may sound intimidating, but Rtools is really
easy to install and once installed, it does all the work f
Dominik,
Folders with spaces can be very tricky sometimes. In my case single quotes
didn't work, but double quotes did (see my example below). Adding the full
path to your PATH variable with eliminate the need to specify the full path,
making it much easier.
Thanks,
Roger
Microsoft Window
Thanks Richard. That worked beautifully!
-Original Message-
From: Richard M. Heiberger [mailto:r...@temple.edu]
Sent: Wednesday, January 25, 2017 12:58 PM
To: Bos, Roger
Cc: R Help R
Subject: Re: [R] selecting colors to be used in a plot
This package uses a nonstandard name colorset
My specific question relates to function charts.PerformanceSummary in package
PerformanceAnalytics, but the underlying problem is probably with base plot.
In this sample code we see a chart with 10 groupings. Apparently 10 groupings
is bigger than the number of default colors (8), so red and bl
Glenn,
R Studio did a webinar on Web Scraping using the rvest package that made it
look really easy. I haven't gotten around to using it yet, but the video
should be on their website somewhere. The link below is the PDF of the slides.
It should be education and will probably give you what yo
this message or any attachments if you are not
the intended recipient.
From: William Dunlap [mailto:wdun...@tibco.com]
Sent: Friday, October 07, 2016 11:57 AM
To: Bos, Roger
Cc: R-help
Subject: Re: [R] weighted regression inside FOREACH loop
Using the temporary child environment works because
riginal Message-
From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of Bos, Roger
Sent: Friday, October 07, 2016 9:25 AM
To: R-help
Subject: [R] weighted regression inside FOREACH loop
I have a foreach loop that runs regressions in parallel and works fine, but
when I try to add the w
I have a foreach loop that runs regressions in parallel and works fine, but
when I try to add the weights parameter to the regression the coefficients
don’t get stored in the “models” variable like they are supposed to. Below is
my reproducible example:
library(doParallel)
cl <- makeCluster(4)
from your system and destroy any hard copies. You must
not, directly or indirectly, use, disclose, distribute,
print or copy any part of this message or any attachments if you are not
the intended recipient.
-Original Message-
From: Jeff Newmiller [mailto:jdnew...@dcn.davis.ca.us]
Sent: Th
The ishares website has the S&P 500 stocks you can download as a XLS file,
which opens fine in Excel, but I am not able to open it in R due to what seems
to be invalid XML formatting. I tried using XLConnect and XML as shown below.
Does anyone know a workaround or can point out what I am doin
Michael,
I use sendmailR to attached a file to an email and it does work. I remember
there was something non-intuitive when I was figuring it out. I use both the
attachPath and the attachName. The attachPath has the full path including the
filename and the attachName just has the filename.
There is probably nothing that can give you a step by step guide. You are
touching on a couple of different subjects. If you just want to run code
automatically on a windows server you can use task scheduler to call Rscript
filename.R. If you want to create Web application, that's a bit harde
I am trying to figure out how to use dcast.data.table with a function with
multiple arguments. Here is my reproducible example for a simple function of
one argument:
require(data.table)
dt <- as.data.table(mtcars)
dcast.data.table(dt, carb ~ cyl, value.var='mpg', fun=mean)
If I instead want to
Answering my own question, I was able to make the tables look better in IE
using some simple CSS:
td {
padding: 6px;
}
-Original Message-
From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of Bos, Roger
Sent: Tuesday, July 14, 2015 11:36 AM
To: r-help@r-project.org
This might be a little off topic, but I am starting to produce some HTML
reports that contain mostly tables and they look great in Chrome but really bad
in IE, so I wanted to see if anyone knows of a better way or an easy fix. One
option I have used is to convert to PDF, but sometimes it is nic
I have a string that contains a number and when I convert it to a number I
loose precision and I would like to know if there is a way to avoid that. Here
is my example:
p <- "1087.003489"
as.numeric(p, digits=6)
R gives me 1087.003:
> p <- "1087.003489"
> as.numeric(p, digits=6)
[1] 1087.003
Valerio,
Actually htmlize works pretty well. I used it for a long time. If you want to
get the most help from this forum you need to provide a reproducible example
showing htmlize not working for you.
Nevertheless, today I would recommend going with RMarkdown. It may be overkill
for your ex
Dear All,
I would like to learn the proper way to set the default time zone so I get the
correct date for my files. The code below is non-reproducible (sorry) because
it is based on a file on my system, but I hope someone will be able to help me
anyway.
I have a file that was last modified on
All,
I am trying to read the S&P 500 constituents from the iShares website using the
following code:
URL <- "http://www.ishares.com/us/239726/fund-download.dl";
setInternet2(TRUE)
download.file(url=URL, destfile="temp.xls")
out <- readWorksheetFromFile(file="temp.xls", sheet="Holding
Disclaimer: This question is more about HTML than R, but since I am using
rmarkdown, I am not sure of a better forum to ask this. The code example below
produces two column HTML output. If you run the example you will see that the
"" paragram starts off at the bottom of the first column an
Andrew,
I ran your code using my SQL Server database and it seems like it worked okay
for me, in that I end up with "num" data types when I read the data back in.
So it may be a setting on your database. I don't claim to know which one.
BTW, I had to install 5 or 6 separate packages to get fP
Here is a simple method I saw mentioned on this list a few years ago:
toExcel <- function(x, tag=FALSE) {write.table(x, "clipboard-128", sep="\t",
row.names=tag)}
***
This message and any attachments are for the named person's use on
What I do in cases like that is wrap the code in a FALSE statement so it won't
get executed: its easy to add and remove as needed.
If (FALSE) {
...Code to exclude
}
***
This message and any attachments are for the named person'
Roger
-Original Message-
From: Duncan Murdoch [mailto:murdoch.dun...@gmail.com]
Sent: Wednesday, April 30, 2014 4:40 PM
To: Bos, Roger; r-help@r-project.org
Subject: Re: [R] R 3.1 changes to type.convert causing strings where I used to
get numeric
On 30/04/2014, 4:20 PM, Bos, Roger wrote:
> Dea
Dear R-help,
I recently upgraded to R 3.1 patched and code that ran fine previously and now
giving a lot of errors because the data is coming in as strings instead of
numeric. I can fix my code to wrapping each item I want to use with
as.numeric(), but that seems very inefficient.
I looked at
essage-
From: arun [mailto:smartpink...@yahoo.com]
Sent: Monday, January 27, 2014 5:25 PM
To: Bos, Roger
Subject: Re: [R] passing variable names to dplyr
Hi Roger,
This works on library(plyr), but not in dplyr.
target <- "hp"
res2 <- plyr:::mutate(mtcars,hp1= eval(parse(tex
Dear All,
I can't figure out how to pass multiple arguments to substitute to build up a
call statement. One argument works fine:
>target <- "val1"
> call <- substitute(select(zidx_df, datadate, target), list(target =
> as.name(target)))
> call
select(zidx_df, datadate, val1)
Now
All,
I would like to figure out how to pass variable names to the dplyr function
mutate. For example, this works because hp is one of the variable names on
mtcars:
mutate(mtcars, scale(hp))
Let's says I want to pass in the target variable instead of hard-coding the
name, as follows:
target
Thanks for the Rccp example Ken! I vaguely knew about Rccp, but I didn't
realize how easy it was to use it.
-Original Message-
From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On
Behalf Of Kenneth Knoblauch
Sent: Tuesday, October 22, 2013 9:13 AM
To: S Ellison
Cc
All,
I am using a sum of squared differences in the objective function of an
optimization problem I am doing and I have managed to speed it up using the
outer function versus the nested for loops, but my suspicion is that the
calculation could be done even quicker. Please see the code below fo
All,
I am trying to get the XLConnect package to work on one of my servers and I am
getting an error that XLConnectJars cannot create the java virtual machine.
The server is a 32-bit Windows Server 2003 machine with R 2.15.1. The version
of Java installed on the server is J2SE Environment 5.
Dinesh,
I can't answer your question, but its my understanding that Rpad is no longer
being developed as the original person (Tom Short) doesn't have enough time and
no one else has taken it over. So if you can find any other package that does
what you need, I would use that one instead.
Than
Quantstrat useRs,
I have a number of questions about how to use quantstrat that I have
accumulated since I have begun playing with it. First, can the orderqty be
dynamic? All of the examples I have seen are based on placing an order for 100
shares when a rule is triggered. Is it possible to
This is not a criticism of R, but R runs much slower on one of my machines than
it does on the others, so something is wrong with that machine, but I don't
know where to look for a remedy. Here are the details:
I have a 32-bit win xp machine running at 2.66Ghz and a 64-bit win 7 machine
runnin
NYC-based equity asset management company is seeking a junior-level
programmer with R, VBA, and MS-SQL skills. HTML skill is a plus. This
permanent, full-time position will involve working on projects and
improving our daily processes. Finance knowledge is helpful, but not
necessary. We are an
I am completely new to LaTeX and Sweave, so I am trying to follow the
tutorial in the following link:
http://www.r-bloggers.com/using-latex-r-and-sweave-to-create-reports-in-
windows/
I installed MiKTeX 2.9 and TeXnicCenter, but I get a build error when
compiler the example file:
The two errors a
I have NO knowledge of regexpr, but someone helped me out once and I put
it into a function I call "trim". Here is the line I use:
function(x) gsub("^[[:space:]]+|[[:space:]]+$", "", x)
One more thing you can try. Hope it helps, Roger
-Original Message-
From: r-help-boun...@r-project.o
You could break the data into chunks, so you cbind and save 50,000
observations at a time. That should be less taxing on your machine and
memory.
-Original Message-
From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org]
On Behalf Of Mary Kindall
Sent: Friday, January 06,
All,
I would like to use the assign to save some data from a calculation
within a foreach loop. Below is a contrived example where I cannot get
output_1 ... output_100 to show up in my list when I do ls(). I have
tried different combinations of pos and envir without anything showing
up.
All,
Could anyone recommend a package that allows the user to constrain the
coefficients from a multiple regression equation?
I tried using the gl1ce function in lasso2, but couldn't get it to
work. I created a contrived example to illustrate my starting point.
data(cars)
fmla <- formula(di
Marc's links lists many packages. Of those, I would recommend
XLConnect.
-Original Message-
From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org]
On Behalf Of Marc Schwartz
Sent: Monday, September 12, 2011 12:53 PM
To: Damian Abalo
Cc: r-help
Subject: Re: [R] Writting
Sent: Thursday, September 08, 2011 9:22 AM
To: Bos, Roger
Cc: r-help@r-project.org
Subject: Re: [R] How to specify a variable name in the regression formula
without hard coding it
have a look at ?formula and the examples
2011/9/8 Bos, Roger :
> I have a matrix called mat and y is the column nu
I modified an example in the object.size help page to create a function
I want to be able to run:
"mysize" <- function() {
z <- sapply(ls(), function(w) object.size(get(w)))
as.matrix(rev(sort(z))[1:5])
}
mysize()
When I test the lines inside the function it works fine:
> z <- sapply
I have a matrix called mat and y is the column number of my response and
x is a vector of the column numbers of my terms. The variable name of y
can change, so I don't want to hardcode it. I can find out the name as
follows:
>names(mat)[y]
[1] "er12.l"
Then I can run the regression
All,
I have a function that runs a set of regressions (using the rlm
function) and I notice that it run much slower on my 64-bit R than it
does on my 32-bit R. I guess the bigger bit size slows it down.
Anyway, I looked into Rprof to see how I can speed it up. I saw that
78% of the total time is
Duncan's suggestion is probably the way to go, but I will just point out
that R does have a facility to perform a task when an error occurs. I
have my code set up to send me an email when my batch code fails.
(email() is a function I wrote that executes sql command to send email
via dbmail.)
.Err
Saskay,
Thanks so much for that example. It worked fine on my system. I didn't
realized SNOW worked on windows. I will have to read more about it.
Thanks again,
Roger
-Original Message-
From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org]
On Behalf Of saskay
Sen
example
where user written function has to be exported to slave processors?
Thanks,
Roger
-Original Message-
From: wootten.adrie...@gmail.com [mailto:wootten.adrie...@gmail.com] On Behalf
Of Adrienne Wootten
Sent: Tuesday, July 12, 2011 5:49 PM
To: Bos, Roger
Cc: r-help@r-project.org
All,
I am not understanding the scoping used in foreach when it is used
inside a function. I keep getting "could not find function" errors for
functions that are in memory when I try to use foreach within a function
call. I have a simple example below. "testFun" is in memory and works
when call
Please note that Rpad is not being updated and does not work
(unmodified) with versions of R greater than 2.9. So if you are trying
to use it and it is not working, that may explain your difficulty.
I still use it because better alternatives, like RApache, don't work on
Windows.
-Original M
I took a look at sendmailR when I was trying to figure out how to send
email a few years ago. I ended up using my SQL Server dbmail facility,
which I can easily access from R using the RODBC package. In case my
scenario applies to anyone else, I will paste the simple function I
wrote to serve as
All,
When I use gdata::read.xls to read in an excel file it seems to round
the data to three decimal places and also converts the dates to factors.
Does anyone know how to 1) get more precision in the numeric data and 2)
how to prevent the dates from being converted to levels or factors? I
trie
toupper() and tolower()
-Original Message-
From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org]
On Behalf Of Erin Hodgess
Sent: Friday, December 17, 2010 4:10 PM
To: R help
Subject: [R] lower/upper case question
Dear R People:
Is there a function to convert a charact
I asked Jeff Horner that question a while back and he said it was Linux
only. He doesn't have time to create a windows version.
-Original Message-
From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org]
On Behalf Of Santosh Srinivas
Sent: Saturday, December 11, 2010 8:3
Josh,
I liked your idea of setting the repo in the .Rprofile file, so I tried it:
r <- getOption("repos")
r["CRAN"] <- "http://cran.stat.ucla.edu";
options(repos = r)
rm(r)
And now when I open R I get an error:
Error in r["CRAN"] <- "http://cran.stat.ucla.edu"; :
cannot do complex assignme
I created a small example to show something that I do a lot of. "scale"
data by month and return a data.frame with the output. "id" represents
repeated observations over "time" and I want to scale the "slope"
variable. The "out" variable shows the output I want. My for..loop
does the job but is
I use RKWard and find it to be pretty good. It show the consol built-in
and has good editing features. You can add custom shortcuts so I can
make it work just like I make Tinn-R work (i.e. hit F10 to run selected
code, etc.). Please note that Tinn-R is not available on Linux (to my
knowledge), t
Ubuntu also uses ~ as a backup file syntax, but Ubuntu has a trash can
where deleted files are located, so it would be easy to restore them. I
would be surprised if Fedora didn't also have a trash can.
-Original Message-
From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project
I can change to make the two work more
smoothly together, but I just haven't found it yet.
Thanks,
Roger
-Original Message-
From: henrik.bengts...@gmail.com [mailto:henrik.bengts...@gmail.com] On Behalf
Of Henrik Bengtsson
Sent: Tuesday, July 06, 2010 9:24 AM
To: Bos, Roger
Cc: Uwe Ligg
Uwe,
I suspect I might be having a similar problem as the R code I generate
in Windows editor (Tinn-R) doesn't always open properly in my Linux
editor (Rkward), but I don't know how to change the default encoding in
either one.
In R on both machines, getOption("encoding") returns "native.enc",
I use two PCs for my R programming, one Win32 and one Linux (Ubuntu 10).
In Windows I use Tinn-R to save my code and occasionally I am unable to
open a Tinn-R saved file in Ubuntu. If I try to open in gedit I get a
message that "gedit has not been able to detect the character encoding."
To correct
When I encounter memory errors, I like to see the size of the objects in
memory, so I modified one of the examples:
z <- sapply(ls(), function(x) object.size(get(x)))
as.matrix(rev(sort(z))[1:10])
This works fine if I run it as is, but if I try to place it inside a
function, I get an erro
Many others have made good comments regarding your questions, my
suggestion would be this: You may or may not know that R is freely
available and that you can install more than one version of R on the
same PC, so I would suggest installing both R 2.6 and the latest version
of R (2.10.x) and try ru
Paul,
I have never tried odbcDriverConnect, but I can tell you how I connect to my
SQL Server 2005 db. I create a DNS entry using "odbcad32" (use start>run).
You can specify everything there and test the connection. Once that tests
okay, just use the following:
library(RODBC)
xf <- odbcConn
Erich,
I use Rpad actively so I am disappointed to hear it is no longer being
updated. Would you be willing to share your modifications with the
list, or at least with me?
Thanks,
Roger
-Original Message-
From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org]
On Beh
I am trying to create plots within a for loop and output them to a pdf.
Here is a working example using plot:
gg <- data.frame(datadate=1:4, spread=5:8)
pdf()
for (i in 1:3) {
plot(gg$datadate, gg$spread, main=i)
}
dev.off()
I am try
I have a character string and I would like to remove the leading and
tailing white spaces. The example for 'sub' shows how to remove the
trailing white spaces, but I still can't figure out how to remove both
trailing and leading white spaces because I can't find any documentation
for what "+$" mea
I wrote simple function to copy data from/to excel using the clipboard.
These should also work from one window to the next:
# To read from clipboard
"fromExcel" <- function() {read.table("clipboard-128", header=TRUE,
sep="\t")}
"toExcel" <- function(x) {write.table(x, "clipboard-128", sep="\t",
ro
I have not seen Tinn-R mentioned so I will mention it. Its worked great for
me. Eclipse is a nice IDE, but its more complicated that what is necessary for
R programming.
-Original Message-
From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On
Behalf Of Martial
John,
If you really do like the R-help list, you may want to see if your email
program has folders and auto-rules. Since all R-help emails have [R] in
the subject line, you can put all those email in a separate folder so
everything doesn't get mixed up. That is what I do.
HTH, Roger
-Origi
2008 7:24 PM
To: Bos, Roger
Cc: R-help
Subject: Re: [R] Creating GUIs for R
Hi Roger,
Bos, Roger wrote:
> I haven't heard Rpad mentioned yet, so I will mention it. Rpad allows you to
> run R code inside a browser window. You can many any kind of GUI you want
> using html f
I haven't heard Rpad mentioned yet, so I will mention it. Rpad allows you to
run R code inside a browser window. You can many any kind of GUI you want
using html forms and then call the R function from the html page. The
Apache/Rpad install works on any platform and anyone who uses it just ne
All,
I have a variable called `go` and it has a single quote in the name
column of line 47 that I am trying to get rid of. I have tried using
gsub, but I cannot get the syntax correct to tell R to remove the '
(single quote).
> go[47,]
gvkey SymbolName Rank MarketCap
All,
I am storing a string of email addresses in a table and when I retrieve
them using a RODBC statement such as:
test = sqlQuery(xf, "select specialist from
roger_sector_specialist")$specialist
'test' is of mode list and includes a bunch of white space. As a
work-around I convert 'test' to a
Using R 2.6.0 patched I was able to calculate the variance of each row
of a matrix without error, even if some rows had only NAs. I would just
get NAs back as the variance for those rows. Now with R 2.7.0 patched I
get an error "no complete element pairs" if any one row has all NAs.
Can anyone te
: Bos, Roger
Cc: r-help@r-project.org
Subject: Re: [R] How to parse XML
Hi Roger --
"Bos, Roger" <[EMAIL PROTECTED]> writes:
> I would like to learn how to parse a mixed text/xml document I
> downloaded from the sec.gov website (see example below). I would like
I'm
I would like to learn how to parse a mixed text/xml document I
downloaded from the sec.gov website (see example below). I would like
to parse this to get the value for each xml tag and then access it
within R, but I don't know much about xml so I don't even know where to
start debugging the errors
Another option is to modify the Rprofile.site file in the etc folder of
your R installation. Then you don't have to save the workspace. You add
as much startup scripting as you want to the Rprofile.site file.
HTH,
Roger
-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECT
Ok, outlook may not be that great, but even in outlook you can create a
separate folder called "R" and create a rule so all email with "[R]" or
"[Rdevel]" etc. going into the R folder. That way you can easily scan
your R mail separate from your regular mail and then delete everything
you don't nee
I get that even with R 2.6.0, but its not really a problem, just a
warning. In other words, everything I have done in R has worked fine
despite that warning. It would be nice if it was eventually cleaned up,
but it doesn't stop you from using R.
-Original Message-
From: [EMAIL PROTEC
That is due to some tip-server that will show you the params available
in functions, so there is a lot of overhead in parsing what you are
currently typing. Its a nice feature, but I turned it off because of
the slowness.
-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTE
Silvia,
Option / Main / Application then click on the 'R' tab. At the bottom of
the window you can browse to the new location.
HTH, Roger
-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
On Behalf Of Silvia Lomascolo
Sent: Friday, October 26, 2007 2:31 PM
To: r-help
All,
I am trying to post text from an XLS spread to my wiki and I need to
remove any characters that are not UTF-8. Is there an easy gsub command
that can do this?
(I previously sent this same email to r-sig-gui. That was a mistake and
I apologize for the duplication.)
Thanks, Roger J. Bos
**
Rainer,
This works: paste(x, sep="", collapse="")
I would have thought this 'paste(x) would work, but it didn't.
Perhaps someone else can tell us why we need collapse="". What would
break if the default was collapse="" instead of collapse=NULL?
Thanks,
Roger
-Original Message-
From:
84 matches
Mail list logo