I'm trying to change the name of a variable that is included inside a for loop and function call. In the example below, I'd like column_1 to be passed to the plot function, then column_2 etc. I've tried using do.call, but it returns "object 'column_j' not found". But object column_j is there, and the plot function works if I hard-code...
I'm using the support vector machine from the e1071 package to classify my data and want to visualize how the machine actually does the classification. However, when using the plot.svm function, I get an error that I can't resolve.
Script:
library("e1071")
data <-read.table("2010223_11042_complete")
names(data) <- c("Class","V1", "V2"...
Can a function in R return not one, but two vectors?
(I am really beginning with R, so I might be overlooking something simple)
...
I'm trying to read a text file into R so I can use the sqldf functions. I'm following this example, https://stat.ethz.ch/pipermail/r-help/2008-January/152040.html, but I have a text file holding my data instead of the data being pasted as the example has it. My text file is below:
#"test.table.1.0" file has this contents:
id Source
...
I have some mixed-type data that I would like to store in an R data structure of some sort. Each data point has a set of fixed attributes which may be 1-d numeric, factors, or characters, and also a set of variable length data. For example:
id phrase num_tokens token_lengths
1 "hello world" 2 ...
I am trying to produce plots with a loop.
l1<-factor(rep(letters,4))
n1<-abs(rnorm(104))*10000
b1<-rep(c("1","2","3","4","5","6","7","8"),c(2,2,11,24,11,20,33,1))
k1<-rep((rep(c("A","B","C","D"),c(2,3,4,4))),8)
my.df<-data.frame(l1,b1,k1,n1) #make a dataframe
names(my.df)<-c("letter","branch","ltrtype","numbe...
I have a data.frame called series_to_plot.df which I created by combining a number of other data.frames together (shown below). I now want to pull out just the .mm column from each of these, so I can plot them. So I want to pull out the 3rd column of each data.frame (e.g. p3c3.mm, p3c4.mm etc...), but I can't see how to do this for al...
In ggplot I can add a series to a plot with:
ggplot(diamonds, aes(x = carat, y = price)) + geom_point()
How do I simply add another series, e.g. plotting the cost of rubies against diamonds. Assuming rubies was also in the diamonds dataset. I have tried to lay over the top another layer with the rubies data, but it just plots the ru...
I created an age-sex-pyramid using gplots. I would like to center a subtitle between the two sides of the pyramid.
However, I can only get the subtitle aligned with one of the two sides of the pyramid:
library(gplots)
agetable <- as.data.frame(cbind (c(2, 4, 7, 8, 10, 8, 6, 4, 2, 1),
c(1, 3, 5, 9, 11, ...
I've written an SQL query that tells me the names of the previous week's top 10 most frequent Alarms. And I've written a query that takes those top 10 alarms and provides a YTD weekly totals for each of those alarms.
Now I'm looking to create a panel of sparklines showing the YTD trend for each of the week's top 10 alarms.
I got somet...
I have a simple program that breaks a dataset (a CSV file) into 4 chunks, reads each chunk in, does some calculations, and then appends the output together. Think of it as a simple map-reduce operation. Processing a single chunk uses about 1GB of memory. I'm running the program on a quad core PC, with 4GB of ram, running Windows XP. ...
I'm writing an R script to get some database data and then do stuff with it, using the RODBC package. Currently all my sqlQuery commands are one long string;
stsample<-sqlQuery(odcon, paste"select * from bob.DESIGNSAMPLE T1, bob.DESIGNSUBJECTGROUP T2, bob.DESIGNEVENT T3, bob.CONFIGSAMPLETYPES T4 WHERE T1.SUBJECTGROUPID = T2.SUBJECTGROU...
Trying the ggplot2 examples in the online reference manual, and particularly in this page, I fail to produce all but the first of the second example's plots.
> d + stat_density2d(geom="tile", aes(fill = ..density..), contour = FALSE)
Error in `[<-.data.frame`(`*tmp*`, var, value = list(`NA` = NULL)) :
missing values are not allowed ...
Hello dear R people,
I have the following setup to analyse:
We have about 150 subjects, and for each subject we performed a pair of tests (under different conditions) 18 times.
The 18 different conditions of the test are complementary, in such a way so that if we where to average over the tests (for each subject), we would get no correl...
i've been banging my head against rpart for a few days now (trying to make classification trees for this dataset that I have), and I think it's time to ask a lifeline at this point :-) I'm sure it's something silly that I'm not seeing, but here's what I've been doing:
EuropeWater <- read.csv(file=paste("/Users/artessaniccola/Documents/...
I have run two multilevel logistic regressions using the same predictors but on two different responses:
fruitMLM <- lmer(InsuffFruit ~ Income + HDI + Income:HDI + (1 + Income | Country),family=binomial(link="logit"))
fuelMLM <- lmer(Pollution ~ Income + HDI + Income:HDI + (1 + Income | Country),family=binomial(link="logit"))
Income...
I have a plot (sample code pasted below) that I am trying to add by own labels for the series information. Instead of plotting "p1s1" "p1s2" "p3s4", I would like "treatment 1" "treatment 2" "treatment 3". I have used levels(series_id) to get the unique series names and used a lookup table to get the descriptions. (I think this gets th...
Each time when I have to recode some set of variables, I have SPSS recode function in mind. I must admit that it's quite straightforward. There's a similar recode function in car package, and it does the trick, but let's presuppose that I want to get things done with factor.
I have data.frame with several variables with value range from...
I have several questions:
1. What's the difference between isoMDS and cmdscale?
2. May I use asymmetric matrix?
3. Is there any way to determine optimal number of dimensions (in result)?
...
Hi Everyone,
I've been trying to get RApache set up properly on my Macbook Pro running OS X 10.5.8. After installing RApache successfully (I think), I added the following to the httpd.conf file as suggested in the manual.
LoadModule R_module /apache/module/path/mod_R.so
ROutputErrors
<Location /RApacheInfo>
SetHandler r-info
<...