Displaying 20 results from an estimated 400 matches similar to: "Cannot get simple data.frame binding."
2006 Aug 08
2
Getting data out of a loop
A stupid question but I just cannot see how to do
this.
I have a loop that does some calculations and puts the
results in a vector for each iteration, but I cannot
see how to get the data out of the loop in such a way
that I can use it. I can print it but how do I get it
into a set of vectors or what ever.
Any help gratefully received. Thanks
Example
cata <- c( 3,5,6,8,0, NA)
catb <-
2007 Feb 02
1
Assigning labels to a list created with apply
I have a simple data base and I want to produce tables
for each variable. I wrote a simple function
fn1 <- function(x) {table(x)} where x is a matrix or
data.frame. and used apply to produce a list of
tables. Example below.
How do I apply the colnames from the matrix or names
from the data.frame to label the tables in the results
in the list. I know that I can do this individually
but
2007 Feb 07
6
setting a number of values to NA over a data.frame.
This is probably a simple problem but I don't see a
solution.
I have a data.frame with a number of columns where I
would like 0 <- NA
thus I have df1[,144:157] <- NA if df1[, 144: 157] ==0
and df1[, 190:198] <- NA if df1[, 190:198] ==0
but I cannot figure out a way do this.
cata <- c( 1,1,6,1,1,NA)
catb <- c( 1,2,3,4,5,6)
doga <- c(3,5,3,6,4, 0)
dogb <- c(2,4,6,8,10,
2009 Sep 19
1
Re-order columns
Dear R'sians,
Would really appreciate if you could suggest a more efficient way to order
the columns of a dataset. The column names of the dataset contain indices
separated by a period. Following are examples of my code and the dataset.
oC <- function(tg=x2) {
lth <- length(grep("T",names(tg)))
thix <-
2006 Aug 07
0
Trying to do aseries of subsets with function or for loop
I want to calculate the "scat" etc, values for each
level of id, output a vector of these values that is
a <- c(scat, sdog, srat, sbat ) and do an rbind on
them. Each level of id has a different value of
rate.
So far it it looks to me like I can do this by a
series of repeated subsets of Df butI would think that
I should be able to do this with a function but I am
not
having
2012 Mar 08
6
how to modify the tickment of x-axis
hi
I plot a series of observation data every minutes in a day as the
attachment below
plot(wnd,type='l',lty=1,col='red',lwd=1,xlab=xxlab,ylab=yylab,ylim=YY)
In the figure, the x-axis tickment is the number of data How can I change
it
fore example 1h 2h 3h 4h and so on ?
--
TANG Jie
Email: totangjie at gmail.com
Tel: 0086-2154896104
Shanghai Typhoon Institute,China
2011 Jan 13
0
Help with Data Transformation - RESOLVED
Hi Dennis,
SOLVED!!!
My thanks to both you, John, and others who chimed in. Took a little more digging before finally working, but it is working!
Here's a little more of what I did and the ultimate resolutions:
I installed the reshape2 library from CRAN.
Executed
> (.packages())
[1] "reshape2" "stats" "graphics" "grDevices"
2007 Mar 09
1
Applying some equations over all unique combinations of 4 variables
#I have a data set that looks like this. A bit more
complicated actually with
# three factor levels but these calculations need to
be done on one factor at a
#I then have a set of different rates that are applied
#to it.
#dataset
cata <- c( 1,1,6,1,1,2)
catb <- c( 1,2,3,4,5,6)
doga <- c(3,5,3,6,4, 0)
data1 <- data.frame(cata, catb, doga)
rm(cata,catb,doga)
data1
# start rates
#
2006 Aug 17
1
MAC to Windows 2003
Where do I find a version of Samba that will work on Windows 2003?
I would be happy to test a bata version of one was available.
I need to connect new MAC G5's to a Windows 2003 server for file sharing and
storage.
Thank you for your help.
Danny Martin
Instructional Designer
912-353-5277
2001 Jul 04
1
Ogg Vorbis ripping/encoding on Windows
I think the new web page is wonderful. However, one thing annoyed me.
Some programs on 'Other Software Which Supports Ogg Vorbis' page at
Vorbis.com seems to be bit problematic. As far as I know, at least two
of them have not updated their plug-ins for a while.
1. 'CD-DA X-Tractor' vorbenc-20001018.zip as 'Latest released version
of vorb_enc.dll'
2. 'Media
2013 Jan 10
1
merging command
HI Eliza,
You could do this:
set.seed(15)
mat1<-matrix(sample(1:800,124*12,replace=TRUE),nrow=12) # smaller dataset
#Your codes
?list1<-list()
?for(i in 1:ncol(mat1)){
? list1[[i]]<-t(apply(mat1,1,function(x) x[i]-x))
? list1}
?x<-list1??
x<-matrix(unlist(x),nrow=12)
x<-abs(x)
?y<-colSums(x, na.rm=FALSE)
z<-matrix(y,ncol=10)
?z<-as.dist(z)
?z
?# ?? 1?? 2?? 3?? 4?? 5??
2007 Jun 28
3
Function call within a function.
I am trying to call a funtion within another function
and I clearly am misunderstanding what I should do.
Below is a simple example.
I know lstfun works on its own but I cannot seem to
figure out how to get it to work within ukn. Basically
I need to create the variable "nts". I have probably
missed something simple in the Intro or FAQ.
Any help would be much appreciated.
EXAMPLE
2006 Jul 01
1
Uh oh, Error solving...
undefined method `stringify_keys'' for [["Craved"], ["Whole Sale"]]:Array
I did this earler in the script how come now it''s yealling?
<% catas = Category.find(:all, :order=> "name").map {|u| [u.name]} -%>
<p><label for="item_cata">Catagory:</label><br/>
<%= select ''item'',
2011 May 29
22
[Bug 8177] New: Problems with big sparsed files
https://bugzilla.samba.org/show_bug.cgi?id=8177
Summary: Problems with big sparsed files
Product: rsync
Version: 3.0.8
Platform: x64
OS/Version: Linux
Status: NEW
Severity: normal
Priority: P5
Component: core
AssignedTo: wayned at samba.org
ReportedBy: joluinfante at gmail.com
2013 Mar 30
3
how to draw the math graph?
how can i draw the graph in R?
2012 Oct 05
3
loop for column substraction of a matrix
Dear useRs,
I have a matrix with 38 columns and 365 rows. what i want to do is the following.....
1. subtracting from each column, first itself and then all the remaining columns. More precisely, from column number 1, i will first subtract itself(column 1) and then the remaining 37 columns. Afterwards i will take column number 2 and do the same. In this way i want to proceed till 38th column.
2009 Mar 29
1
Data decomposition
Hi R users,
I have a time series variable that is only available at a monthly level for
1 years that I need to decompose to a weekly time series level - can
anyone recommend a R function that I can use to decompose this series?
eg. if month1 = 1200 I would to decompose so that the sum of the weeks for
month1 equals 1200, etc..
Many thanks in advance for any help.
--
View this message in
2013 Dec 15
1
Rows to Column
Hi all,
I'm kinda new in R programming and I need some help preparing a database to
run logistic regression.
I have data in a tuple form:
*id cat val*
1 A 2
1 C 4
3 B 1
5 A 2
6 A 3
6 B 5
6 C 2
8 B 5
8 D 2
9 D 3
and would like to have it like:
*id catA catB catC catD*
1 2 0 4 0
3 0 1 0 0
5 2 0 0 0
6 3
2013 Apr 12
2
processing matrix equation derived from rows of two matrices
Hi,
May be this helps:
?tb[1,]%*%(((val-rep(meansb79[1,],5))^2)/6)
#??????? [,1]
#[1,] 1.47619
tryvarb<-c(1,2,3,4,4,4,4)
?var(tryvarb)
#[1] 1.47619
tb[2,]%*%(((val-rep(meansb79[2,],5))^2)/6)
#???????? [,1]
#[1,] 1.904762
sapply(seq_len(nrow(tb)),function(i) tb[i,]%*%(((val-rep(meansb79[i,],5))^2/6)))
# [1] 1.4761905 1.9047619 1.9047619 1.9047619 1.9047619 2.2857143 1.9047619
# [8] 1.9047619
2012 Dec 05
3
data manipulation between vector and matrix
Dear list,
I was curious how to subtract a vector from matrix?
Say, I have
mat <- matrix(1:40, nrow=20, ncol=2)
x <-c(1,2)
I want,
x-mat[1,] and x-mat[2,], and so on... Basically, subtract column elements
of x against column elements in mat.
But x-mat won't do it.
Thanks,
Mike
[[alternative HTML version deleted]]