Displaying 20 results from an estimated 4000 matches similar to: "Bug in my code (finding nonzero min)"
2006 Mar 03
5
avoiding nil object error?
I''m a total Rails newbie and i''ve been struggling for hours today
with one (prolly very silly) problem:
I have a table portfolios that has many images:
class Portfolio < ActiveRecord::Base
has_many :images
end
class Image < ActiveRecord::Base
belongs_to :portfolios
end
In the controller i define a list of active portfolios:
@active_portfolios =
2013 Jul 01
1
dotchart.R and left margin
Hello,
In trying to minimize the margin on the left hand side when using
dotchart I found what may be a typo in the code.
In the lines below from dotchart.R, should nmai[4L] be nmai[2L]?
if (!(is.null(labels) && is.null(glabels))) {
nmai <- par("mai")
nmai[2L] <- nmai[4L] + max(linch + goffset, ginch) + 0.1
par(mai = nmai)
}
Thank you,
Stephen Weigand
--
2005 Oct 11
1
R and SAS pointer/informat functionality
Hello,
I hope all is well. I've gone through and searched just about all the
manuals, faqs, contribs available on the data import/export process and
have not found any answer to a specific question. Hopefully, I will be
able to fall back upon the valuable expertise in mailing list. Here goes:
How can I import SPECIFIC columns of data in a fixed width file? E.g. I
have a fwf with 40
2005 Oct 11
1
R data import
Hello,
I hope all is well. I've gone through and searched just about all the
manuals, faqs, contribs available on the data import/export process and
have not found any answer to a specific question. Hopefully, I will be
able to fall back upon the valuable expertise in mailing list. Here goes:
How can I import SPECIFIC columns of data in a fixed width file? E.g. I
have a fwf with 40
2011 Jul 07
2
elimination duplicate elements sampling!
Hi everyone!
I have a data frame with 1112 time series and I am going to randomly
sampling r samples for z times to compose different portfolio size(r
securities portfolio). As for r=2 and z=10000,that's:
z=10000
A=seq(1:1112)
x1=sample(A,z,replace =TRUE)
x2=sample(A,z,replace =TRUE)
M=cbind(x1,x2) # combination of 2 series
Because in a portfolio with x1[i]=x2[i],(i=1,2,...,10000) means a 1
2008 Jun 16
1
tiff(), jpeg(), and png() in R 2.7.0: problems if 'units = "in"' but default height and width
I love the new tiff(), jpeg(), and png() in R 2.7.0 but found
an issue that I didn't see reported.
When specifying 'units = "in"' but forgetting to change the
default height and width (so the figure is unintentionally
going to be 480 inches by 480 inches) I run into problems.
Here's the reproducible example:
tiff("a.tiff", units = "in", res = 1200,
2014 Jun 13
1
Encourage exit with nonzero error status in ?last.dump
The following example in ?dump.frames
options(error = quote({dump.frames(to.file = TRUE); q()}))
is useful for teaching the user how to save a frame dump when R
encounters an error during non-interactive sessions. This command
however causes an additional change that on encountering an error R
exits with a 0 error status. Although it's just an example, it's an
important one as it's
2012 Jul 23
1
Help with Portfolio Optmization
Hi,
I need some help with Portfolio Optimization problem. I am trying to find
the minimum variance portfolio subjected to constraints on weights like
/x1< w1 <x2
x3< w2 <x4</i>
I need help with solving for the minimum variance portfolio as solve.QP
doesn't allow me to specify the lower boundaries.
Thanks
Mahesh
--
View this message in context:
2010 Jul 30
2
finding a function or a line while debugging?
guRus
Is there a way by which I can search for a particular function or a
particular line of code within the maze of all the R codes that are
interlinked? Say for instance I am running a code using quantstrat package
and on a particular line I get the error saying x is missing in is.array(x).
I want to figure out where is.array is in all the codes that my code refers
to? How do I do this? Is
2015 Mar 18
0
[PATCH 1/2] mllib: allow external_command to return on nonzero return value
This is useful for probing probing for cache files such as:
external_command ?ignore_error:(Some true) ~prog "ls .cache/something.*"
will return command output (matched files) on its success or empty list
whenits exit code is other than 0 (there are no such files).
---
mllib/common_utils.ml | 15 ++++++++++-----
mllib/common_utils.mli | 2 +-
2 files changed, 11 insertions(+), 6
2001 Oct 09
3
find indices of nonzero elements
Hi,
Is there a function func(x) where x is an array such that it
returns a list of the indices of all non-zero elements of the array?
for example:
a:
1 0 0
0 0 1
0 1 0
func(a) returns two vectors r and c:
r c
1 1
2 3
3 2
daver
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|David Richmond It works on a |
+ Dept. of Sociology complex scientific
2002 Mar 22
0
sequential t-test - replies
[my original message to s-news & r-help is attached ]
No one possessed or knew of any S/R code for the sequential t-test. Also
it doesn't appear in the SAS index.
One or two suggested obtaining the S+ seqtrial software which may (or may
not) cover this, but this seemed to be a bit of a "hammer to crack a nut".
I have written a function based on the treatment in Wetheril
2011 Oct 19
1
Sparse covariance estimation (via glasso) shrinking to a "nonzero" constant
I've only been using R on and off for 9 months and started using the
glasso package for sparse covariance estimation. I know the concept is
to shrink some of the elements of the covariance matrix to zero.
However, say I have a dataset that I know has some underlying
"baseline" covariance/correlation (say, a value of 0.3), how can I
change or incorporate that into to the
2005 Jan 13
1
how to use solve.QP
At the risk of ridicule for my deficient linear algebra skills, I ask
for help using the solve.QP function to do portfolio optimization. I
am trying to following a textbook example and need help converting the
problem into the format required by solve.QP. Below is my sample code
if anyone is willing to go through it. This problem will not solve
because it is not set up properly. I hope I
2006 Feb 09
6
troubleshooting an observe_field
Hi,
I''ve got a live_search field in a partial that is on several different
pages. On all pages, except 1, it works fine. On the page it doesn''t work
on, it seems it never executes it action.
Here''s my observe_field code inside the partial:
<h1><label for="searchtext">Live Search:</label></h1>
<%= text_field_tag :searchtext
2012 Feb 15
2
Control number of assets in resulting portfolio with optimizations using package fPortfolio
Dear All,
I am using package fPortfolio to run minimum variance portfolio
optimizations in R. I already know how to set portfolioSpecs, portfolio
objects and constraints. Unfortunately I am not able to set the following
type of constraints.
I have a timeSeries object with returns data for roughly 1.5k assets for 261
subperiods (workingdays) and want to compute the global minimum variance
2008 Nov 18
2
anyone familiar with this error?
[whit at linuxsvr R.packages]$ sudo R CMD INSTALL portfolio.construction
* Installing to library '/usr/local/lib64/R/library'
* Installing *source* package 'portfolio.construction' ...
** R
** preparing package for lazy loading
Loading required package: fts
Loading required package: quadprog
Loading required package: Rexcelpoi
terminate called after throwing an instance of
2011 Jan 07
1
Currency return calculations
Dear sir, I am extremely sorry for messing up the logic
asking for help w.r.t. my earlier mails
I have tried to explain below what I am looking for.
I have a database (say, currency_rates) storing datewise
currency exchange rates with some base currency XYZ.
currency_rates <- data.frame(date =
c("12/31/2010", "12/30/2010", "12/29/2010",
2012 Oct 12
1
error msg using na.approx "x and index must have the same length"
Below I have written out some simplified data from my dataset. My goal is
to interpolate Price based on timestamp. Therefore the closer a Price is in
time to another price, the more like that price it will be. I want the
interpolations for each St and not across St (St is a factor with levels
A, B, and C). Unfortunately, I get error messages from code I wrote.
In the end only IDs 10 and 14 will
2009 Sep 25
8
Cheapest Rails Hosting where they give you full access to Apache (to load modules etc)???
any pointers / suggestions re cheapest Rails hosting where they give
you full access to Apache (to load modules etc)??? Can be a shared
platform, however not sure if there is a shared platform type hosting
service where they do give you such access?