Displaying 20 results from an estimated 400 matches similar to: "preparing data for barplot()"
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(
2009 Mar 18
1
Why S4 methods of S3 'base' generics are not used in 'base' functions ?
Dear list,
It seems that S4 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",
2011 Mar 10
1
How to use conditional statement
Dear R helpers
Suppose
val1 = c(10, 20, 35, 80, 12)
val2 = c(3, 8, 11, 7)
I want to select either val1 or val2 depending on value of third quantity val3.
val3 assumes either of the values "Monthly" or "Yearly".
If val3 = "Monthly", then val = val1 and if val3 = "Yearly", then val = val2.
I tried the ifelse statement as
ifelse(val3 =
2009 Feb 17
4
joining "one-to-many"
Hello list,
I am wondering if a joining "one-to-many" can be done a little bit easier. I tried merge function but I was not able to do it, so I end up using for and if.
Suppose you have a table with locations, each location repeated several times, and some attributes at that location. The second table has the same locations, but only once with a different set of attributes. I would
2005 Oct 11
1
a problem in random forest
Hi, there:
I spent some time on this but I think I really cannot figure it out, maybe I
missed something here:
my data looks like this:
> dim(trn3)
[1] 7361 209
> dim(val3)
[1] 7427 209
> mg.rf2<-randomForest(x=trn3[,1:208], y=trn3[,209], data=trn3, xtest=val3[,
1:208], ytest=val3[,209], importance=T)
my test data has 7427 observations but after prediction,
> dim(mg.rf2$votes)
2012 Oct 18
1
mean value calculation
Dear all,
I want to calculate mean values for multiple rows:
structure(list(Name = structure(c(1L, 1L, 1L, 1L, 1L, 2L, 2L,
2L, 2L), .Label = c("AKT", "CKT"), class = "factor"), val1 = c(2,
3, 2, 2, 2, 5, 3, 8, 2), val2. = c(4, 5, 4, 8, 4, 8, 4, 7, 4),
val3 = c(5, 6, 5, 9, 5, 9, 5, 9, 5)), .Names = c("Name",
"val1", "val2.",
2018 Mar 21
0
how to add a child to a child in XML
Hi,
XML doesn't use the `$` to access child nodes. Instead use either `[name]` to get a list of children of that name or `[[name]]` to get the just the first child of that name encountered in the genealogy. Thus for your example...
> root$child1
NULL
> root[['child1']]
<child1 name1="A" name2="B" name3="C"/>
On the other hand, you might
2018 Mar 22
2
how to add a child to a child in XML
Big thanks. newXMLNode works great. Wonder why it is not included in the documentation.
There is newXMLDoc and newXMLNamespace, but no mention of newXMLNode.
Stephen
From: Ben Tupper [mailto:btupper at bigelow.org]
Sent: Wednesday, March 21, 2018 6:18 PM
To: Bond, Stephen
Cc: r-help
Subject: Re: [R] how to add a child to a child in XML
Hi,
XML doesn't use the `$` to access child nodes.
2012 Apr 26
6
print table on plot
Hello,
I would like to be able to plot an array on a plot, something like:
|arg1 | arg2 | arg3
val1| 0.9 | 1.1 | 2.4
val2| 0.33 | 0.23 | -1.4
val3| hello| stop | test
I know Rwave is good to report but don't want to use it.
? Is there a package that allow quick and dirty plot of dataframes like this
?
Thanks a lot
--
View this message in context:
2012 Jun 19
1
Possible bug when using encomptest
Hello R-Help,
-----------------------------------------------------------------------------------------------------------------------------------------
Issues (there are 2):
1) Possible bug when using lmtest::encomptest() with a linear model
created using nlme::lmList()
2) Possible modification to lmtest::encomptest() to fix confusing fail
when models provided are, in fact, nested.
I have
2018 Mar 22
0
how to add a child to a child in XML
Hi,
It's a reasonable question. The answer is that it actually is included, but there are many instances across packages where multiple functions are documented on a single help page. The following brings up such a page... (for XML_3.98-1.9)
> library(XML)
> ?newXMLNode
You can see the same on line...
https://www.rdocumentation.org/packages/XML/versions/3.98-1.9/topics/newXMLDoc
2018 Mar 21
2
how to add a child to a child in XML
I am trying to add a child to a child using XML package in R. the following fails
library(XML)
node1 <- c("val1","val2","val3")
names(node1) <- c("att1","att2","att3")
root <- xmlNode("root", attrs=node1)
node2 <- LETTERS[1:3]
names(node2) <- paste("name",1:3,sep="")
root <-
2018 Mar 22
1
how to add a child to a child in XML
Just to clarify and hopefully catch the attention of the maintainer:
The newXMLNode function is not mentioned in:
https://cran.r-project.org/web/packages/XML/XML.pdf
which supposedly describes all functions in the package.
Stephen
From: Ben Tupper [mailto:btupper at bigelow.org]
Sent: Thursday, March 22, 2018 10:40 AM
To: Bond, Stephen
Cc: r-help
Subject: Re: [R] how to add a child to a
2010 Dec 07
1
please show me simple example how to plot "Distance-Weighted Least Squares" fitting
I got simple x,y pairs of data and simple scatterplot and just cannot figure
how to do it , there are many examples but always there is error popping out
please show me an example stripped with additional data just core of what I
need to do to get this damn line
--
View this message in context:
2011 Dec 23
1
Help transforming a dist
I'd like to convert a dist into a table/matrix/thingy of the form:
A B value
A C value
B C value
(assuming the dist was over 3 names).
Is there a way to do this without using a for loop?
--
Taral <taralx at gmail.com>
"Please let me know if there's any further trouble I can give you."
? ? -- Unknown
2012 Dec 07
2
Converting character to numeric: Error: (list) object cannot be coerced to type 'double'
Dear R users,
I am facing a pretty a unusual problem while converting character to
numeric. Any input would be appreciated.
Below is the code and error faced:
---------------------------------------
*> str(cmie.dts)*
*'data.frame': 4397 obs. of 1 variable:*
* $ INE001A01036: chr "1482181740.000000" "1482181740.000000"
"1482181740.000000"
2011 Jan 29
0
Parallelizing cor() for large data-set using Cluster
Hi,
I am running my code in a cluster at Arizona State University.
I have a huge climate data,
66000 X 500
I am not sure if I can find correlation of such a huge data in the cluster.
Normally I allocate 20000M and operate on 5 X 20000.
Even this is taking lot of time. Is there any way I can find
cl = cor(cdata) utilizing the computers in the clusters(I am using 32 nodes
).
I am using the
2008 Jun 09
1
Basic Question on Keys/Values
As a java programmer, I'm having issue conceptualizing the following use
case:
Given an value, passed into a function, how do I pull out the lookup?
Ie.
A list of keys (key1, key2, key3)
A list of values (val1,val2,val3)
I want to write a function (or is there something built in?) such that
Callit <- (thekey) {
(magic happens here)
Return value
}
Any ideas?
Thanks a bunch!
2009 Jun 08
1
Looking for easy way to normalize data by groups
Hi,
i do have a dataframe representing data from a repeated experiment. PID
is a subject identifier, Time are timepoints in an experiment which was
repeated twice. For each subject and all three timepoints there are 2
sets of four values.
df <- data.frame(PID = c(rep("A", 12), rep("B", 12), rep("C", 12)),
Time = rep(c(0, 0, 0, 0, 30, 30, 30,
2012 Dec 11
1
converting manual command to loop command
Dear useRs,
i have certain commands for some operations in R. They are good if you have a small dataset but my dataset, apart from what i used in the recent past, is prety large. I want to convert these massive sets of commands into a simple loop.
Your help is required on it
thanks in advance
eliza
kindly note:
"e" is matrix whose each column has to be executed into a distance vector