Hi all:
If I have a dataframe of N columns.If I wanna get the min(or max,or
mean...etc)of the whole dataframe,how to do it quickly?
What I can do is only:
min(data[,1:ncol(data)])
Any other suggestion?
Thanks!
best
[[alternative HTML version deleted]]
On Aug 18, 2011, at 1:36 AM, Jie TANG wrote:
for example:
a data.frame
data
V1 V2 V3
1 2 3
4 5 6
If I want to calculate the V2
I can get data$V2
But now I want to calculate the dimension name and then analysis the
data.
for example
No=3*x ;x=1,2,3,...n
anadata=data$VNo
Well,since the intercept is the same as mean of group1,I take it for granted
that the 1-sample ttest must test based on group==1...
If the intercept is estimated from the whole sample,why does the intercept
is the same as mean of group1?
2011/8/17 Eik Vettorazzi
my qustion is if my miss value in my dataset is -
for example :
1 3 21 33 - 23 33 -
how can I plot or analysis this dataset ignoring the missing value ? thanks
.
--
TANG Jie
[[alternative HTML version deleted]]
__
This takes a few seconds to do 1 million lines, and remains explicit/for loop
form
numberofSalaryBands = 100 # 200
x= sample(1:15,numberofSalaryBands, replace=T)
y= sample((1:10)*1000, numberofSalaryBands, replace=T)
df = data.frame(x,y)
finalN = sum(df$x)
myVar
if your vector of data is x, use x[x!=-]. Subseting entire data frames
works analogously.
HTH,
Daniel
--
View this message in context:
http://r.789695.n4.nabble.com/how-to-analysis-a-dataset-with-some-missing-value-tp3751940p3752003.html
Sent from the R help mailing list archive at
look into the *apply series of functions. In your case
apply(name.of.your.data.frame,2,min)
or
apply(name.of.your.data.frame,2,max)
will do. You can also put any summary function to your liking instead of
min/max.
Best,
Daniel
Lao Meng wrote:
Hi all:
If I have a dataframe of N
Hi
r-help-boun...@r-project.org napsal dne 17.08.2011 21:07:43:
Dear Michael,
Thanks a lot for your reply and for your help.I was struggling so much
but
your suggestion showed me a path to the solution of my problem.I have
tried your code on my data frame step wise and it looks fine to
Pick up a book or the like on ordinary least squares regression, which is
what lm() in its plain vanilla application does. The t-value is the
estimated coefficient divided by the standard error. The standard errors of
the coefficients are the diagonal entries of the variance-covariance matrix.
That is a speciality of your model - it is actually an ANOVA-model (with
2 groups). Even so the variance of the intercept is estimated from the
whole sample, not only for group==1 (thats why the statistics and
p-values differ) - and that analysis is equivalent to a t-test with
common variance (aka
Hi
my qustion is if my miss value in my dataset is -
for example :
1 3 21 33 - 23 33 -
how can I plot or analysis this dataset ignoring the missing value ?
thanks
.
Use NA instead of - and things will get better
x-as.numeric(read.table(textConnection(1 3 21 33 -
Hi
look into the *apply series of functions. In your case
apply(name.of.your.data.frame,2,min)
or
apply(name.of.your.data.frame,2,max)
will do. You can also put any summary function to your liking instead of
min/max.
And summary has its own data frame method so simply
Pooling nominal with numeric variables and running pca on them sounds like
conceptual nonsense to me. You use PCA to reduce the dimensionality of the
data if the data are numeric. For categorical data analysis, you should use
latent class analysis or something along those lines.
The fact that
I should have written the standard errors of the coefficients are the SQUARE
ROOT of the diagonal entries of the variance-covariance matrix, as I
programmed it in the code.
Daniel Malter wrote:
Pick up a book or the like on ordinary least squares regression, which is
what lm() in its plain
Dear list,
I'm trying to fit a chapman-richards equation to my data, only I
cannot interpret the parameters a, b and d. I know that the parameter
b denotes the asymptote, but for the others I couldn't figure out. But
I do need to know this in order to set my starting values. Here's the
model:
dear all,
assume you type:
covOGK(x,sigmamu=s_Qn,beta=h)
you get:
Error in Qn(x, ...) : unused argument(s) (beta = 0.552325581395349)
i wanted to set the \beta in OGK to a different value--
Is it normal?
Best,
--
View this message in context:
This is not an igraph issue, I believe. You need to go over your
indices and update the matrix, i.e.
for (i in seq_along(t.list)) { temp[t.list[i], c.list[i]] -
temp[t.list[i], c.list[i]] + 1 }
Best,
Gabor
On Tue, Aug 2, 2011 at 4:50 PM, Robinson, David G dro...@sandia.gov wrote:
I realize
Joe,
what is melt() supposed to do here?
What's wrong with the simple solution of creating a data.frame first,
and then filling it with values through a loop? Actually, keeping the
matrix is just as good, indexing is just as fast, and takes the same
amount of memory as your three column matrix,
Create a factor variable for the different age categories, see cut().
Then use as.integer() on the factor variable and index a vector of
node sizes with it. E.g.
g - graph.ring(10)
V(g)$age - sample(20:78, vcount(g), replace=TRUE)
V(g)$agecat - cut(V(g)$age, breaks = c(20,35,50,65,78))
V(g)$size
Dear Deepayan,
Thank you for your quick and enlightening reply. I'll try making a modifies
version of the two functions and see what I end up with..
However, out of pure curiosity, what is wrong with the legend I
constructed below:
legend=list(corner=list(
On 17.08.2011 10:42, Danielle Martin wrote:
Hi,
I would like to use the multinomRob function to test election results.
However, depending on which independent variables I include and how many
categories I have in the dependent variable, the model cannot be estimated.
My data look like this
Works for me in R-patched:
I guess your problem is that you have to set the options() before
source()ing.
Best,
Uwe Ligges
On 17.08.2011 10:31, Cormac Long wrote:
Good morning R-help,
I have an idiot question: I would like to use getSrcDirectory()
and friends to allow me to identify
Dear All,
How to change the color of the bar lines of a histogram? I have read
?hist
which mentions the parameter 'col', but this one is to configure the
color of the bars filling.
Thanks in advance,
Paul
__
R-help@r-project.org mailing list
Read further on and find border:
hist(rnorm(10), border=yellow)
Uwe Ligges
On 18.08.2011 13:14, Paul Smith wrote:
Dear All,
How to change the color of the bar lines of a histogram? I have read
?hist
which mentions the parameter 'col', but this one is to configure the
color of the bars
I have no idea what covOGK is or does, but quickly skimming the code, one can
see there is no beta parameter anywhere in it. (In fact, only two lines have a
b at all; both in substitute().) The error message should have made this
clear to you.
Try args(covOGK) to see what parameters you are
Paul Smith wrote:
Dear All,
How to change the color of the bar lines of a histogram? I have read
?hist
which mentions the parameter 'col', but this one is to configure the
color of the bars filling.
Hi Paul,
If you mean that you are using shading lines instead of color fill, I
don't think
If your data is d1:
temp - apply(d1[,1:4], 1, order, decreasing=TRUE)[1:2,]
temp - rbind(temp, temp+4)
result - sapply(1:nrow(d1), function(i)
chisq.test(matrix(as.matrix(d1[i,temp[,i]]), ncol=2)))
Uwe Ligges
On 16.08.2011 23:26, Bansal, Vikas wrote:
Dear all,
I have been working on
That is it, Uwe! Thanks!
Paul
2011/8/18 Uwe Ligges lig...@statistik.tu-dortmund.de:
Read further on and find border:
hist(rnorm(10), border=yellow)
Uwe Ligges
On 18.08.2011 13:14, Paul Smith wrote:
Dear All,
How to change the color of the bar lines of a histogram? I have read
Hallo all
I try to find a way how to compare set of waiting times during different
periods. I tried learn something from queueing theory and used also R
search. There is plenty of ways but I need to find the easiest and quite
simple.
Here is a list with actual waiting times.
ml -
On 08/17/2011 12:32 AM, RQuestion wrote:
Let's say you want to compare one observation with a sample, how would you
use R to get a p-value for that single observation itself?
This is a rather vague question, but you seem to be describing the
calculation of tail probabilities. If, for
I am not sure why you say that lapply(ml, mean) shows (incorrectly)
that the second year has a larger average; it is correct for the data:
lapply(ml, my.func)
$y1
Count MeanSD MinMedian 90% 95%
Max Sum
18.0 16.8 12.42980 4.0
'corner' is not a valid name for a component of 'legend'. See ?xyplot
Try
xyplot(1 ~ 1,
legend = list(inside =
list(fun=draw.key,
args = list(
key = list(
text = list(month.name[1:2]),
lines = list(lty = 1:2)
),
draw = TRUE
),
Dear list,
I'm trying to fit a chapman-richards equation to my data, only I
cannot interpret the parameters a, b and d. I know that the parameter
b denotes the asymptote, but for the others I couldn't figure out. But
I do need to know this in order to set my starting values. Here's the
model:
Dear Daniel,
Thank you for your mail.
Your comment is exactly what I was worried about.
I konw very little about latent class analysis. So, I would like to use
multiple correspondence analysis (MCA) for data redution. Besides, the
first plane of the MCA captured 43% of the variance.
Do you
Hallo Jim
Thank you and see within text.
jim holtman jholt...@gmail.com napsal dne 18.08.2011 14:09:11:
I am not sure why you say that lapply(ml, mean) shows (incorrectly)
that the second year has a larger average; it is correct for the data:
lapply(ml, my.func)
$y1
Count Mean
Hi
Dear list,
I'm trying to fit a chapman-richards equation to my data, only I
cannot interpret the parameters a, b and d. I know that the parameter
b denotes the asymptote, but for the others I couldn't figure out. But
No. d Is asymptote. You can easily check how the function behives by
On Aug 17, 2011 khosoda wrote:
1. Is it O.K. to perform PCA for data consisting of 1 continuous
variable and 8 binary variables?
2. Is it O.K to perform transformation of age from continuous variable
to factor variable for MCA?
3. Is mjca1$rowcoord[, 1] the correct values as a predictor
To whom it may concern.
I d like to do use Hartigan Hartigan's [1] dip test of unimodality via
the diptest package in R, even if I installed the package diptest, it does
not seem to find the function.
Any help is welcome, thank you.
Best wishes
--
Matilde
[[alternative HTML version
Dear list,
I'm trying to fit a chapman-richards equation to my data, only I
cannot interpret the parameters a, b and d. I know that the parameter
b denotes the asymptote, but for the others I couldn't figure out. But
I do need to know this in order to set my starting values. Here's the
model:
Dear sir/madam,
I tried to recode some complex multiple variables and run into a problem that
r can change only some column that I want to change.
I can reproduce the problem with this
idfortest - c(6,23,46,63,200,238,297,321,336,364,386,392,414,434,441)
id - seq(1:500)
id[id==idfortest]
the
Wir sind bis am 20. August in den Ferien und werden keine e-mails beantworten.
Bei dringenden Fällen melden Sie sich bei Stefanie von Felten
steffi.vonfel...@oikostat.ch
We are on vacation until 20. August. In urgent cases, please contact Stefanie
von Felten steffi.vonfel...@oikostat.ch
Hi R-community,
I'm very busy with a software project which I would like to development
completely with R.oo. Many of the object oriented aspects that I already
know from Java development seems to be in place with this library.
But...there is something that I'm really missing... *the super method
Hi All!
I'm trying to convert serial numbers in Excel to dates in R. For each
single thedate entry, I get a correct answer. But if I try using the for
loop, I get bizarre numbers in mynewdata.
thedate-as.matrix(40548:40759,ncol=1)
exdate-function(){
mynewdate-NULL
for(i in
On Aug 18, 2011; Daniel Malter wrote:
Pooling nominal with numeric variables and running pca on them sounds like
conceptual
nonsense to me.
Hi Daniel,
This is not true. There are methods that are specifically designed to do a
PCA-type analysis on mixed categorical and continuous variables,
you loaded that package as well?
library(diptest)
...
best.
Am 18.08.2011 15:16, schrieb matilde vaghi:
To whom it may concern.
I d like to do use Hartigan Hartigan's [1] dip test of unimodality via
the diptest package in R, even if I installed the package diptest, it does
not seem to
If those values represent response times in a system, then when I was
responsible for characterizing what the system would do from the
viewpoint of an SLA (service level agreement) with customers using the
system, we usually specified that 90% of the transactions would have
a response time of ---
You don't need the loop; it was converting back to numeric. Try this:
thedate-as.matrix(40548:40759,ncol=1)
exdate-function(){
+ mynewdate-as.Date(thedate[,1],origin=1899-12-30)
+ print(mynewdate)
+ }
exdate()
[1] 2011-01-05 2011-01-06 2011-01-07 2011-01-08 2011-01-09
2011-01-10
you probably want to use %in%:
idfortest - c(6,23,46,63,200,238,297,321,336,364,386,392,414,434,441)
id - seq(1:500)
id[id %in% idfortest]
[1] 6 23 46 63 200 238 297 321 336 364 386 392 414 434 441
take a look at what 'id == idfortest' gives; study up on the recycling
of arguments.
On
My reservations about the methodology aside, it's probably not a bad idea to
include an error checking line for the case when the probability of the
second event is 0 (and so, unsurprisingly, the chi-sq test rejects the null
hypothesis) to look at things like the first line:
Try this:
Y =
On Aug 18, 2011, at 5:52 AM, Rut S wrote:
Dear sir/madam,
I tried to recode some complex multiple variables and run into a
problem that
r can change only some column that I want to change.
I can reproduce the problem with this
idfortest -
Hi Jim
If those values represent response times in a system, then when I was
responsible for characterizing what the system would do from the
viewpoint of an SLA (service level agreement) with customers using the
system, we usually specified that 90% of the transactions would have
a
Hi Carol,
I unsuccessfully tried to get credits right for the following quote (and
they make a lot of fuzz about having citations right around here), so I
have to stick with the plain line:
Statistics means never having to say you're certain.
Bioconductor has a mailing list on its own, there
Please refer to the posting guide... This is not a mathematics tutoring list.
Your question does not appear to be about R, so no one has responded.
---
Jeff Newmiller The . . Go Live...
DCN:jdnew...@dcn.davis.ca.us
Dear r-help,
I would like to select a subset of levels from a factor variable in a data
frame and return a data frame.
The data set consists of 3 variables, 2 of which are factors (Site, Fish) and
one numeric (Datavalue) as follows:
Site Fish Datavalue
AB 2-12.3
AB
On Aug 18, 2011, at 10:27 AM, B Jessop wrote:
Dear r-help,
I would like to select a subset of levels from a factor variable in
a data frame and return a data frame.
The data set consists of 3 variables, 2 of which are factors (Site,
Fish) and one numeric (Datavalue) as follows:
Site
Your expectations of the | operator don't seem fair... you should reread ?|
and perhaps the Introduction to R document.
In particular, there is no between operator in R. The %in% operator allows
you an efficient way to identify any of many specific cases. If you are working
with ordered
On Thu, Aug 18, 2011 at 10:12 AM, Petr PIKAL petr.pi...@precheza.cz wrote:
Hi Jim
If those values represent response times in a system, then when I was
responsible for characterizing what the system would do from the
viewpoint of an SLA (service level agreement) with customers using the
At 10:31 AM +0200 8/18/11, Petr PIKAL wrote:
Hi
look into the *apply series of functions. In your case
apply(name.of.your.data.frame,2,min)
or
apply(name.of.your.data.frame,2,max)
will do. You can also put any summary function to your liking instead of
min/max.
And summary has its
Hi R list,
I like the default ticks that are set up using grid.xaxis() or grid.yaxis()
with no arguments. Finding good values for the 'at' argument is usually not
a trivial task; the default behavior of these functions seems to work well.
The problem with this strategy is that I cannot figure
At 16:43 17/08/2011, Luke Duncan wrote:
Dear R gurus
Response in line below
I am analysing data from a study of behaviour and shade utilization of
chimpanzees. I am using GLMs in R (version 2.13.0) to test whether shade/sun
utilization is predicted by behaviour observed. I am thus interested
Thanks David and Duncan,
Before I posted I was considering the approach of multiplying week by 7,
but I couldn't see a clean way to do it so it'll work for any year, and
get Monday's date correct.
I now realize I could write code to evaluate which of the first 7 days
in the year is a Monday and
Just to close this off, in case it helps anyone else in a similar
situation...
Background: I have R installed on a UNC share with a site library named by
major and minor version, thus:
\\campden\shares\Workgroup\Stats 'root'
\\campden\shares\Workgroup\Stats\R base for R related things
Dear Mark,
Thank you very much for your mail. This is what I really wanted!
I tried dudi.mix in ade4 package.
ade4plaque.df - x18.df[c(age, sex, symptom, HT, DM, IHD,
smoking, DL, Statin)]
head(ade4plaque.df)
age sex symptom HT DM IHD smoking
hyperlipidemia
Dear R-users
I need to calibrate kappa, rho, eta, theta, v0 in the following code, see
below. However when I run it, I get:
y - function(kappahat, rhohat, etahat, thetahat, v0hat) {sum(difference(k,
t, S0, X, r, implvol, q, kappahat, rhohat, etahat, thetahat, v0hat)^2)}
nlminb(start=list(kappa,
Hi,
Sorry! I fited model with gls of nlme package. And I trying to contrast
interaction with function contrast of contrast package.
I thanks for your reply,
Regards.
Marylin Bejarano
__
If you reply to this email, your message will be added to the
Thanks,
I´ve found the differencies with a posteriori tests.
I don't put the term month because it is not significant.
-
Mario Garrido Escudero
PhD student
Dpto. de Biología Animal, Ecología, Parasitología, Edafología y Qca. Agrícola
Universidad de Salamanca
--
View this message in context:
On Wed, Aug 17, 2011 at 4:52 PM, Folkes, Michael
michael.fol...@dfo-mpo.gc.ca wrote:
Hello all,
I'm hoping to convert a decimal value for week of the year back to a date
object.
Eg:
strptime(paste(2010,1:52,sep= ),format=%Y %W)
I expected (hoped?) this would give me the date for Monday of
I think David's idea about NA's was correct. This works:
prcomp(na.omit(Chlor1[,-(1:2)]), scale=TRUE)
The number of cases drops from 288 to 250. There also three 0's in the
dataset that probably should be NA's.
--
David L Carlson
Texas AM University
Thanks. The reason I responded that way is that the error message mentioned
a function gendata that is in the rms and Design packages. I guess it's in
the contrast package too.
Frank
MarylinBejarano wrote:
Hi,
Sorry! I fited model with gls of nlme package. And I trying to contrast
I think you can also do this from within R (e.g. in your .Rprofile)
using the R.utils package;
library(R.utils)
System$mapDriveOnWindows(K, campden\\shares\\Workgroup\\Stats)
driveLetters - System$getMappedDrivesOnWindows()
System$unmapDriveOnWindows(K)
These methods utilize 'subst' of MS
Thanks to Duncan Mackay and Dennis Murphy for help.
The following solution seems to give me what I need.
library(memisc)
toLatex(ftable(cyl ~ am,data=mtcars))
For this to work, we have to use:
\documentclass{article}
\usepackage{booktabs}
\usepackage{dcolumn}
\begin{document}
at the beginning
Dear R List,
I am trying to use mixed models to analyze an intervention and want to make
sure I am doing it correctly. The intervention is for lowing cholesterol
and there are two groups: one with an intervention and one without. The
subjects were evaluated a differing amount of time, so there
Hello all,
I have a question which I have been struggling with for several weeks
now, that I think might be easy for more proficient coders than
myself. I have a large behavioral dataset, with behaviors and the
times (milliseconds) that they occurred. Each subject has a separate
file, and a sample
Dear R-Users
I have the following matrix
out$desc [,1][,2]
[1,]
[2,] y_{01}(k-001)
[3,] y_{01}(k-002)
[4,] y_{01}(k-003)
[5,] u_{01}(k-001)
[6,] u_{01}(k-002)
[7,] u_{01}(k-003)
[8,] y_{01}(k-001) y_{01}(k-001)
[9,] y_{01}(k-001) y_{01}(k-002)
Assuming that the * in your [11,] example is a typo, would this work?
apply(out$desc,1,paste,collapse=)
Hope this helps,
Michael Weylandt
On Thu, Aug 18, 2011 at 2:35 PM, Eduardo Mendes emammen...@gmail.comwrote:
Dear R-Users
I have the following matrix
out$desc [,1]
On Aug 18, 2011, at 2:35 PM, Eduardo Mendes wrote:
Dear R-Users
I have the following matrix
out$desc [,1][,2]
[1,]
[2,] y_{01}(k-001)
[3,] y_{01}(k-002)
[4,] y_{01}(k-003)
[5,] u_{01}(k-001)
[6,] u_{01}(k-002)
[7,] u_{01}(k-003)
[8,] y_{01}(k-001)
It looks like it. However, you provide very little information. Do you have
measurements before and after the intervention and did the intervention
occur at the same point in time for all treated? If so, you could do a
simple difference in differences estimation.
HTH,
Daniel
Troy S wrote:
On 8/17/2011 11:13 AM, Uwe Ligges wrote:
Actually require() is a wrapper around library() with more error
handling to be used inside other functions. Just type require(), you can
read the few lines of code quickly.
I think the unstated corollary is that library() is preferred when not
inside
On 8/17/2011 11:29 AM, mkzo...@comcast.net wrote:
I'm trying to create a dotplot with some grouping.
I've been able to create what I want using dotchart (basic
graphics), but can't quite get it using dotplot (lattice). I prefer
to use lattice (or ggplot2) because I think it's a bit easier to
Dear list colleagues,
I'm trying to come up with a test question for undergraduates to illustrate
comparison of means from a complex survey design. The data for the example
looks roughly like this:
mytest-data.frame(harper=rnorm(500, mean=60, sd=1), party=sample(c(BQ,
NDP, Conservative,
On Thu, Aug 18, 2011 at 04:52:58PM +0700, Rut S wrote:
I tried to recode some complex multiple variables and run into a problem that
r can change only some column that I want to change.
I can reproduce the problem with this
idfortest -
The problem with your first solution is that it relies on that the each
'year x group' combination is present in both data frames. To avoid this, I
would recommend to use merge()
df3-merge(df1,df2,by.x=c(Year,Group),by.y=c(Year,Group))
df3$ratio-with(df3,Value.x/Value.y)
df3
HTH,
Daniel
R. Michael Weylandt lt;michael.weyla...@gmail.comgt; Reply | Threaded |
More
Dear Michael,
please explore:
?covOGK
yields
covOGK(X, n.iter = 2, sigmamu, rcov = covGK, weight.fn = hard.rejection,
keep.data = FALSE, ...)
and
hard.rejection
function (distances, p, beta =
Hi R community,
I have been trying to figure out why R is reversing the order of rows after
I run data.matrix()
Here is my data:
df-structure(list(itmID = c(1L, 2L, 1L, 2L, 1L, 2L), variable =
structure(c(1L,
1L, 2L, 2L, 3L, 3L), .Label = c(3, 2, 1), class = factor),
value = c(0.7, 0.52,
On 8/18/2011 1:40 PM, Alexander Schwall wrote:
Hi R community,
I have been trying to figure out why R is reversing the order of rows after
I run data.matrix()
Here is my data:
df-structure(list(itmID = c(1L, 2L, 1L, 2L, 1L, 2L), variable =
structure(c(1L,
1L, 2L, 2L, 3L, 3L), .Label = c(3,
On Fri, Aug 19, 2011 at 7:25 AM, Simon Kiss sjk...@gmail.com wrote:
Dear list colleagues,
I'm trying to come up with a test question for undergraduates to illustrate
comparison of means from a complex survey design. The data for the example
looks roughly like this:
Dear all,
okay, I found a one liner based on mutate:
(df3 - mutate(df1, Value=Value[order(Year,Group)] / df2[with(df2,
order(Year,Group)),Value]))
Cheers,
Marius
On 2011-08-18, at 20:41 , Marius Hofert wrote:
Dear expeRts,
What is the best approach to create a third data frame from two
Does anyone have experience about how to convert a matrix to binaryMatrix using
Recommenderlab package?
Thanks,
Jing
[[alternative HTML version deleted]]
__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
Hi,
I don't know much about R's deparsing magic, I simply use the
deparse(substitute(arg)) trick to get the names of the variables
passed as arguments to the function in order to set labels, etc.
The problem is that this doesn't work with nested functions. For
example,
foo - function(x)
I have a data frame like this
xx-data.frame(cbind(Sample=c('Ctrl_6h','1+0_6h','1+200_6h','1+5k_6h','Ctrl_5K_6h','ConA_6h'),
IFIT1=c(24,25,24.7,24.5,24.2,24.8)))
grep('[[:digit:]]h',xx$Sample)
yy-xx$Sample
strsplit(yy,_)
I have to extract the time information separated by '_'
Hi Paul,
I would use something like this:
x - c(2,2,3,3,4,6)
table(x)
x
2 3 4 6
2 2 1 1
x - factor(x, levels=1:8)
table(x)
x
1 2 3 4 5 6 7 8
0 2 2 1 0 1 0 0
Sarah
On Sun, Jul 31, 2011 at 5:41 PM, Paul Menzel
paulepanter at users.sourceforge.net wrote:
Dear R folks,
I am sorry to ask
Hi all,
I have the following issue:
head(A):
C6
5 6.095243
6 12.622674
7 6.418493
8 11.726602
9 9.282112
25 9.625917
head(B):
V1
2 30437
5 1102503
6 1102539
7 1103257
8 1103295
9 1104434
25 1100494
I would like to extract elements from B
I now know that those numbers to the left can be extracted using rowNames().
So how can I extract elements of B where rowNames = rowNames(A)?
--
View this message in context:
http://r.789695.n4.nabble.com/Extracting-Parts-of-Array-Index-Comparison-tp3753792p3753839.html
Sent from the R help
On Aug 18, 2011, at 5:11 PM, Ernest Adrogué wrote:
Hi,
I don't know much about R's deparsing magic, I simply use the
deparse(substitute(arg)) trick to get the names of the variables
passed as arguments to the function in order to set labels, etc.
The problem is that this doesn't work with
On Aug 18, 2011, at 5:43 PM, 1Rnwb wrote:
I have a data frame like this
xx-
data
.frame
(cbind
(Sample
=c('Ctrl_6h','1+0_6h','1+200_6h','1+5k_6h','Ctrl_5K_6h','ConA_6h'),
IFIT1=c(24,25,24.7,24.5,24.2,24.8)))
grep('[[:digit:]]h',xx$Sample)
yy-xx$Sample
strsplit(yy,_)
Hi Sharad,
Try
xx$newSample - sapply(with(xx, strsplit(as.character(Sample), _)), [, 1)
xx
HTH,
Jorge
On Aug 18, 2011, at 5:43 PM, 1Rnwb wrote:
I have a data frame like this
xx-data.frame(cbind(Sample=c('Ctrl_6h','1+0_6h','1+200_6h','1+5k_6h','Ctrl_5K_6h','ConA_6h'),
On Aug 18, 2011, at 6:48 PM, teriri wrote:
I now know that those numbers to the left can be extracted using
rowNames().
So how can I extract elements of B where rowNames = rowNames(A)?
B[ rownames(B) %in% rownames(A), ]
(Normally I don't answer Nabble Q's without context, but this one
Sorry for the noise. The code should have been
sapply(with(xx, strsplit(as.character(Sample), _)), [, 2)
instead of what I sent previously.
HTH,
Jorge
On Aug 18, 2011, at 7:30 PM, Jorge I Velez wrote:
Hi Sharad,
Try
xx$newSample - sapply(with(xx, strsplit(as.character(Sample), _)),
Please do read the posting guide and quote the original message and all
others you are referring to.
On 18.08.2011 22:28, kv wrote:
R. Michael Weylandtlt;michael.weyla...@gmail.comgt; Reply | Threaded |
More
Dear Michael,
please explore:
?covOGK
yields
covOGK(X, n.iter = 2, sigmamu,
Try this:
transform(xx, Time = gsub(.*_, , xx$Sample))
On Thu, Aug 18, 2011 at 6:43 PM, 1Rnwb sbpuro...@gmail.com wrote:
I have a data frame like this
xx-data.frame(cbind(Sample=c('Ctrl_6h','1+0_6h','1+200_6h','1+5k_6h','Ctrl_5K_6h','ConA_6h'),
1 - 100 of 105 matches
Mail list logo