Displaying 20 results from an estimated 9000 matches similar to: "Reducing dimension of a list object"
2011 Apr 06
2
A zoo related question
Dear all, please consider my following workbook:
library(zoo)
lis1 <- vector('list', length = 2)
lis2 <- vector('list', length = 2)
lis1[[1]] <- zooreg(rnorm(20), start = as.Date("2010-01-01"), frequency = 1)
lis1[[2]] <- zooreg(rnorm(20), start = as.yearmon("2010-01-01"), frequency =
12)
lis2[[1]] <- matrix(1:40, 20)
lis2[[2]] <-
2006 Sep 07
1
Running wilcox.test function on two lists
Dear all,
I'm a newbie to R and I would really apperciate any help with the following:
I have two lists, l1 and l2:
l1:
$"A*0101"
[1] 0.076 0.109 0.155 0.077 0.09 0 0 0.073
[9] 0.33 0.0034 0.0053
$"A*0247"
[1] 0 0 0.5 .004 0 0 0
$"A*0248"
[1] 0 0 0.3 0 0.06
....
l2:
$"A*1101"
[1] 0.17 0.24 0.097 0.075 0.067
$"A*0247"
numeric(0)
2011 May 04
1
Str info. Thanks for helping
It looks from str(SA) that Response IPS1 is a data.frame of class "anova", which probably cannot be coerced to vector.
Maybe you can use unlist() instead of as.vector()
Or something like
SA[["Response IPS1"]]["as.factor(WSD)",] ## to select the first row only, even maybe with unlist()
Without a better REPRODUCIBLE example, I cannot tell more (maybe some others
2010 Dec 06
1
Loading .RData from Internet
Dear All,
Can you please suggest me a correct way to load the following R data frame
from the internet and save it to the hard drive?
The following is what I tried:
> raceprofiling <-
> read.table("http://rss.acs.unt.edu/Rdoc/library/twang/data/raceprofiling.RData")
> save(raceprofiling, file = 'raceprofiling.RData')
However, when I used dim() to check the dataset,
2010 Dec 08
5
Summing up Non-numeric column
Dear All
If I have the following dataset
V1 V2
x y
y x
z b
a c
b j
d l
c o
How do I use R command to get the total number of different letter in column
"V1"
column "V1" has 7 different letters.
Thank you
--
View this message in context: http://r.789695.n4.nabble.com/Summing-up-Non-numeric-column-tp3077710p3077710.html
Sent from the R help mailing list archive
2011 Apr 20
2
user input
Dear users,
I have looked on different sources and found different functions to
prompt the user to provide input. However, I couldn't find one that does
exactly what I'm looking for.
select.list() and menu() are nice because a graphic window appears to
prompt the user. However, the user can only choose from a predefined
list of choices. readline() and scan() are more free in the
2010 Dec 13
7
descriptive statistics
Hi. In a data set I have a variable that takes values from 1 to 14. For each
subgroup of values of this variable, I would like to obtain some descriptive
statistics of other variables present in the data set. I've been trying with
a "for" loop but I couldn't get nothing. Could you please suggest me some
lines?
--
View this message in context:
2005 Jan 06
2
Generating Data mvrnorm and loops
Dear List:
I am generating N datasets using the following
Sigma<-matrix(c(400,80,80,80,80,400,80,80,80,80,400,80,80,80,80,400),4,4
)
mu<-c(100,150,200,250)
N=100
for(i in 1:N)
{
assign(paste("Data.", i, sep=''),
as.data.frame(cbind(seq(1:1000),(mvrnorm(n=1000, mu, Sigma)))))
}
With these datasets, I need to work on some of the variables and then
run each dataset
2010 Dec 07
3
string
Hi,
I'm running R 2.11
Does anyone know if it possible to transform one character vector to one
character string ?
Many thanks
Benoit
--
Benoit Wastine
Laboratoire des Sciences du Climat et de l?Environnement (LSCE/IPSL)
CEA-CNRS-UVSQ
CE Saclay
Orme des merisiers
B?t 703 - Pte 13A
91191 Gif sur Yvette Cedex
France
Tel : 33 (0)1 69 08 21 97
Fax : 33 (0)1 69 08 77 16
2011 Jan 18
2
dataframe: string operations on columns
Dear all,
how can I perform a string operation like strsplit(x," ") on a column
of a dataframe, and put the first or the second item of the split into a
new dataframe column?
(so that on each row it is consistent)
Thanks
Boris
2011 Feb 02
1
combining vectors into list
Hi R users
I have these two vectors:
Row <- sample(1:25, 10)
Col <- sample(1:25, 10)
Is there a way to combine them into a list, whose first component is a
vector containing the first element of Row and the first element of Col,
the second component is a vector containing the second element of Row
and the second element of Col, and so on...
Thanks you
Lorenzo
2011 Feb 28
1
Replacing an element in a vector
Dear R helpers
I seem to have one trivial problem but can't find solution to it.
Suppose I have following input.
A = c(1, 3, 0, 5, 8) # 3rd element is 0
B = c(100, 30, 0, 25, 40) # 3rd element is 0
C = A/B
> C
[1] 0.01 0.10 NaN 0.20 0.20
Obviously, I can't divide 0/0 and hence NaN. My problem is how to replace this NaN say by 0.
So that I can
2011 Mar 09
1
Getting the source file's name where the custom function is written
Dear R experts,
I've written some functions in a few source files (such as main.R,
control.R ...).
After loading them into R, how do I retrieve which functions are loaded
from which source file?
For example:
main.R has functions: myPrint(), myScan()
control.R has functions: setPrinter(), setData()
After loading the sources (main.R and control.R) into R, I would want to
know that
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 =
2011 Mar 28
2
deleting the first two characters in each row of a factorized column
Hello,
I'd like to ask you something again.
I have a database and it has a column which looks like this one here:
small_factor <- factor(c("d_variable1","d_variable2","d_variable3"))
small_factor
Now the thing is that I would like to convert each element of this factorized column. Basically I want to rewrite the words in it without the first two characters:
2011 May 05
3
Remove all whitespaces
Hi
I got a string that looks something like this
1 2 3 4 5 6 7 8 9 ...
and I want it to be
123456789...
So I want to remove all spaces (or whitespaces) from my string.
Anyone know a good way of doing this?
//Joel
--
View this message in context: http://r.789695.n4.nabble.com/Remove-all-whitespaces-tp3497867p3497867.html
Sent from the R help mailing list archive at Nabble.com.
2011 Mar 04
1
column removing under certain conditions
Dear collegues!
Given a matrix, I would like to remove columns, that do not fulfill a certain condition. The condition is, that the median of the column is higher than a certain value.
I've seen the help on removing NA columns, but I cannot figure out how to change the function part of the statement, so that the function is only TRUE if the median of the column is higher than x;
2011 Feb 03
2
how to read the "Sum Sq" - column from summary.aov()
Dear R-Users,
I have a trivial problem, but extensive googling and ??'ing did not solve it: I want to obtain the sums of squares from a summary.aov() object for later use. Example:
> DV <- rnorm(100)
> IV1 <- as.factor(rep(c("male", "female"), times = 50))
> IV2 <- as.factor(rep(c("young", "old"), times = 50))
>
>
2011 Jan 17
2
Finding NAs in DF
Hi,
What is an efficient way to take this DF
data.frame(A=c(1,2,NA,NA),B=c(1,NA,NA,4))
and get
c(NA,"TWO","BOTH","ONE")
as the result, where NA corresponds to a row without "NA"s, TWO indicates NA
in the second and ONE in the first column.
Thanks for any pointers.
Joh
2011 Apr 06
1
syntax to subset for multiple values from a single variable
Hi All,
Is it possible to use the subset() function to select data based on multiple
values of a single variable from a data frame.
My actual data set is much bigger and would like to illustrate with
following dataset
> df = data.frame(x = c('a','b','c','d','e','f','g','h','a','a','b','b'), y
=