Displaying 20 results from an estimated 400 matches similar to: "Converting a categorical variable to multiple dichotemous variables"
2011 Jan 17
2
matrix manipulations
Hi,
I am having some difficulties with matrix operations. It is a little hard to explain it so please bear with me. I have a very large data set, large enough that it needs to be split in parts in order to deal with. I can work things on these "parts" but the problem lies in adding together these parts for the final answer.
So that been said, let's say that i split the data in 2
2007 Dec 19
3
median of binned values
Dear list,
I have a vector (array, table row, whatever is best) of frequency values
for categories (or bins), and I need to find the median category.
Trivial to do by hand, but I was wondering if there is a means to do it
in R in an elegant way.
The obvious medioan(vector) returns the median frequency for the binns,
and that is not what I want. i.e,:
freq
cat1 1
cat2 10
2006 Aug 24
1
Using a 'for' loop : there should be a better way in R
I need to apply a yearly inflation factor to some
wages and supply some simple sums by work category. I
have gone at it with a brute force "for" loop approach
which seems okay as it is a small dataset. It looks
a bit inelegant and given all the warnings in the
Intro to R, etc, about using loops I wondered if
anyone could suggest something a bit simpler or more
efficent?
Example:
2006 Mar 25
2
acts_as_tree wierdness with children.count and children.size
i am making a category tree and i iterate over the category using my
counter_cache however it would show a different number than what was
actually being represetned in the tree.
Here is an example
cat.children = [cat2, cat3]
puts cat.children.size 2
puts cat.children_count 2
cat4.parent_id = cat.id
cat4.save
puts cat.children.size
2010 Apr 12
2
Interpreting factor*numeric interaction coefficients
Dear all,
I am a relative novice with R, so please forgive any terrible errors...
I am working with a GLM that describes a response variable as a function of
a categorical variable with three levels and a continuous variable. These
two predictor variables are believed to interact.
An example of such a model follows at the bottom of this message, but here
is a section of its summary table:
2005 Sep 24
1
Encrypt some services with ipsec
Hi all,
I have two prodction servers with FreeBSD 5.4 (all security patches
are applied). They running some services like dns, ssh, http, ftp, etc.
But I woukd like to encrypt some services for some hosts with ipsec when
it is accessed. For example:
- DNS resolution: not encrypted.
- DNS replication master-slave: encrypted by ipsec.
- Telnet: encrypted by ipsec for some hosts. Deny
2009 Aug 21
2
compare observed and fitted GAM values
Hi,
I am comparing the observed and fitted values of my GAM model, which includes the explanatory variables: longitude, depth, ssh, year and month. When I compare observed and fitted values for longitude, depth and ssh it works. But when I try to do it for month and year (which are as factors in the GAM model) it doesn't work. My observed and fitted values are exactly the same.. How is that
2010 Jun 09
2
cbind with vectors of different lengths?
Hello R help
I have a dataframe, with 71 samples (rows) and 30 variables. I got linear models for some of the variables,? and I want to join fitted and residuals of these models to the data frame. Sometimes, these vectors have the same length of the dependant variable, but in a few cases, NA values can be found on my data, and therefore, both fitted and residuals have a few rows less than the
2013 Jan 01
1
Order variables automatically
Hi,
I have a dataset with 6 categorical variables. I have used this following code to make the variables u1-u6 ordered factors and this works well.
cat1cat2 cat3 cat4 cat5 cat6
? 0 ? ?? 1 ? ? 1????? 0 ??? 0? ?? 1
? 1 ? ?? 1 ? ? 0 ? ?? 0 ? ? 0 ? ? 0
.......
....
############
data<-read,table("example.txt")
data <- as.data.frame(lapply(data, ordered))
############
Now,
2010 Sep 29
0
R Graphic - Tellis as a potential
Hello all,
I have been meaning to learn R for a while and have just subscribed to this
list. I am planning to give R a shot at one of my live projects. I am looking
to explore graphical features of R on my data below.
Sample Data:
Cat1 - Cat2 - Cat3 - Cat4 - NumPeople - Salary
H - L - H - L - 100 - 50000
L - L - L - L - 40 - 30000
- H - H - - 100 - 45000
Cat1 through Cat4 are
2010 Oct 23
1
Summarizing For Values with Multiple categories
Hi all,
I have some data as follows.
Cat1 Cat2 Cat3 COG Counts
A B C COG1 10
B D COG2 20
C COG3 30
D COG4 40
I would like to sum all the counts for each category:
A B C D
10 30 40 60
>CAT2COG<-
2012 Nov 27
1
For-loop,string variables, and the $-operator
Hi all,
First time poster, so sorry if I commit some breech of posting etiquette.
My problem is as follows. I have a data frame where each column represents
a category and the individual data points in each category are binary
responses (in this case they are actually 1's and 0's). What I want to
extract are the counts for each category and put them in a vector. To do
that I used the
2011 Apr 15
3
Monte Carlo Simulation
Hello, R friends...
I am very new to R, and I need some help. I am trying to construct a simulation for my dissertation.
I need to create 1000 datasets of 1000 subjects with the following variables...
Treatment variable - Drawn from a binomial distribution (1 run, prob=.13)
Covariate 1 - Drawn from a normal distribution (mean=100, sd=16)
Covariate 2 - Drawn from a normal distribution
2012 Feb 28
1
group calculations with other columns for the ride
Hello,
I can get the median for each factor, but I'd like another column to go
with each factor. The nm column is a long name for the lvls column. So
unique work except for the order can get messed up.
Example:
x =
2007 Jul 30
4
how to combine data of several csv-files
Hello,
I'm looking for a solution for the following problem:
1) I have a folder with several csv files; each contains a set of
measurement values
2) The measurements of each file belong to a position in a two
dimensional matrix (lets say "B02.csv" belongs to position 2,2
3) The size of the matrix is fix
4) I cannot assure to have a csv file for each position
5) Each position
2011 Apr 11
1
Help on calculating a variable using random numbers
I'm new to R, but I'm trying to write a program for a dissertation that generates a dataset as follows...
subject=1:1000
treat=rbinom(1*1000,1,.13)
gender=rbinom(1*1000,1,.5)
eth=runif(1*1000, min=1, max=4)
cogat=rnorm(1*1000, 100, 16)
map=rnorm(1*1000, 200, 9)
simtest=data.frame (subject=subject, treat=treat, gender=gender, eth=round(eth,digits=0),
2004 Feb 24
2
Samba Slow, and I have high Quality NICS
I have SLOW file transfers across samba to my Windows Server 2000 domain.
I am using a built in 100bT Intel Pro NIC, I have tried the built in gigabit
NIC and a PCI 3com, all with the same results.
Using iperf, I get about 45-90Mb of bandwidth from my PC's to my samba
server.
I can pull it up by \\servername <file:///\\servername> or \\ipaddress
<file:///\\ipaddress> with out
2009 Dec 02
1
Lattice: multiple data sets on same plot
Hi,
I have two data sets; one is a population and the other a sample of
that population. I am trying to plot both on the same trellis display.
# Example data set with two numerical attributes and two categorical
pop <- data.frame(var1=rnorm(2000, 2000, 500), var2=rnorm(2000, 2000, 500))
cat<-(runif(2000)<=.5)+0
for(i in 1:length(cat)){
if(cat[i] == 0){
pop[i,"cat1"] =
2010 Jul 14
1
Dot Plot with Confidence Limits
Hi,
I have the following dataset and I would like to create a dotplot with
confidence limits:
CAT1 CAT2 MEAN Lower
Upper
1 1 1 0.619 0.392
0.845
2 1 10 1.774 1.030
2.518
3 1
2010 Dec 07
10
Advice on data design idea
I''m about to embark on a project and am seeking advice on my approach.
I have an automotive site that needs to have shared categories. I''ve
checked out different nested set, ancestral, acts_as_tree, acyclic
plugins but feel they don''t exactly fit.
So I am about to roll my own simple solution. Any feedback as to
whether this looks good is appreciated.
Essentially I