Displaying 3 results from an estimated 3 matches for "realdata".
Did you mean:
readdata
2005 Aug 09
2
How to pre-filter large amounts of data effectively
Hi,
I'm a R newbie and want to accelerate the following pre-filtering
step of a data set with more than 115,000 rows :
#-----------------
# Function to filter out constant data columns
filter.const<-function(X, vectors=c('column', 'row'), tol=0){
realdata=c()
filteredX<-matrix()
if( vectors[1] == 'row' ){
for( row in (1:nrow(X)) ){
if( length(which(X[row,]!=median(X[row,])))>tol ){
realdata[length(realdata)+1]=row
}
}
filteredX=X[realdata,]
} else if( vectors[1] == 'column' ){...
2009 Mar 18
1
Why S4 methods of S3 'base' generics are not used in 'base' functions ?
...4 methods defined for an S3 'base' generic
are not used in 'base' functions.
This can be problematic when 'base' functions start with
something like 'as.matrix'.
### START R code
setClass("classA", contains = "matrix",
representation(realData = "numeric"))
setMethod("as.matrix", "classA", function(x) callGeneric(x at realData))
x <- new("classA", diag(1:4), realData = 1:4)
as.matrix(x)
## # as intended
## [,1]
## [1,] 1
## [2,] 2
## [3,] 3
## [4,] 4
# but as.matrix in '...
2009 Mar 03
2
preparing data for barplot()
What is the best way to produce a barplot from my data? I would like
the barplot to show each person with the values stacked
val1+val2+val3, so there is one bar for each person When I use
barplot(data.matrix(realdata)), it shows one bar for each value
instead.
To post here, I created an artificical data set, but it works fine.
fakedata <- as.data.frame(list(LETTERS[1:3]))
colnames(fakedata) <- 'people'
fakedata['val1'] = abs(rnorm(3))
fakedata['val2'] = abs(rnorm(3))
fakedata[...