Hello. I have a data.frame in R; it's called p. Each element in the data.frame is either True or False. My variable p has, say, m rows and n columns. For every row there is strictly only one TRUE element.
It also has column names, which are strings. What I would like to do is the following:
For every row in p I see a TRUE I would like...
This is a follow-on from this question, in which I was trying to suppress the vertical gridlines.
The solution, as provided by learnr, was to add scale_x_continuous(breaks = NA), but this had the side effect of also suppressing the x-axis labels, as well. I am totally happy to write the labels back in by hand, but it's not clear to me ...
Hello. I recently posted this to reddit and it was suggested I come here, so here I am.
I'm a student working on an epidemiology model in R, using maximum likelihood methods.
I created my negative log likelihood function. It's sort of gross looking, but here it is:
NLLdiff = function(v1, CV1, v2, CV2, st1 = (czI01 - czV01), st2 = (czI...
Not sure what I'm doing wrong here. I have this plot:
ggplot(data.PE5, aes(ybands,fill=factor(decide))) + geom_bar(position="dodge")
which produces:
Then I want to facet by a factor, creating two stacked plots w/ dodged, colored bars
ggplot(data.PE5, aes(ybands,fill=factor(decide))) + geom_bar(position="dodge") +
facet_grid(~gr...
I have a dataframe that I am putting into a sweave document using xtable, however one of my column names is quite long, and I would like to break it over two lines to save space
calqc_table<-structure(list(RUNID = c(1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
1L, 1L), ANALYTEINDEX = c(1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
1L, 1L), ID = structur...
I have attempted to email the author of this package without success,
just wondering if anybody else has experienced this.
I am having an using rpart on 4000 rows of data with 13 attributes.
I can run the same test on 300 rows of the same data with no issue.
When I run on 4000 rows, Rgui.exe runs consistently at 50% cpu and the
UI hangs...
I have a big Sweave file with a variable called "specialty" near the top. The rest of this file is Latex and R, and uses this variable.
How can I loop over various values for "specialty"?
Two possibilities are:
Make the file be one big loop (and convert the Latex parts to R).
Write a script that copies the Sweave file, replace the va...
I need to colour datapoints that are outside of the the confidence bands on the plot below differently from those within the bands. Should I add a separate column to my dataset to record whether the data points are within the confidence bands? Can you provide an example please?
Example dataset:
## Dataset from http://www.apsnet.org...
I have two small data frames, this_tx and last_tx. They are, in every way that I can tell, completely identical. this_tx == last_tx results in a frame of identical dimensions, all TRUE. this_tx %in% last_tx, two TRUEs. Inspected visually, clearly identical. But when I call
identical(this_tx, last_tx)
I get a FALSE. Hilariously, e...
Hi,
is there a way to pass commands (from a shell) to an all ready running R-runtime/R-Gui, without copy&past. So far I only know how to call R via shell with the -f or -e option, but in both cases a new R-Runtime will process the R-Script or R-Command I passed to it. I rather would like to have an open R-Runtime waiting for commands pa...
Hi guys,
I'm posting this question to ask for advice on how to optimize the use of multiple processors from R on a Windows XP machine.
At the moment I'm creating 4 scripts (each script with e.g. for (i in 1:100) and (i in 101:200), etc) which I run in 4 different R sessions at the same time. This seems to use all the available cpu.
I ...
Due to the new R 2.11 release, I want to implement Dirk's suggestion here.
So for that I am asking - How can I (permanently) change R's library path? (The best solution would be one that can be run from within R)
...
My program takes a data.frame and crunches the numbers. At one point, values from j-th column are multiplied by a predefined values that depends on the column name (species name, actually - it's en ecological index). So far, I've been providing these values via a second data.frame by matching column names. What would be an efficient way ...
I am sorry for the non-informative title.
> y=read.csv(textConnection(scan("",sep="\n",what="raw")))
"","org","art","type","length"
"191","gk","Finish","short",4
"147","ik","Attending","short",7
"175","gl","Finish","long",11
"192","il","Attending","long",95
"144","gm","Finish","between",5
"161","im","Attending","between",15
"164","tu",...
Hello,
In ESS when I am evaluating chunks of code in a .R file using C-c C-j or C-c C-r (to send the line or region to a running R process), how can I get the R buffer to scroll down automatically, such that after evaluating a region the cursor is at the bottom, at the prompt?
Thanks.
...
I am trying to calculate the necessary sample size for a 2x2 factorial design. I have two questions.
1) I am using the package pwr and the one way anova function to calculate the necessary sample size using the following code
pwr.anova.test(k = , n = , f = , sig.level = , power = )
However, I would like to look at two way anova, si...
Having installed canvas from here http://www.rforge.net/canvas/files/
I try to plot:
> canvas('test.js')
> qplot(rnorm(100), geom='histogram')
stat_bin: binwidth defaulted to range/30. Use 'binwidth = x' to adjust this.
Error in grid.Call.graphics("L_setviewport", pvp, TRUE) :
Non-finite location and/or size for viewport
>
...
Many data analysts that I respect use version control.
For example:
http://github.com/hadley/
See comments on http://permut.wordpress.com/2010/04/21/revision-control-statistics-bleg/
However, I'm evaluating whether adopting a version control system such as git would be worthwhile.
A brief overview:
I'm a social scientist who uses R...
Hello,
Say I have a function handed to me that I cannot change and must use as is. This function takes several objects in the form of
oldFunction( object1, object2, object3, ...)
where ... are other arguments. I want to write a wrapper to take a list of objects. My idea was this.
sjb.ListWrapper <- function(myList,...) {
lLen <- l...
In R, I'm looking for a memory-efficient way to create a summary of tabular data as follows.
Take for example the data.frame foo which I've used table() to summarize, followed by as.data.frame() to obtain the frequency counts.
foo <- data.frame(x= c('a', 'a', 'a', 'b', 'b', 'b'), y=c('ab', 'ac', 'ad', 'ae', 'fx', 'fy'))
bar <- as.data....