Displaying 20 results from an estimated 40000 matches similar to: "change value in one cell"
2011 Nov 13
4
identify duplicate from more than one column
Hi all,
I've searched everywhere to try to find out how to do this and have had no
luck. I am trying to construct identifiers for couples in a dataset.
Essentially, I want to identify couples using more than one column as
identifiers. Take for instance:
obs unit home z sex age
1 015029 18 1 1 053
2 015029 18 1 2 049
3 015029 01 1 1 038
4 015029 01 1
2007 Aug 11
1
xyplot() with segments() superposed?
In the hypothetical example below, how do I add two segments() into
the two panels, respectively? Say segments(x0=5, y0=10, x1=5, y1=20)
on the left and segments(x0=15, y0=-10, x1=15, y1=-2) on the right?
Many thanks in advance,
Yuelin Li.
ps. part of the code came from a solution given by Deepayan Sarkar.
-------------------
library(lattice)
set.seed(12345)
x <- 0:20
y.male.obs <- - 1.2
2011 Aug 31
1
looping by grouping variable
Hello all,
I hope something is not already posted regarding this exact problem I am
trying to solve. I've read through the forums and previous postings and am
still confused as to how to approach this. Basically, what I am trying to do
is construct variables that utilizes an average of a variable from a
grouping, or higher order, variable. For instance, in my dataset I have
variables, with
2011 Dec 23
2
missing value where TRUE/FALSE needed
Merry Xmas to all,
I am writing a function and curiously this runs sometimes on one data set
and fails on another and i cannot figure out why.
Any help much appreciated.
If i run the code below with
data <- iris[ ,1:4]
The code runs fine, but if i run on a large dataset i get the following
error (showing data structures as matrix is large)
> str(cluster.data)
num [1:9985, 1:811] 0 0 0 0
2016 Apr 24
1
assign color to subsets
'grepl' returns a logical vector; you have to use this to get your subset.
You can use:
df_tq <- subset(df, grepl("t1", Command))
df_t2 <- subset(df, grepl("t2", Command))
# if you want to also get a subset that has both, use
df_both <- subset(df, grepl("t1", Command) & grepl("t2", Command))
Jim Holtman
Data Munger Guru
What is
2016 Apr 26
0
From NUM to INT
Inline.
-- Bert
On Tue, Apr 26, 2016 at 2:25 PM, Andr? Luis Neves <andrluis at ualberta.ca> wrote:
> Ok. I`m trying to run a Poisson glmm with an observation-level random
> intercept. But I`m getting the following error for the 'Baci' variable:
>
> 'Error: (maxstephalfit) PIRLS step-halvings failed to reduce deviance in
> pwrssUpdate'. I guess this message
2016 Apr 26
2
From NUM to INT
Ok. I`m trying to run a Poisson glmm with an observation-level random
intercept. But I`m getting the following error for the 'Baci' variable:
'Error: (maxstephalfit) PIRLS step-halvings failed to reduce deviance in
pwrssUpdate'. I guess this message is because the baci variable is not a
an integer, and cannot be transformed into an integer as R has a threshold
of
2x10^9 even in
2017 Jun 28
4
Extraneous full stop in csv read
I ran into a puzzling minor behaviour I would like to understand.
Reading in a csv file, I find an extraneous "." after a column header,
"in" [short for "inches"] thus, "in.". Is this due to "in" being
reserved? I initially blamed this on RStudio or to processing the data
through LibreCalc. However, the same result occurs in a console R
session.
2011 Mar 20
2
Why unique(sample) decreases the performance ?
Hi,
I' am interested in differences between sample's result when samples consist
of full elements and consist of only distinct elements. When sample consist
of full elements it take about 120 sec., but when consist of only distinct
elements it take about 4.5 or 5 times more sec. I expected that opposite of
this result, because unique(sample) has less elements than full sample. Code
as
2016 Apr 24
0
assign color to subsets
now after this:
df_both <- subset(df, grepl("t1", Command) & grepl("t2", Command))
I use factor to apply the subset to df but then the Command level becomes 0
df_both$Command=factor(df_both$Command)
str(df_both)
$ Protocol : Factor w/ 0 levels:
Do you know what is the reason?
Thanks for replying
On Sunday, April 24, 2016 12:18 PM, jim
2013 May 01
1
Combine multiple tables into one
Hi,
May be this helps:
dat1<- as.data.frame(table1)
?dat2<- as.data.frame(table2)
names(dat2)<-c("V3","V4")
library(plyr)
res<-join(dat1,dat2,type="full")
?res[is.na(res)]<- 0
?res
#? V1 V2 V3 V4
#1? 1? 1? 0? 0
#2? 1? 2? 0? 0
#3? 0? 0? 0? 1
#4? 0? 0? 0? 4
?combinedtable<-as.matrix(res)
?colnames(combinedtable)<- NULL
?combinedtable
#???? [,1] [,2]
2012 Mar 07
2
how to see inbuilt function(cor.test) & how to get p-value from t-value(test of significance) ?
i can see source code of function
> cor
function (x, y = NULL, use = "everything", method = c("pearson",
"kendall", "spearman"))
{
na.method <- pmatch(use, c("all.obs", "complete.obs",
"pairwise.complete.obs",
"everything", "na.or.complete"))
2012 Jun 27
2
a problem of approach
Dear R-help list,
Part of a program I wrote seem to take a significant amount of time,
therefore I am looking for an alternative approach.
In order to explain what is does:
- the input is a sorted vector of integer numbers
- some higher numbers may be derived (using a mathematical formula)
from lower numbers, therefore they should be eliminated
- at the end, the vector should contain only
2006 Oct 02
1
separation depending on equal contents in more than one field
Hi,
I have a dataframe:
(obs <- data.frame(a=c(1,2,2,3,3,3), b=c(1,2,3,4,4,5), c=1:2))
attach(obs)
In reality its about 1 million rows.
Some of the datasets have same contents in col a and! b like row 4 and 5.
I want to do some calculations on col c within the duplicated rows and
merge them afterwards:
layer <- function(x) round((1-prod(1-x/100))*100,0)
(covnew <- aggregate(c,
2003 Oct 15
2
Example of cell means model
This is an example from chapter 11 of the 6th edition of Devore's
engineering statistics text. It happens to be a balanced data set in
two factors but the calculations will also work for unbalanced data.
I create a factor called 'cell' from the text representation of the
Variety level and the Density level using '/' as the separator
character. The coefficients for the linear
2012 Sep 28
4
Merging multiple columns into one column
Good Evening-
I have a dataframe that has 10 columns that has a header and 7306 rows in
each column, I want to combine these columns into one. I utilized the stack
function but it only returned 3/4 of the data...my code is:
where nfcuy_bw is the dataframe with 7305 obs. and 10 variables
Once I apply this code I only receive a data frame with 58440 obs. of 2
variables, of which there should be
2009 Sep 07
1
Plot 2 ecdf in one graph
Hi r-users,
I would like to compare the cdf between historical and predicted. My x.obs and x.pre are the frequency data in classes of 0-300.
I tried:
plot(ecdf(x.obs),ecdf(x.pre),type="l",col="red")
and it gives me:
Error in plot.stepfun(x, ..., ylab = ylab, verticals = verticals, pch = pch) :
argument 4 matches multiple formal arguments
Thank you so much for any
2016 Apr 23
4
assign color to subsets
Hi
I have the following df and I created two subsets but I don't know how to use these subsets as the colors of my plot.
data.frame': 36919 obs. of 162 variables
$TE :int 38,41,11,52,48,75,.....
$TR :int 100,210,548,546,.....
$Command :factor W/2229 levels
2013 Apr 06
1
Replace missing values within a group with the non-missing value
I have a large dataset organised in choice groups see below. Each choice represents a separate occasion with 1 product chosen out of the 6 offered.
+-------------------------------------------------------------------------------------------------+
| dn obs choice acid br date cdate situat~n mth year set |
2007 Apr 13
2
replicates in repeated ANOVA
Hi,
I have sort of a newbie question. I've seriously put a lot of effort into how to handle simple replicates in a repeated ANOVA design, but haven't had much luck.
I really liked reading "Notes on the use of R for psychology experiments and questionnaires", by Jonathan Baron and Yuelin Li ( http://www.psych.upenn.edu/~baron/rpsych/rpsych.html ) but still didn't run across