Displaying 5 results from an estimated 5 matches for "saledate".
2011 Jul 05
2
Stuck ...can't get sapply and xmlTreeParse working
...ottom of the code. Other stuff above line 24 works
correctly including the first couple of lines of the function hm. Should I
be using a different apply function or am I doing something wrong with
xmlTreeParse ?
library(XML)
url.montco <-
"http://webapp.montcopa.org/sherreal/salelist.asp?saledate=07/27/2011"
tbl <-data.frame(readHTMLTable(url.montco))[, c(3,5,6,8,9)]
tbl <-tbl[2: length(tbl[,1]),]
names(tbl) <- c("Address", "Township", "Parcel", "SaleDate", "Costs");
rownames(tbl) <- NULL
v <- gregexpr("( aka )|( AKA...
2011 May 26
2
What am I doing wrong with sapply ?
...h statement 11 and
I get the answer I'm looking for.
9 : s <-sapply(unlist(v[c(1:length(v))]), max)
11: for(i in 1 :length(v)) v1[i] <- max(unlist(v[i]))
Shouldn't I get the same answer ?
library(XML)
rm(list=ls())
url <-
"http://webapp.montcopa.org/sherreal/salelist.asp?saledate=05/25/2011"
tbl <-data.frame(readHTMLTable(url))[2:404, c(3,5,6,8,9)]
names(tbl) <- c("Address", "Township", "Parcel", "SaleDate", "Costs");
rownames(tbl) <- c(1:length(tbl[,1]))
x <-tbl
v <- gregexpr("( aka )|( AKA )",...
2009 Mar 04
10
total per user
...er 1: Jan $3000 Feb $4000 March $1500, etc. I can get this to work
if I sum totals (aggregate of all users) but just not by user.
Here is my code in the controller:
def index
@users = User.find :all, :order => ''name ASC''
@deal_groups = Deal.find(:all).group_by {|t|
t.saledate.at_beginning_of_month}
end
And then the code in the View
<% for user in @users %>
<ul id="monthly-revs">
<strong><li><%=h Time.now.year %></li></strong>
<% user.deal_groups.keys.sort.each do |month| %>
<li><%=h month.strft...
2011 May 15
1
Need help with text processing / string split
I used screen scraping to extract some information and put it into a table
called tbl. Now I want to modify the table a bit so the data can be more
useful. Here's the code I used:
library(XML)
rm(list=ls())
url <-
"http://webapp.montcopa.org/sherreal/salelist.asp?saledate=05/25/2011"
tbl <-data.frame(readHTMLTable(url))[2:405, c(3,5,6,8,9)]
names(tbl) <- c("Address", "Township", "Parcel", "Sale Date", "Costs")
tbl is attached as txt for your convenience. Entries in the last column of
the dataframe (tbl$Co...
2011 Feb 09
4
Modules being shared and model data
...ccessible :name, :code, :cost, :company_id, :margn
belongs_to :company
has_many :allocations
has_many :companies, :through => :allocations
end
An allocation model:
class Allocation < ActiveRecord::Base
include Pricing
attr_accessible :company_id, :allocated_product_id, :quantity,
:saledate, :cost
belongs_to :company
belongs_to :allocated_product, :class_name => ''Product'' #So you have
company.products and company.allocated_products.
end
A products and allocations controller:
class ProductsController < ApplicationController
def index
@products = Produ...