Displaying 20 results from an estimated 57 matches for "item2".
Did you mean:
items
2009 Mar 07
4
merge data frames with same column names of different lengths and missing values
...erged the dataframes, every column with the same name would be merged, with the value in a complete cell overwriting the value in an empty cell from the other data frame. I cannot seem to achieve this result, though I've tried several merge adaptations:
x <- data.frame(item1=c(NA,NA,3,4,5), item2=c(1,NA,NA,4,5), id=1:5)
y <- data.frame(item1=c(NA,2,NA,4,5,6), item2=c(NA,NA,3,4,5,NA), id=1:6)
merge(x,y,by="id") #I lose observations here (n=1 in this example), and my items are duplicated - I do not want this result
id item1.x item2.x item1.y item2.y
1 1 NA 1...
2013 Mar 21
1
Error Message During ANOVA
...n't understand the error message I am getting or how to fix it. Any suggestions will be greatly appreciated
df1=read.table("fastfood.txt", header=TRUE); df1
>
> c(t(as.matrix(df1)))
>
> r = c(t(as.matrix(df1))) # response data
>
> r
>
f=c("item1","item2", "item3")
> k=3
> n=6
> tm =gl(k,1, n*k, factor(f))
> tm
[1] item1 item2 item3 item1 item2 item3 item1 item2 item3 item1 item2 item3
[13] item1 item2 item3 item1 item2 item3
Levels: item1 item2 item3
> av=aov(r~tm)
>
> Error in model.frame.default(formula = r ~...
2013 Mar 01
2
issue creating a subset
I'm performing item response theory with eRm packages
I am excluding the persons that doesn't fit in the infit/outfit persons.
for that I created a condition. then I have to create a new subset or
matrix but with the condition.
So:
ORIGINAL
matrix<-cbind(item1, item2, item3, item4)
IF I PERFORM A head(matrix)
item1 item2 item3 item4
3 2 3 1
3 1 2 4
THEN I CREATE THE LOGIC CONDITION
z<-thing==T
THEN I TRY TO CREATE THE NEW MATRIX BUT WITH THE CONDITION
matrix2<-cbind(item1[z==T], item2[z==T], item3[z==T], i...
2008 May 02
2
Transform values from one column into column names of new dataframe
Hi, I have a question about reformatting data. It looks like it should
be simple, but I've been working at it for awhile now and it's about
time I ask for help.
My data look like this:
ITEM VALUE STEP
item1 A first
item2 C first
item2 D second
item1 A second
item3 A first
item3 B second
item3 A third
I just want to transform it so they look like this:
ITEM FIRST SECOND THIRD
item1 A A NA
item2 C D NA
item3 A...
2011 Aug 21
1
rank analysis - reinventing the wheel?
...at the
start and keep it fixed.
Anyway, is there a pacakge/function in R that does something like this so I
don't have to reinvent the wheel? If not, any help on how to do this
efficiently in R would be great.
Here is a super simple example using 3 fractiles:
independent data frame:
item1 item2 item3
1 18 15 16
2 12 12 17
3 20 13 18
dependent data frame:
item1 item2 item3
1 3 1 6
2 2 2 7
3 1 3 8
fractiles by row by item: (done with independent data frame, redefining
fractiles each row)
fractiles: 1 2...
2008 Jan 10
1
data.frame manipulation: Unbinding strings in a row
Hi all,
I have a data.frame I received with data that look like this (comma
separated strings in last row):
ID Shop Items
ID1 A1 item1, item2, item3
ID2 A2 item4, item5
ID3 A1 item1, item3, item4
But I would like to unbind the strings in col(2) items so that it will look
like this:
ID Shop Items
ID1 A1 item1
ID1 A1 item2
ID1 A1 item3
ID2 A2 item4
ID2 A2 item5
ID3 A1 item1
ID3 A1 item3
ID3 A1 item4
Meaning each item is on a different...
2013 Feb 26
2
Converting code to R Question
...five scales with each scale having 6 items half of which may have
the 1 response pattern and half the 2 pattern.
Any suggestions on how best to tackle this in R would be helpful.
Craig
**********
Old SPSS code sample
**********
Compute Variable = 0.
IF (item1 = 1) Variable = Variable +1 .
IF (item2= 2) Variable = Variable +1 .
IF (item3 = 1) Variable = Variable +1.
IF (item4 = 2) Variable = Variable +1.
EXECUTE .
[[alternative HTML version deleted]]
2006 Sep 28
3
ruby alternative to php's implode and expload functions
is there a method similar to php''s expload function in ruby. i have a
database field that contains an array of items, when i output this field
i notice the items are seperated by ''-'' e.g item1-item2-item3.
how would i go about putting them back into an array in ruby. for
example in PHP i would just do this:
$field; // = item1-item2-item3
$field_as_array = explode(''-'',$field);
--
Posted via http://www.ruby-forum.com/.
--~--~---------~--~----~------------~-------~--~---...
2013 Apr 16
1
Path Diagram
Hi All,
Apologies if this has been answered somewhere else, but I have been
searching for an answer all day and not been able to find one.
I am trying to plot a path diagram for a CFA I have run, I have installed
Rgraphviz and run the following:
pathDiagram(cfa, min.rank='item1, item2, item3, item4, item5, item6,
item7, item8, item9, item10, item11, item12', max.rank='SMP, AAAS',
file='documents')
I get the following message and output:
Running dot -Tpdf -o documents.pdf documents.dot
digraph "cfa" {
rankdir=LR;
size="8,8";
node...
2005 Dec 19
2
Difficulty using correct moldel for the data in DB
...ENT,
`name` VARCHAR(255) ,
`cat_id` INTEGER(11),
`rank` INTEGER ,
PRIMARY KEY(`id`)
);
CREATE TABLE `cats` (
`id` INTEGER(11) NOT NULL AUTO_INCREMENT,
`name` VARCHAR(255),
PRIMARY KEY(`id`)
);
CREATE TABLE `fusions` (
`id` INTEGER(11) NOT NULL AUTO_INCREMENT,
`item1_id` INTEGER(11),
`item2_id` INTEGER(11) ,
`product_id` INTEGER(11),
PRIMARY KEY(`id`)
);
Now... Creating one-to-many relationship for item/category is cake.
How do I set up my model for item and fusion so I can have something
like below in my view?
<% for fusion in @item.fusions %>
<%= fusion.item1.name %>...
2006 Apr 29
4
Event.observe mystery
.../div>'';
Event.observe(itemId, ''mouseover'',
this.onMouseOverHandler.bindAsEventListener(this), false);
}
I call my class in the following way:
var myMenu = new Menu();
myMenu.addItem(''item1'', ''Item 1'');
myMenu.addItem(''item2'', ''Item 2'');
myMenu.addItem(''item3'', ''Item 3'');
And here comes the mystery: only the last item (item3) triggers the
''onMouseOverHandler'' listener. When I remove item3, than it''s trigged by
item2 and so on...
2012 Mar 18
2
word frequency count
Hi:
I have a dataframe containing comma seperated group of words such as
milk,bread
bread,butter
beer,diaper
beer,diaper
milk,bread
beer,diaper
I want to output the frequency of occurrence of comma separated words
for each row and collapse duplicate rows, to make the output as shown
in the following dataframe:
milk,bread 2
bread,butter 1
beer,diaper 3
milk,bread 2
Thanks for help!
deb
2012 Sep 03
1
R suitability for development project
...e
interested in doing the coding.
I would like to preface my inquiry that while I am not a programmer I
can communicate in a dialog my objectives.
An array of rank ordered data looks like this:
Item-Rank First Second Third Fourth Totals
Item1 6 8 0 0 14
Item2 7 5 2 0 14
Item3 1 1 11 1 14
Item4 0 0 1 13 14
Totals 14 14 14 14
The required output of R will be two fold;
1, a numerical score for each of the Items (1-4) fr...
2006 Feb 22
15
Fixtures and Relationships
In my daily development, I migrate back and forth between versions, and
often do: rake load_fixtures...
... in order to populate my development database with fun data.
Now, with any HABTM relationship, there are failures, as there is no way to
say "which" fixtures to load first.
Within an actual functional or unit test case, you could simply load them in
the proper order, but
2012 Jan 09
3
as.numeric() generates NAs inside an apply call, but fine outside of it
...ather get to
the bottom of this if I can so I know for future.
Thanks in advance for any advice
Chris Beeley
Institute of Mental Health, UK
dput() gives-
structure(list(id = structure(1:79, label = structure("Participant", .Names = "id"), class = "labelled"),
item2.jan11 = structure(c(4L, 3L, 6L, 4L, 6L, 6L, 2L, 6L,
2L, 2L, 3L, 3L, 1L, 6L, 2L, 6L, 4L, 2L, 6L, 2L, 6L, 6L, 6L,
4L, 4L, 6L, 2L, 6L, 2L, 6L, 2L, 3L, 6L, 6L, 3L, 6L, 5L, 6L,
3L, 6L, 1L, 3L, 3L, 3L, 6L, 4L, 1L, 3L, 6L, 2L, 6L, 2L, 6L,
6L, 6L, 4L, 3L, 6L, 6L, 6L, 6L, 6L, 3L, 6L, 2L,...
2005 Dec 18
0
Difficulty with creatating a model
...name` VARCHAR(255) ,
`cat_id` INTEGER(11),
`rank` INTEGER ,
PRIMARY KEY(`id`)
);
CREATE TABLE `cats` (
`id` INTEGER(11) NOT NULL AUTO_INCREMENT,
`name` VARCHAR(255),
PRIMARY KEY(`id`)
);
CREATE TABLE `fusions` (
`id` INTEGER(11) NOT NULL AUTO_INCREMENT,
`item1_id` INTEGER(11),
`item2_id` INTEGER(11) ,
`product_id` INTEGER(11),
PRIMARY KEY(`id`)
);
Now... Creating one-to-many relationship for item/category is cake.
How do I set up my model for item and fusion so I can have something
like below in my view?
<% for fusion in @item.fusions %>
<%= fusion.item1.name %...
2009 Jun 16
0
Help implementing a simple Python port
...ut))
# calculated the weighted slope one estimate
pred.out[a]=sapply(a, function(i) {
sum(unlist(lapply(b,function (j) {
sum((d[j]+diffs[j,i])*freqs[j,i])/rowSums(freqs)[i] }))) })
names(pred.out)=colnames(tr.set)
return(pred.out) }
# end function
# test 1, using example from [1]
john=c(item1=5, item2=3, item3=2)
mark=c(item1=3, item2=4, item3=NA)
tr.set1=rbind(john,mark)
lucy1=c(item1=NA, item2=2, item3=5)
pred(tr.set1,lucy1) ## item1=4.33 --> correct
# test 2, using example from [2]
alice=c(squid=1.0, octopus=0.2, cuttlefish=0.5, nautilus=NA)
bob=c(squid=1.0, octopus=0.5, cuttlefish=NA,...
2007 Nov 25
1
Constructin a call of function including permutation of column names - how to escape parentheses?
Dear R-users,
I would like to construct a list of arguments for a function in a format
function (list(item1=c("A","B"), item2=c("B","C")), item3=...):
The individual vectors in the list are permutations of colnames of a
dataframe.
The trouble is that I am not able to handle escaping of parentheses
correctly.
I was trying the following:
library(gregmisc)
combinations.2<-combinations(12,2,mycolnames)...
2006 Jul 19
4
Wrap a loop inside a function
...o <- function(theta,items, score){
like.mat <- matrix(numeric(length(items) * length(theta)), ncol =
length(theta))
for(i in 1:length(items)) like.mat[i, ] <- pcm(theta, items[[i]],
score[[i]])
}
# begin example
theta <- c(-1,-.5,0,.5,1)
items <- list(item1 = c(0,1,2), item2 = c(0,1), item3 = c(0,1,2,3,4),
item4 = c(0,1))
score <- c(2,1,3,1)
(foo(theta, items, score))
# R output from function foo
[1] 0.8807971 0.8175745 0.7310586 0.6224593 0.5000000
However, what I am expecting from the function foo is
> like.mat
[,1] [,2] [,3]...
2006 Aug 06
2
help with method_missing in ActiveRecord
...veRecord::Base
serialize :data, FooData
def after_initialize
self.data = eval("#{self.class}Data.new") unless self.data
end
def method_missing(method_name, *args)
self.data.send "#{method_name}(#{args})"
super
end
end
class FooData
attr_accessor item1, item2
end
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://wrath.rubyonrails.org/pipermail/rails/attachments/20060806/88f376b0/attachment.html