Displaying 16 results from an estimated 16 matches for "pflugg".
Did you mean:
pflug
2010 Aug 10
3
sapply/lapply instead of loop
Using the input below, can I do something more elegant (and more efficient)
than the loop also listed below to pad strings to a width of 5? The true
matrix is about 300K rows and 31 columns.
#######################
#INPUT
#######################
> temp
DX1 DX2 DX3
1 13761 8125 49178
2 63371 v75 22237
3 51745 77703 93500
4 64081 32826 v72
5 78477 43828 87645
>
2011 Jun 24
2
SQL Changing Data Type
Passing in two dates to a sql statement (sqldf). Is returning a factor. Tried
setting back to a Date via as.Date, but get an error the error: character
string is not in a standard unambiguous format. Any thoughts appreciated.
Code/Results listed below:
> summary(df.possible.combos)
Date Hour
Min. :2011-03-01 Min. : 0.00
1st Qu.:2011-03-23 1st Qu.: 5.75
2010 Jun 28
6
Basic question - more efficient method than loop?
I'm guessing there's a more efficient way to do the following using the index
features of R. Appreciate any thoughts....
for (i in 1:nrow(dbs1)){
if(dbs1$Payor[i] %in% Payor.Group.Medicaid) dbs1$Payor.Group[i] =
"Medicaid"
if(dbs1$Payor[i] %in% Payor.Group.Medicare) dbs1$Payor.Group[i] =
"Medicare"
if(dbs1$Payor[i] %in% Payor.Group.Commercial)
2010 Jan 28
2
Print lattice output to table?
I have beautiful box and whisker charts formatted with lattice, which is
obviously calculating summary statistics internally in order to draw the
charts. Is there a way to dump the associated summary tables that are being
used to generate the charts? Realize I could use tapply or such to get
something similar, but I have all the groupings and such already configured
to generate the charts. Simply
2010 Nov 01
1
sqldf hanging on macintosh - works on windows
Have a long script that runs fine on windows (32 bit). When I try to run in
on two different macs (64 bit), however, it hangs with identical behavior.
I start with:
library(sqldf)
This results in messages:
Loading required package: DBI
Loading required package: RSQLite
Loading required package: RSQLite.extfuns
Loading required package: gsubfn
Loading required package: proto
Loading required
2010 Aug 10
3
Intersecting list vs rows in matrix
Know that if I have List_1 and List_2 that I can check to see if the
intersect via the code below:
List _1:
a, b, c, d, e, f, g
List_2:
z, y, x, w, v, u, b
length(intersect(List_1, List_2)) > 0
return = true
If instead I wanted to check a dataframe that is a "list of lists," how
would I do that by record without looping?
List _1:
a, b, c, d, e, f, g
List_2:
z, y, x, w, v,
2010 Jun 21
2
Return value associated with a factor
I am using the code below to extract census tract information.
save.tract$state, save.tract$county and save.tract$tract are returned as
factors. In the last three statements, I need to save the actual value of
the factor, but, instead, the code is yielding the position of the factor.
How do I instead return the value of the factor?
By way of example, for Lon=-82.49574 and Lat=29.71495, the code
2010 Jan 25
3
question on sqldf syntax
trying to structure sql to merge two datasets. structure follows:
dbs.possible.combos (all possible combinations of dates and places)
Date Place
1/1/10 N-01
1/1/10 S-02
1/2/10 N-01
1/2/10 S-02
etc...
dbs.aggregate (the raw data aggregated by date and location)
Date Place Days
1/1/10 N-01 6
1/1/10 S-02 10
1/2/10 S-02 5
Trying to merge so I look-up the values for each possible combo
dbs.final
2010 Aug 03
4
REmove level with zero observations
If I have a column with 2 levels, but one level has no remaining
observations. Can I remove the level?
Had intended to do it as listed below, but soon realized that even though
there are no observations, the level is still there.
For instance
summary(dbs3.train.sans.influential.obs$HAC)
yields
0 ,1
4685,0
nlevels(dbs3.train.sans.influential.obs$HAC)
yields
[1] 2
drop.list <- NULL
2010 Jan 11
1
Limiting number of tickmarks in lattice bwplot
Have a simple bwplot with 24 ordered factors across the x axis. I would like
to only label every 4th tick mark so that the labels fit. I tried
scales=list(x=list(tick.number=6)), but I still seem to get 24 tickmarks and
24 labels. Full code is below:
bwplot(SumOfIn.Use ~ Hour | Period,
scales=list(x=list(tick.number=6)),horizontal=FALSE,las=2,main="Rooms
Running",sub="Timeframe:
2010 Nov 02
1
class changed after execution with sqldf
When I run sqldf to merge two datasets, it's changing the Date (class date)
to a numeric value (class factor). Not sure why. Appreciate any insight.
Console output for two datasets and the merged dataset (via sqldf) listed
below.
> summary(df.aggregate)
Date Hour x
Min. :2010-07-01 0 : 64 Min. : 0.00
1st Qu.:2010-07-25 1 :
2010 Feb 10
2
Subscripting
Dataframe1 contains a list of specific dates. Dataframe2 contains a large
dataset, one element of which is Date. How do I create a subset of
Dataframe2 that excludes the dates from Dataframe1? I know how to do it with
a left outer join vs null in SQL, but I can't figure out how to do it more
directly via the subcripts that already exist?
Dateframe1
Date
1/1/2010
1/18/2010
Dataframe2
Date
2010 Jan 22
2
Question on Merge/Lookup
I need to merge three datasets and don't know how. If I were using SQL, I
would use df3, look up the characteristics of each date in df1 and the value
for each observation in df2.
df1 - unique list of Dates and characteristics of those dates
Date, YYYYMM, YYYYWW, DOW
df2 - the raw data
Date, Place, Value
df3 - all posibile combinations of Date + Place (via
2010 Jun 13
4
Are any values in one list contained within a second list
Silly question, but, can I test to see if any value of list a is contained in
list b without doing a loop? A loop is easy enough, but wanted to see if
there was a cleaner way. By way of example:
List 1: a, b, c, d, e, f, g
List 2: z, y, x, w, v, u, b
Return true, since both lists contain b
List 1: a, b, c, d, e, f, g
List 2: z, y, x, w, v, u, t
Return false, since the lists have no mutual
2009 Dec 11
3
Correcting for missing data combinations
I can think of many brute-force ways to do this outside of R, but was
wondering if there was a simple/elegant solution within R instead.
I have a table that looks something like the following:
Factor1 Factor2 Value
A 11/11/2009 5
A 11/12/2009 4
B 11/11/2009 7
B 11/13/2009 8
>From that I need to generate all permutations of Factor1 and Factor2 and
force a 0 for any combination that doesn?t
2010 Sep 07
0
AHRQ - Creation of Comorbidity Variables
If there are any other users who use AHRQ's SAS code comoanaly2010 and
comformat2010 to create comorbidity variables, I thought you might be
interested in the following PRELIM code we wrote to mimic its functionality
in R. It seems to yield similar results, but may contain errors. Please feel
free to comment (kindly) or enhance. I'm sure there are better ways to skin
this cat, but we at