Displaying 20 results from an estimated 9000 matches similar to: "summary of categorical variables"
2007 Oct 11
2
reference for logistic regression
Dear list, first accept my apologies for asking a non-R question.
Can anyone point me to a good reference on logistic regression? web or
book references would be great. I am interested in the use and
interpretation of dummy variables and prediction models.
I checked the contributed section in the CRAN homepage but could not
find anything (Julian Faraway?s "practical Regression and ANOVA
2007 Oct 01
3
mean of subset of rows
Dear list,
this must be an easy one:
I have a data.frame of two columns, "ID" with four different levels (A
to D) and numerical "size", and each of the 4 different IDs is
repeated a
different number of times. I would like to get the mean size for each
ID as another data.frame. I have tried the following:
>ID= as.character(unique(data[,1])) # I use unique() because
2008 Mar 11
2
Design�s validate() output
Dear list
Is there anywhere I could find further information on how to interpret
the output for a logistic regression for validate() from Design
package?. I tried ?validate and google but I cannot find information
on what the rows and the columns represent.
Thanks
David
2007 Sep 12
2
k-means clustering
Dear list, first apologies for this is not strictly an R question but
a theoretical one.
I have read that use of k-means clustering assumes sphericity of data
distribution. Can anyone explain me what this means? My statistical
background is too poor. Is it another kind of distribution, like
gaussian or binomial? What does it happen if the distribution is not
spherical? Could you give me an
2008 Feb 08
2
correlation
Dear list
I would like to compare two measurements of disease severity (M1 and
M2), one of the is continuous (M1 ranging from 1 to 10) and the other
is ordinal (M2 takes Low, Medium, high and very high). Do you think is
ok to use cor() function to test whether the two agree, i.e correlate?
I am afraid that if I set M2 to 1,2,3 and 4, the function cor() will
take them as continuous and
2008 Jan 18
1
histogram with NAs
Dear list,
I have a categorical variable in a data.frame that I would like to
plot using a histogram to show number of events. Values are 0, 1 and
some NAs. I can?t make the hist() function to
1) include a column with the number of NAs
2) have the x axis to be categorical, I always get 0, 0.2, 0.4,... 1
divisions
Can anyone help me?
This is my code. "database" is my data.frame and
2008 May 16
4
reading and analyzing a text file
Dear list,
I have a text file from a scanner that includes 20 lines of text
(scanner settings) before it actually starts showing the readings in a
tabular format (headings are ID, intensity, background and few others).
I am a biologist with some experience using R and my question is if it
is possible to read this file into an R workspace and store the actual
readings in a dataframe,
2017 Nov 06
4
For each entry type in column?
It?s sometimes faster to ask from someone who has already learnt the syntax.
In this case one has to do e.g.
names(data$somecol)
To get the collection and then iteration through it is almost like in Python:
for(i in names(data$somecol)) {
# do something
}
> Bert Gunter <bgunter.4567 at gmail.com> kirjoitti 6.11.2017 kello 19.55:
>
> Time to go through a tutorial or two! --
2017 Nov 06
2
For each entry type in column?
Matti -
Since you are asking about looping through a column, not looping across columns, it is simply the following:
# Note: data.frame() turns strings into factors by default.
myDF <- data.frame(type = c("a", "j", "a", "a", "j"),
weight = c(12.3, 6.8, 10.5, NA, "5.5"))
myDF$type # ... is a vector of factors
2017 Nov 06
0
For each entry type in column?
Hello,
If you want to loop through the columns of a data.frame you can do
for(i in names(df)){
[code]
}
Another way would be
lapply(names(df), function(somecol) class(df[[somecol]]))
where class(df[[somecol]]) is just an example, you would use whatever
fits your needs.
When you say that the column in question holds "levels" do you mean it's
a factor? (factors are R's
2017 Nov 06
0
For each entry type in column?
Boris:
"As others have remarked, for added efficiency with large datasets we often
use functions from the apply() family, rather than for-loops."
That is generally false, though it is a common misconception. Apply-type
functions are used to maintain fidelity -- and for some, clarity -- to a
functional programming paradigm.
Cheers,
Bert
Bert Gunter
"The trouble with having an
2010 Aug 09
2
coef(summary) and plyr
Dear all,
I?m having trouble getting a list of regression variables back into a dataframe.
mydf <- data.frame(x1=rnorm(100), x2=rnorm(100), x3=rnorm(100))
mydf$fac<-factor(sample((0:2),replace=T,100))
mydf$y<- mydf$x1+0.01+mydf$x2*3-mydf$x3*19+rnorm(100)
dlply(mydf,.(fac),function(df) lm(y~x1+x2+x3,data=df))->dl
here I?d like to use
ldply(dl,coef(summary)) or something
2006 Jul 08
1
Summary Statistics for data.frame
I apologize for my constant questions but I am new to R and trying to
gain an appreciation for its capabilities. The following task is easy
in Excel and I was hoping somebody could give me a quick explanation
for how it can be acheived in R so I can avoid having to switch
between the two applications.
How do I find the Summary Statistics in one Vector of the dataframe by
levels in another of the
2013 Feb 20
2
duplicate 'row.names' are not allowed
I am getting an error when trying to import tab delimited .txt file saved
from Excel.
I have read what is posted on the forums but still am confused.
I saved my Excel file (DataTestforR.xlsx) as a tab delimited txt file
(DataTestR.txt) on my Desktop.
In the RGUI, I tried to import the txt file and got an error
> myfile<-"C:\\Users\\jpapa\\Desktop\\DataTestR.txt"
>
2007 Jul 31
1
aggregate.data.frame - prevent conversion to factors? show statistics for NA values of "by" variable?
I have a two question regarding the "aggregate.data.frame" method of the "aggregate" function.
My situation:
a. My "x" variable is a data.frame ("mydf") with two columns, both columns of type/format "numeric".
b. My "by" variable is a data.frame("mybys") with two columns, both columns of type/format "character".
c.
2007 Dec 30
1
plot multiple data sets on same axis
I'm new to R and struggling to reproduce graphs I've made with gnuplot.
Example here:
http://www.slamb.org/tmp/one-active.png
I have three different data sets plotted on the same axis. (I also have
a number of samples for each X value which I displayed with quartiles
rather than plotting every point; that will likely be the subject of my
next question.)
My attempts to do this in R:
2006 Sep 11
1
summary(glm) for categorical variables
Dear list people
Suppose we have a data.frame where variables are categorical and the response is
categorical eg:
my.df=NULL
for(i in LETTERS[1:3]){my.df[[i]]=sample(letters, size=10)}
my.df=data.frame(my.df)
my.df$class=factor(rep(c("pos", "neg"), times=5))
my.glm=glm(class ~ ., data=my.df, family=binomial)
summary(my.glm)
....
Estimate Std. Error z
2023 Nov 03
2
I need to create new variables based on two numeric variables and one dichotomize conditional category variables.
Just a minor point in the suggested solution:
df$LAP <- with(df, ifelse(G=='male', (WC-65)*TG, (WC-58)*TG))
since WC and TG are not conditional, would this be a slight improvement?
df$LAP <- with(df, TG*(WC - ifelse(G=='male', 65, 58)))
-----Original Message-----
From: R-help <r-help-bounces at r-project.org> On Behalf Of Jorgen Harmse via
R-help
Sent: Friday,
2002 Jan 28
4
Multivariate response trees
I would like to know if someone has done work on trees with
multivariate response. I need something like rpart but for vector
responses. If someone has code that he/she is willing to share, I
would be grateful. If not, even guidelines for writing my own starting
from rpart would be welcomed.
ft.
--
Fernando TUSELL e-mail:
Departamento de
2018 Feb 25
4
reshaping column items into rows per unique ID
Hi All
I have a datafram which looks like this :
CustomerID DietType
1 a
1 c
1 b
2 f
2 a
3 j
4 c
4 c
4 f
And I would like to reshape this so I can