Displaying 20 results from an estimated 700 matches similar to: "Return value associated with a factor"
2010 Nov 02
1
Using data( ) in a loop
I'm trying to generate 50+ graphs using the UScensus2000tract data. I
need to access the data for just about all of the states, so I was
hoping to create a simple loop that will take the relevant state from my
data and load the associated census data from the UScensus2000tract
package. Below is a sample of what I'm trying to do. Any suggestions
are much appreciated.
2012 Sep 14
1
USCensus2000 package
Does anyone know the appropriate R code to obtain census tracts (tract
and block level) from addresses by using Zack Almquist's USCensus2000
package?
Thank you,
--
Michael Leitson
Michael.Leitson at gmail.com
2010 Mar 14
2
code rows depending on the value of other rows in multilevel dataframe
I have a multilevel dataframe (df):
ID Date Segment Slice Tract Lesion
1 CSPP005 12/4/2007 1 1 LCST 0
2 CSPP005 12/4/2007 1 1 LPC 2
3 CSPP005 12/4/2007 1 1 RPC 3
4 CSPP005 12/4/2007 1 1 RCST 1
5 CSPP005 12/4/2007 1 1 LGM 0
6 CSPP005 12/4/2007 1 1
2018 Mar 19
1
Labelling a fortified GADM map plotted with ggplot and geom_map
I am having trouble getting data labels to display over the provinces in a GADM map of Canada.
Specifically, I need the variable "Number" from the data set "by_province", grouped by "region", to appear on the corresponding regions of the map.
The data set "by_province" looks like this:
long lat order hole piece region
2024 Dec 06
1
Sum by group
I have population data (?totpopE?) at the census tract level (?GEOID?),
which are nested within Precincts (?Precinct?). Please see below my data
structure.
I used the code to sum population data per precinct:
inters <- inters %>%
group_by(Precinct) %>%
mutate(TotalPop = sum(totpopE)
)
However, said code produced too large sums because each census tract
(?GEOID?) has multiple
2023 Oct 14
2
Create new data frame with conditional sums
Well, here's one way to do it:
(dat is your example data frame)
Cutoff <- seq(0, .15, .01)
Pop <- with(dat, sapply(Cutoff, \(p)sum(Totpop[Pct >= p])))
I think there must be a more efficient way to do it with cumsum(), though.
Cheers,
Bert
On Sat, Oct 14, 2023 at 12:53?AM Jason Stout, M.D. <jason.stout at duke.edu> wrote:
>
> This seems like it should be simple but I
2023 Oct 13
1
Create new data frame with conditional sums
This seems like it should be simple but I can't get it to work properly. I'm starting with a data frame like this:
Tract Pct Totpop
1 0.05 4000
2 0.03 3500
3 0.01 4500
4 0.12 4100
5 0.21 3900
6 0.04 4250
7 0.07 5100
8 0.09
2012 Aug 15
1
Obtaining census tract data from addresses
Hello,
I have a bunch of street addresses that I want to obtain the census
tract data for. Is there any way I can do this in R?
Thank you,
--
Michael Leitson
Michael.Leitson at gmail.com
2013 Jan 29
1
points rejected as lying outside the specified window
Hello,
I am using the following code to create ppp files from csv data and map shape files, but I am getting some errors which I have been unable to fix by searching them online:
library(spatstat)
library(maps)
library(maptools)
NYC2<-readShapePoly("nybb.shp") # this is a map of the NYC boroughs without waterways and no census tract divisions (but it does include lines separating
2004 Aug 06
1
Query r/e multiple decoder reset...
Hello! I should have asked this earlier, but... :)
We're returning to voice processing in our app now, in which we're trying
to achieve n-way full duplex voice in a 3d environment. Since Speex is a
single voice stream CODEC, we've been looking at having each client upload
its stream to the servers, which multiplex several spatially nearby active
channels back down to the
2023 Oct 14
1
Create new data frame with conditional sums
That's very helpful and instructive, thank you!
Jason Stout, MD, MHS
Box 102359-DUMC
Durham, NC 27710
FAX 919-681-7494
________________________________
From: John Fox <jfox at mcmaster.ca>
Sent: Saturday, October 14, 2023 10:13 AM
To: Jason Stout, M.D. <jason.stout at duke.edu>
Cc: r-help at r-project.org <r-help at r-project.org>
Subject: Re: [R] Create new data frame with
2023 Oct 15
2
Create new data frame with conditional sums
Under the hood, sapply() is also a loop (at the interpreted level). As
is lapply(), etc.
-- Bert
On Sun, Oct 15, 2023 at 2:34?AM Jason Stout, M.D. <jason.stout at duke.edu> wrote:
>
> That's very helpful and instructive, thank you!
>
> Jason Stout, MD, MHS
> Box 102359-DUMC
> Durham, NC 27710
> FAX 919-681-7494
> ________________________________
> From: John
2006 Mar 30
1
Random Coefficients using coxme
Hello, I was hoping someone could answer a question for me that may
either be statistical or script related. I don't come from a statistics
background, so I am not positive if I am using the correct nomenclature
or even the correct procedure. Is it possible to model "random
coefficients" in a mixed effects cox-regression using coxme from the
Kinship package? For example, using
2023 Oct 16
1
Create new data frame with conditional sums
Dear Jason,
The code could look something like:
dummyData = data.frame(Tract=seq(1, 10, by=1),
?? ?Pct = c(0.05,0.03,0.01,0.12,0.21,0.04,0.07,0.09,0.06,0.03),
?? ?Totpop = c(4000,3500,4500,4100,3900,4250,5100,4700,4950,4800))
# Define the cutoffs
# - allow for duplicate entries;
by = 0.03; # by = 0.01;
cutoffs <- seq(0, 0.20, by = by)
# Create a new column with cutoffs
dummyData$Cutoff
2023 Oct 16
1
Create new data frame with conditional sums
If one makes the reasonable assumption that Pct is much larger than
Cutoff, sorting Cutoff is the expensive part e.g O(nlog2(n) for
Quicksort (n = length Cutoff). I believe looping is O(n^2). Jeff's
approach using findInterval may be faster. Of course implementation
details matter.
-- Bert
On Mon, Oct 16, 2023 at 4:41?AM Leonard Mada <leo.mada at syonic.eu> wrote:
>
> Dear
2006 Mar 20
1
Platform independent dialogs & menus?
Dear list mates,
Are {utils} dialog box functions, and winMenuAdd... functions used to change
(e.g. Console) menus, platform dependent?
I'm writing a script loaded with .First that provides first time users in a
lab course with the ability to select, load, and change between what I
called a 'session' (more specific save that focuses on the session object I
defined rather than the
2006 Feb 09
1
converting lat-long coordinates to Albers Conical Equal Area coordinates
####################################################################################
We have used maptools to construct state, county, township, census-tract,
and zipcode
level R maps with an Albers Conical Equal Area projection. We would like
to be able to
plot the location of weather stations or other point locations on the
maps. The data
the point locations are in latitude-longitude units
2009 Dec 13
3
CRAN (and crantastic) updates this week
CRAN (and crantastic) updates this week
New packages
------------
* Bergm (1.0)
Alberto Caimo
http://crantastic.org/packages/Bergm
Functions implementing Bayesian estimation for exponential random
graph models via exchange algorithm
Updated packages
----------------
lmtest (0.9-26), logcondens (1.3.5), MTSKNN (0.0-4), pmml (1.2.21),
r2lUniv (0.9.4), rattle (2.5.11), rgdal (0.6-23),
2007 Nov 30
1
Help with tables
Hello, I'm new using R and developing tables.
I have a problem in developing a table. In a questionaire I made I ask this
question "Please tell me the first three sympthoms caused by Respiratory
tract infection you've caught this year", then the people answer three
sympthoms, the first mention (Top of mind) is saved in a variable called
"P2_A", the second mention in
2005 Jan 13
0
autocorrelation and levinson-durbin
> 3) a more general question:
> i have not been able to find any reason why
> 10 lpcs are used. i suppose 10 lpcs are
> enough for prediction and using more coeffs
> would not have made too much difference.
> and 10 is even, good for lpc->lsf. had read
> somewhere "historically", during the analog
> era, this number is used. or maybe 10 is analagous
> to