Displaying 20 results from an estimated 4000 matches similar to: "(no subject)"
2009 Aug 31
3
Two way joining vs heatmap
Hi
STATISTICA has a function called "Two-way joining" (see
http://www.statsoft.com/TEXTBOOK/stcluan.html#twotwo) and the
reference material states that this is based on the method as
published by Hartigan (found this paper:
http://www.jstor.org/pss/2284710 through wikipedia).
What is the relationship (if any) between the "heatmap" function in R
and this technique? Is there an
2009 Sep 14
3
Question about Factors
Hi all,
I am new to R and I have got a question in regards to factors.
Say I have a simple dataset like the following:
Name Time Value
a 1:00 1.25
a 2:00 1.26
b 1:00 1.29
b 2:00 1.28
c 1:00 1.21
c 1:30 1.20
c 2:00 1.23
I want to write a script that automatically plot value against time for a, b
and c.
2010 Aug 04
4
Adding collumn to existing data frame
Hi experts,
I am trying to write a very flexible method that allows me to add a
new column to an existing data frame. This is what I have so far:
add.column <- function(df, new.col, name) {
n.row <- dim(df)[1]
length(new.col) <- n.row
names(new.col) <- name
return(cbind(df, new.col))
}
df <- NULL
df <- data.frame(a=c(1,2,3))
df
# corect: added NA to new collumn
df <-
2009 Sep 27
2
Count number of zeros in a collumn
I have a matrix 700x2000 which is sampled in each cycle from another matrix
788x2000 with the numbers 0,1 and 9
There is one specific collumn of this matrix, dart[,1977], that usually,
after the samplimg procedure has only 1 and 9 (because the zero frequency in
this collumn is low).
However, when this happens, I want to include an IF conditional in my code.
so basically what i wanted to do was to
2009 Sep 09
1
Combining simulated data
R helpers
Please help me combine the simulated data to a form of table where: Hypermarket have 10 rows, supermarket have 15 rows,......., spazashops with 35 rows.
Hypermarket <- rnorm(10, mean=20000, sd=7000)
Supermarket <- rnorm(15, mean=12000, sd=4000)
Minimarket <- rnorm(20, mean=10000, sd=4000)
Cornershop <- rnorm(20, mean= 8000, sd=3000)
Spazashop <- rnorm(35, mean=
2009 Sep 15
1
comma as decimal separator in xtable
Hello,
How can I make xtable print a comma as decimal separator? Setting
the option OutDec isn't enough for xtable:
library(xtable)
options(OutDec = ",")
x <- c(1.1, 1.2, 1.3)
y <- c(2.3, 2.2, 2.1)
d <- data.frame(x, y)
d
print(xtable(d))
Thanks!
Jakson Aquino
2009 Sep 16
1
list of symbols to substitution
Hi,
I'm trying to use a list of symbols as one of the values to be
substituted in a substitute expression, but I can't figure out how to
write the correct expression for my problem. Let me illustrate a
simple example of what I'm trying to do. The following code snippet
will evaluate to '5':
symname <- 'foo'
foo <- 5
expr <- substitute(c(expr), list(expr =
2009 Sep 17
1
How to extract data.frame columns using regex?
Hi,
data.frame(x1=1:11,x2=2:12,x3=3:13,y=4:14)
I want to extract all the columns that with the name 'x?'. Is there a
general way to do this in R?
Regards,
Peng
2009 Sep 19
1
random selection from dataset and creating and graphing multiple means
I was wondering if anyone could help me with a problem. I need to randomly
select, say 500 subjects from the 5000 cases I have and then need to run a
test to create 500 sample means and graph the means in a histogram. Does
anyone know how to do this. I'm not that familiar with R so please be
patient with me.
Thanks a lot!
Mike Hollingsworth
--
View this message in context:
2009 Sep 19
1
plotting least-squares residuals against x-axis
Hi,
I want to plot the residuals of a least-squares regression.
plot(lm(y~x), which=1)
does this, but it plots the y-axis of my data on the x-axis of the
residuals plot. That is, it plots the residual for each y-value in the
data. Can I instead use the x-axis of my data as the x-axis of the
residuals plot, showing the residual for a given x?
Thanks!
Jason Priem
University of North
2009 Sep 23
1
set choose.files directory?
Hi,
I've been trying to set the directory for choose.files as follows:
[R2.9.0 running on XP]
setwd("C:/Documents and Settings/2/Data")
getwd()
infile2 = choose.files(filters = Filters[c("txt","All"),], caption =
"Choose ECD datafile")
#<...do a bunch of stuff...>
It appears the working directory isn't updated until after choose.files()
2009 Oct 12
1
field index given name.
Hi,
How do I access the index number of a field given I only know the field
name?
eg - I want to set the probability of the field 'species' higher than the
other fields to use in sampling.
> colprob <- array(dim=NCOL(iris))
> for(i in 1:NCOL(iris)){colprob[i]=0.5}
> colprob[iris$species] = 1 #this doesn't work
> colprob
[1] 0.5 0.5 0.5 0.5 0.5
--
View this
2009 Sep 09
2
vector of Vectors
I just learned that vectors can't contain vectors, which frankly simply confuses me (can you imagine arrays or lists in any other language not being able to contain arrays or lists?). At any rate, I need to create a data structure (size to be determined at runtime) which I will instantiate and then fill with vectors using a for loop. Clearly I'm new to the R game. Data Frame doesnt seem to
2009 Sep 17
1
heatmap.2() problems with re-ordering of rows and columns
I have a file of the following form
-11 -10 -9 -8
-10 -9 -8 NA
-9 -7 NA NA
-8 NA NA NA
So basically a NxN matrix of log scores. I want to get a heatmap of these
log scores but I'm having a problem.
I'm using the following code
library(gplots)
data=read.table("filein.txt",header=FALSE)
mat=as.matrix(data)
heatmap.2(mat,dendrogram=c("none"))
But on the
2009 Nov 16
2
test for causality
Hi useRs..
I cant figure out how to test for causality using causality() in vars
package
I have two datasets (A, B) and i want to test if A (Granger)cause B.
How do I write the script? I dont understand ?causality. How do I get x to
"contain" A and B. Further using the command VAR() to specify x, I dont
either understand.
Kind regards Tobias
--
View this message in context:
2008 Sep 29
3
replicating dataframe rows
Dear all,
I have a data.frame like the sample below, and I would
like to expand my data.frame using "population" variable.
So, for each line of my data.frame I would like that
the new data.frame have many rows as the population collumn.
place<-c("place1", "place2", "place3", "place4", "place5")
population<-c(100,200,300,50,30)
2009 Sep 21
1
Specific criteria for color palette using heatmap.2
I'm trying to display the probability space of a function and wanted to see
specifically where the maximum posterior probability is.
data=read.table("PosteriorData",header=F)
mat=as.matrix(data)
heatmap.2(mat/max(mat,na.rm=T),dendrogram=c("none"),trace=c("none"),
Rowv=F,Colv=F,labRow=3*c(10:-10),labCol=3*c(-10:10),symm=T,col=rainbow(100))
As the
2009 Sep 21
1
Three dimensional view of the profiles using 'rgl' package (example of 3 dimensional graphics using rgl package).
Hi there,
Anyone has an idea how to put those two sets of code together so that I can get a 3-dimensional picture that includes points instead of 2 separate pictures which doesnt make that much sense at the end.
#Let's say that these are the data we would like to plot:
A<-c(62,84,53)
B<-c(64,82,55)
C<-c(56,74,41)
D<-c(46,68,38)
E<-c(71,98,72)
data<-rbind(A,B,C,D,E)
2009 Sep 17
3
Help with date specification
Hi everyone,I have a data daily data (x) for 10 years starting from
04-01-1995 to 03-31-2005.
I was able to get the yearly sum for the ten years using
aggregate(x, years, sum).
But this gave me the yearly sum for 1995 (Apr- Dec); 1996 (Jan-Dec)
---------2005 (Jan-Mar).
But I want to get the aggregates for Apr-1995 to Mar 1996, Apr 1996- mar
1997 and so on.
your help will be higly appreciated.
2009 Sep 17
2
referring to a row number and to a row condition, and to columns simultaneously
Hello, dear R-ers!
I have a data frame:
x<-data.frame(a=c(4,2,4,1,3,4),b=c(1,3,4,1,5,0),c=c(NA,2,5,3,4,NA),d=rep(NA,6),e=rep(NA,6))
x
When x$a==1, I would like to replace NAs in columns d and e with 8 and
9, respectively
When x$a != 1, I would like to replace NAs in columns d and e 101 and
1022, respectively.
However, I only want to do it for rows 2:5 - while ignoring what's
happening in