Displaying 20 results from an estimated 10000 matches similar to: "Remove NAs from Barplot"
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
2006 May 15
1
Trying to get values to display on horizontal barchart
Hello,
R 2.3.0
Windows XP
I have spent quite a bit of time trying to resolve my problem below, which included a R site search.
The "vertical bars" syntax below produces a vertical bar chart with the values displayed above each bar. I want to cast this graphic horizontally, but I have not been able to arrive at a suitable outcome. The best I have been able to do, using the second block
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 Aug 06
1
Comparing rows in a dataframe
Hello
I have a longitudinal dataframe organized in the long format and would like to make comparison between successive rows if certain conditions apply. Specifically, I have four variables of interest: grade, score, year, and schid, associated with each school with 3 measurements per school per grade, therefore the rows are temporally ordered and each school occupies multiple rows. For example,
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
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',
2017 Jun 21
3
Counting with multiple criteria using data table
I have a data.table which is shown below. I want to count combinations of
columns on i and count on j with by. A few examples are given below the
table.
I want to:
all months to show on the output including those that they have zero value
I want the three statements combined in on if possible so the output will
be one data table; that is the outputs are next to each other as manually
2016 Apr 25
2
ylim in barplot()
Dear useRs,
I'm having troubles with using ylim in barplot(): even though I reduce
the y-scale using ylim, the bars still extend down to 0into the x-labels.
The sample data is below, and here is the code.
#This works fine but I would like to plot only from 50 to 70:
barplot(t(mydata), beside=TRUE, col=c("orange", "green", "yellow",
"purple"),
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
2016 Apr 25
0
ylim in barplot()
If you are using a Windows system, you can Export the plot from RStudio and save it as a metafile without using package devEMF and it will crop the bars with xpd=FALSE. When I used devEMF on a Windows machine, the bars were not cropped with barplot() as you indicated, but when I switched to plotrix::barp() they were cropped. The arguments are a bit different, but I did not need xpd=FALSE:
2016 Apr 26
1
ylim in barplot()
Thank you David,
That's a nice workaround using plotrix::barp(), but that doesn't explain
why ylim doesn't work as intended (or at least, as I expect it to work),
or why xpd has no influence when using devEMF::emf()...
The problem with saving directly in RStudio is that it requires to
manually save the plot, and this becomes troublesome when there are a
lot of plot commands in a
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).
2017 Jun 21
0
Counting with multiple criteria using data table
Have you gone through any R tutorials? If not, why not? If so, maybe
you need to spend some more time with them.
It looks like you want us to do your work for you. We don't do this.
See (and follow) the posting guide below for what we might do (we're
volunteers, so no guarantees).
Cheers,
Bert
Bert Gunter
"The trouble with having an open mind is that people keep coming along
and
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)
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
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
2009 Jul 09
9
Population pyramids
Hi, I hope somebody can help me with this issue: I am doing population pyramids using the barplot command, so in the left side I have male age structure and in the right side the female age structure. To plot the male age structure I put the data in negative numbers. Now, I want to change the sign in the bar plot in such way that I have no-sign numbers, both in left and right side of the graph. I
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",
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