similar to: data.frame manipulation: Unbinding strings in a row

Displaying 20 results from an estimated 1000 matches similar to: "data.frame manipulation: Unbinding strings in a row"

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,
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
2006 Feb 27
4
Getting nuts with sortables...
Folks, It has been a whole day spent on this but I still can''t get my mind around the most probably very stupid/basic mistake here... First, the code I use: <h3>List A</h3> <ul id="lista" > <li id="item1"> Item 1</li> <li id="item2"> Item 2</li> <li id="item3"> Item 3</li> </ul>
2006 Jul 20
2
Timing benefits of mapply() vs. for loop was: Wrap a loop inside a function
List: Thank you for the replies to my post yesterday. Gabor and Phil also gave useful replies on how to improve the function by relying on mapply rather than the explicit for loop. In general, I try and use the family of apply functions rather than the looping constructs such as for, while etc as a matter of practice. However, it seems the mapply function in this case is slower (in terms of CPU
2012 Sep 03
1
R suitability for development project
Hello All, Eric Langley here with my first post to this list. I am looking to determine if R is suitable for a development project I am working on and if so possibly finding someone proficient in R that would be 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
2004 Jun 08
2
Recoding a multiple response question into a series of 1, 0 variables
Hello R folks. 1) The question that generated the data, which I call Qx: Which of the following 5 items have you performed in the past month? (multipe response) 2) How the data is coded in my current dataframe: The first item that a person selected is coded under a field called Qxfirst; the second selected under Qxsecond, etc. For the first Person, the NAs mean that that person only selected
2013 Feb 26
2
Converting code to R Question
I'm learning R and am converting some code from SPSS into R. My background is in SAS/SPSS so the vectorization is new to me and I'm trying to learn how to NOT use loops...or use them sparingly. I'm wondering what the most efficient to tackle a problem I'm working on is. Below is an example piece of code. Essentially what it does is set a variable to zero, loop through item
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)
2006 Jul 19
4
Wrap a loop inside a function
I need to wrap a loop inside a function and am having a small bit of difficulty getting the results I need. Below is a replicable example. # define functions pcm <- function(theta,d,score){ exp(rowSums(outer(theta,d[1:score],'-')))/ apply(exp(apply(outer(theta,d, '-'), 1, cumsum)), 2, sum) } foo <- function(theta,items, score){ like.mat <-
2013 Mar 21
1
Error Message During ANOVA
I am teaching myself R for use in Psych research. I don'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 >
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
2011 Aug 21
1
rank analysis - reinventing the wheel?
Hello, I have two data frames. One is my dependent variable and the other is my independent variable. For each row I'd like to split the independent variable into fractiles (25 or more) and calculate the average value of the dependent variable. Then I would like to plot the average of the averages for each row for each fractile. If possible, I'd like to have the option to 1) define the
2007 May 14
2
Left/right hand side characters
Hello all Is there a way reducing the number of characters in a list so that just the left n numbers of characters is given? For example, If I have a list, listnames, which consists of 4 strings of 6 characters; >listnames [1] "item12" "item34" "item56" "item78" Is there a way to reduce this so only the 5 characters on the lefthand side are
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 =
2009 Nov 29
1
optim or nlminb for minimization, which to believe?
I have constructed the function mml2 (below) based on the likelihood function described in the minimal latex I have pasted below for anyone who wants to look at it. This function finds parameter estimates for a basic Rasch (IRT) model. Using the function without the gradient, using either nlminb or optim returns the correct parameter estimates and, in the case of optim, the correct standard
2006 Apr 29
4
Event.observe mystery
Hi, I have a class ''Menu'' with a method ''addItem''. The method (simplified) looks like this: addItem: function(itemId, text) { this.container.innerHTML += ''<div id="''+itemId+''">''+text+''</div>''; Event.observe(itemId, ''mouseover'',
2005 Jan 31
1
naming list elements
All - Each time through a loop I create a new dataset, which I would like to append to a list object. Each item of the list should be the data matrix created in that step of the loop; I would like the NAME (or tag) of that list item to be assigned the value of a character string: I've tried something like this: running.list <- numeric(0) for(i in 1:num.files){ ..... running.list
2009 Mar 07
4
merge data frames with same column names of different lengths and missing values
Hello, I'm switching over from SAS to R and am having trouble merging data frames. The data frames have several columns with the same name, and each has a different number of rows. Some of the values are missing from cells with the same column names in each data frame. I had hoped that when I merged the dataframes, every column with the same name would be merged, with the value in a complete
2012 May 29
1
model frame and formula mismatch with latent class analysis poLCA
Dear R-users, I keep getting an ERROR saying " Error in model.matrix.default(formula, mframe) : model frame and formula mismatch in model.matrix() " when i fit poLCA with more than 63 variables. Below are the details. I am trying to do a Latent Class Analysis using poLCA. My data set contains binary scores of, for instance, 200 students on 100 items. These numbers could even be more
2010 Jun 06
1
Why did TukeyHSD not work when I used it for post-hoc for 2way within-subjects anova?
Dear R people, I have a couple of questions about post-doc analyses for 2 by 2 within subjects ANOVA. I conducted a psycholinguistic study that combined a 2 by 2 design and a latin square design. Specifically, I had 32 items each of which generated 4 conditions. Participants saw each of the 32 items only once: 8 in Condition A, 8 in B, 8 in C, and 8 in D. The table below serves as an example.