similar to: Comparing rows in a dataframe

Displaying 20 results from an estimated 10000 matches similar to: "Comparing rows in a dataframe"

2004 Aug 06
1
reshape (was: Comparing rows in a dataframe)
Hi all: I solved the previous stated problem in something of a brute force way (but it works). I seem to now be running into one little hiccup using reshape. Here is a quick snip of the data in long format: grade stability year schid 6 Grade 4 3 2001 100005 7 Grade 4 3 2002 100005 8 Grade 4 2 2003 100005 10 Grade 5 2 2001 100005 11 Grade 5
2004 Aug 03
2
attach data from tapply to dataframe
I am working with a longitudinal data set in the long format. This data set has three observations per grade level per year. Here are the first 10 rows of the data frame: >tenn.dat[1:10,] year schid type grade gain se new cohort 6 2001 100005 5 4 33.1 3.5 4 3 7 2002 100005 5 4 33.9 3.9 4 2 8 2003 100005 5 4 32.3 4.2 4 1 10 2001 100005
2004 Nov 17
1
"Impossible to run" error message when using Sweave
Dear List: I have a large dataset of multiple schools. My goal is to produce a separate tex file for each school that plots some of the student achievement scores. Essentially, the aim is to develop a custom report for each school. To accomplish this, I have code for a loop that gets sourced into R and then Sweaves the multiple files to create the individual school reports. Here is the code for
2005 Aug 24
2
Remove NAs from Barplot
Dear List: I'm creating a series of barplots using Sweave that must assume a standard format. This is student achievement data and the x-axis must include all grades 3 to 8. In some cases, the data for a grade (or more than one grade) are missing in the vector math.bar, but are never missing for the vector apmxpmeet. The following sample code illustrates the issue. Using the code below to
2005 Dec 01
1
Simulate Correlated data from complex sample
Dear List: I have created some code to simulate data from a complex sample where 5000 students are nested in 50 schools. My code returns a dataframe with a variable representing student achievement at a single time point. My actual code for creating this is below. What I would like to do is generate a second column of data that is correlated with the first at .8 and has the same means within
2004 Nov 28
1
Modifications to an abline
Dear List: I am working to generate graphs for individual students that will be created through a series of loops in Sweave. Before doing so, I am still trying to design the graph. The code for creating the barplot is below with some sample datapoints just made up for now. Ultimately, this chart will take data from an lme object using longitudinal student data. So, the dots represent the
2004 Nov 28
1
paste command
In a previous post, I mentioned a loop being used to generate graphs. I have some sample code partially put together but have found one offending line of code that I cannot figure out what to do with. I have one data frame called grade4. If I do something like hist(grade4$math) I get the appropriate chart. Within the loop, however, I am doing this for multiple files and grades, so I use
2006 Aug 16
6
read.csv issue
I'm trying to read in some data from a .csv format and have come across the following issue. Here is a simple example for replication # A sample .csv format schid,sch_name 331-802-7081,School One 464-551-7357,School Two 388-517-7627,School Three \& Four 388-517-4394,School Five Note the third line includes the \ character. However, when I read the data in I get >
2009 Oct 21
1
formula and model.frame
Suppose I have the following function myFun <- function(formula, data){ f <- formula(formula) dat <- model.frame(f, data) dat } Applying it with this sample data yields a new dataframe: qqq <- data.frame(grade = c(3, NA, 3,4,5,5,4,3), score = rnorm(8), idVar = c(1:8)) dat <- myFun(score ~ grade, qqq) However, what I would like is for the resulting dataframe (dat) to include
2009 Apr 11
1
Error in R CMD check 2.8.1
Env: R 2.8.1, Win Xp, Eclipse/StatET In a .Rd file, I have an example containing the lines: # calculate Y M, using polynomial contrasts trends <- as.matrix(VocabGrowth) %*% poly(8:11, degree=3) colnames(trends)<- c("Linear", "Quad", "Cubic") [At the risk of a long message, I'll append the complete .Rd file at the end of this message, in case this was
2010 Feb 28
3
Change the scale on a barplot's y axis
I have grades data. I read them from a csv in letter-grade format. I then converted them to levels levels(grades$grade)=c('A+','A','A-','B+','B','B-','C+','C','C-','D+','D','D-') And then to numbers grades$gp=grades$grade levels(grades$gp)=c(4.3,4.0,3.7, 3.3,3.0,2.7, 2.3,2.0,1.7, 1.3,1.0,0.7)
2006 Apr 14
2
spot the error (I can''t, I''m new)
I have a form that I want to use to update multiple objects. In the controller, @grades = Grade.find(params[:grade].keys) @grades.each_with_index do |grade, i| grade.update_attribute(params[:grade][i]) end all_valid = @grades.inject(true) {|memo, c| c.valid? && memo } this doesn''t update the attributes as I would expect. (I would just use
2004 Aug 01
3
Creating dummy codes
Is there an efficient way to create a series of dummy codes from a single variable? For example, I have a variable, “grade” = {2, …, 12}. I want to create k-1 dummy codes for grade such that grade 2 is the base (i.e, grade 2 =0). I am hoping that the new variables can be labeled as grade.3, grade.4 etc. I'll then use grade <- paste("grade.", 3:12, sep="") in
2007 Sep 19
2
By() with method = spearman
I have a data set where I want the correlations between 2 variables conditional on a students grade level. This code works just fine. by(tmp[,c('mtsc07', 'DCBASmathscoreSPRING')], tmp$Grade, cor, use='complete', method='pearson') However, this generates an error by(tmp[,c('mtsc07', 'DCBASmathscoreSPRING')], tmp$Grade, cor, use='complete',
2005 Aug 29
1
ylim for graphic
Dear list: I have some data for which I am generating a series of barplots for percentages. One issue that I am dealing with is that I am trying to get the legend to print in a fixed location for each chart generated by the data. Because these charts are being created in a loop, with different data, my code searches the data to identify the maximum value in the data and then print the data values
2004 Dec 29
3
gls model and matrix operations
Dear List: I am estimating a gls model and am having to make some rather unconventional modifications to handle a particular problem I have identified. My aim is to fit a GLS with an AR1 structure, obtain the variance-covariance matrix (V), modify it as needed given my research problem, and then reestimate the GLS by brute force using matrix operations. All seems to be working almost perfectly,
2010 Oct 29
2
wilcox.test; data type conversion?
I'm working on a quick tutorial for my students, and was planning on using Mann-Whitney U as one of the tests. I have the following (fake) data grade <- c("MVG", "VG", "VG", "G", "MVG", "G", "VG", "G", "VG") sex <- c( "male", "male", "female", "male",
2010 Jun 28
2
Lattice and Beamer
Two things I think are some of the best developments in statistics and production are the lattice package and the beamer class for presentation in Latex. One thing I have not become very good at is properly sizing my visuals to look good in a presentation. For instance, I have the following code that creates a nice plot (sorry, cannot provide reproducible data).
2013 Jun 03
1
Multiple selection and normalization
Hi-- I am trying to normalize course grades for each instance of a course, e.g. Stats 1 Fall2009 J. Smith. I have a frame for all instances of a course, e.g. stats 1 in the last 5 years, that looks like SIDN TERM GRADE INST where SIDN is a Student ID Number, TERM is a factor that gives the quarter and year a course was offered, GRADE is a 0-4.3 grade and INST is the instructor, again as a
2011 Aug 16
1
Repeated measures cummulative logit mixed model
Dear R help gurus, I have the following problem and I would be delighted if you could help me. >From a large (1500) cohort of patients we have been taking some measurements (ECG measurements, but its not important). The measurements are ordinal in 4 grades (Grade I-IV, grade IV being the most severe form). Every patients has been measured several times (usually once per year). The