Displaying 20 results from an estimated 3000 matches similar to: "replicate rows"
2011 May 02
2
how to get row name using the which function
Dear All,
Probably a very basic question, but can't seem to work my way around it.
I want to which row has the maximum value. But what if the row names do not correspond with the row numbers. In the example below, you'll see that the max of example is row 4, but the name of row 4 is "9". How do I get R to return "9" as value, instead of 4.
example <-
2012 Jun 15
3
moving from loops to apply
Dear subscribers,
I have made a simulation using loops rather than apply, simply because the loop function seems more natural to me. However, the current simulation takes forever and I have decided - finally - to learn how to use apply, but - as many other people before me - I am having a hard time changing habits. My current problem is:
My current code for the loop is:
distances <-
2009 Sep 04
1
Redblack tree data structure
I need to use a red-black tree, which package provides that data structure?
--
Best regards
Rune Schjellerup Philosof
Ph.d-stipendiat, Forskningsenheden for Biostatistik
Telefon: 6550 3607
E-mail: rphilosof at health.sdu.dk
Adresse: J.B. Winsl?wsvej 9, 5000 Odense C
SYDDANSK UNIVERSITET
_______________________________________________________________
* Campusvej 55 * 5230 * Odense M * 6550
2009 Dec 07
2
outputting functions in lapply
How come the k is 3 in all of this output?
I expected it to be equal to r.
> tmp3 <- lapply(1:3, function(k) function(r) print(paste(r, "<- r | k
->", k)))
> for (i in 1:3) { tmp3[[i]](i) }
[1] "1 <- r | k -> 3"
[1] "2 <- r | k -> 3"
[1] "3 <- r | k -> 3"
--
Med venlig hilsen
Rune Schjellerup Philosof
Ph.d-stipendiat,
2010 Mar 12
1
Creating named lists
I often find myself making lists similar to this
list(var1=var1, var2=var2)
It doesn't seem list has an option, to make it use the name of the
variable as name in the list.
Is there another function that does this?
--
Med venlig hilsen
Rune Schjellerup Philosof
Ph.d-stipendiat, Forskningsenheden for Biostatistik
Telefon: 6550 3607
E-mail: rphilosof at health.sdu.dk
Adresse: J.B.
2006 Aug 09
2
Gruff gives font-related error
Hello Railslist,
I''m trying to get Gruff running on OSX Tiger (intel) with edge Rails.
I''ve installed ImageMagick, Rmagick, FreeType and all their
dependencies, or so I believe. (I''ve compiled them from source mostly,
following a recent tutorial for Rails and ImageMagick on Intel Macs)
While following the sample on the Gruff downloadpage (the one with the
fruit), Rails
2011 Dec 05
1
Toggle cASE
Hello R-help list,
I am looking for way to toggle the case of the characters like a flip-flop; that is from ''Hello'' to "hELLO" or vice versa.
I know that there are a number of functions like casefold, tolower, toupper, etc. but these functions change the case in an uniform way.
Thanks in advance,
Antonio Rivero Ostoic
Antonio Rivero Ostoic
PhD Student,
2009 Jan 08
1
NAs are not allowed in subscripted assignments
Browse[1]> j <- c(1,2,NA)
Browse[1]> j[j==1][-1]
[1] NA
Browse[1]> j[j==1][-2]
[1] 1
Browse[1]> j[j==1][-2] <- 2
Error during wrapup: NAs are not allowed in subscripted assignments
As far as I can see, I have no NA in the lhs (not after the second
subscript anyway).
Besides, I have a single value on the rhs, so it should be allowed to
have NAs in the lhs, according to
2004 Jul 06
4
not updating changed local files
rsync version 2.4.6 protocol version 24
gin@rhysling:~> rsync -avv ~/share/cvs-xemacs-head/XEmacs/xemacsweb ~/share/public_html/xemacsweb
building file list ... done
...
xemacsweb/About/XEmacsServices.content is uptodate
...
gin@rhysling:~> ls -l {~/share/cvs-xemacs-head/XEmacs/xemacsweb,~/share/public_html/xemacsweb}/About/XEmacsServices.content
-rw-r--r-- 1 gin sdu
2011 Jun 08
1
R command window
Hello.
I'm a visually impaired statistician, working at the National Institute of Public Health in Denmark.
I would like to use R for some analysis and have succesfully installed version 2.13.0 on my Windows XP labtop.
I then would like to run R interactively but unfortunately the textfont of the command line in the R window is very hard for me to read. I use a special program called
2011 Feb 23
1
Weighted Mean By Factor Using "BY"
Hello R folks,
Reproducible code below - I'm trying to do a weighted mean by a factor and
can't figure it out. Thanks in advance for your assistance.
Mike
data<-data.frame(c(5,5,1,1,1),
c(10,8,9,5,3),
c("A","A","A","B","B"))
2006 May 24
4
AR foreign key problem.
Hello Railslist,
(I''m using RadRails 0.6.3 on Windows XP with Ruby 1.8.4, Rails 1.1 and SQLite3)
I have two tables in the database: "locations" and "customers":
customers.sql
---
id INT PRIMARY KEY
name VARCHAR 255
address VARCHAR 255
postal_code VARCHAR 255
city VARCHAR 255
---
locations.sql
---
id INT PRIMARY KEY
postal_code TEXT
longitude FLOAT
latitude FLOAT
2006 Dec 21
2
data -> data matrix that can be used in regressions
Dear R users,
I have spent most of this day figuring out how to read STATA data into R
(which eventually worked) and to run a simple OLS regression. It seems
that the manuals are written in the most general and abstract way which
does not really make it easy to understand what's going on.
I'd be glad if somebody could save my day by:
telling me how to define a matrix from the
2004 Jul 08
3
How to pass strings to functions? [once once more, now With content I hope...]
Dear expeRts,
I fail to succesfully pass strings to functions. It comes down to the
observation that
> plot(someVariable,anotherVariable)
works fine, but
> x <- "someVariable"
> y <- "anotherVariable"
> plot(x,y)
does not.
Does this have something to do with the returned value of x being
/"someVariable"/ and not /someVariable/, i.e.
2006 Nov 04
1
acts_as_tree repeats
Hello Railslist,
I want to draw a simple single-table Acts_as_tree model.
I''ve read some articles about it and read the API docs, and now I''ve
got this running:
in controller I have:
---
def index
@pages = Page.find(:all)
end
---
in the model for Page I have ofcourse:
---
acts_as_tree :order => "position"
---
in the helper I have;
---
def
2008 Jul 16
6
vlans+bonding+bridging
hi,
I have to configure Xen server and DomU''s which should be able
to talk to different vlans - depending on services put on DomU''s.
I would like to enslave 2 NICs via bond interface.
Both NICs are on trunk ports which are configured in the same way, the
same native vlan.
I don''t know, if I have to add vlans tagging to eth* interfaces then
enslave tagged eth*
2011 Feb 03
3
R Data Manipulation - Transposing Data by a Given Column, Like User_ID
Hello,
I'd like to transpose data to create an analysis-friendly dataframe. See
below for an example, I was unable to use t(x) and I couldn't find a
function with options like PROC TRANSPOSE in SAS.
The ideal solution handles variable quantities of SITE - but beggars can't
be choosers. :-)
Thank you in advance,
Mike
## INPUT DATA
USER_ID<-c(1,1,1,2,2,2,3,3,4)
SITE
2008 May 30
1
-4 / -ipv4 doesn't work
Hi,
I try to connect to a host that has IPv4 and IPv6, but IPv6 is currently
blocked by ACL's. My host also has IPv6 and IPv4. When I pass the -4 or
--ipv4 option to rsync, it doesn't pass it to ssh:
$ rsync -4 -r -v -v -v -v -l --del . SOMEUSER@SOMEHOST:SOMEPATH
cmd= machine=SOMEHOST user=SOMEUSER path=SOMEPATH
cmd[0]=ssh cmd[1]=-l cmd[2]=SOMEUSER cmd[3]=SOMEHOST cmd[4]=rsync
2006 Jul 12
2
(Re-)designing a CMS
Hello Rails-list,
I''m working on a CMS in Rails.
The company that I work for currently uses a CMS written in PHP, and I
want to mimick it in Rails, and improve along the way.
The PHP variant works with templates like this:
In the root of the webdir, there are the template files, named
cms_news.html for example.
This page contains custom tags, in the form of definitions and
2005 Dec 16
6
Switchtower for production?
Hello,
The company that I work for will be developing a large webbased survey
(for a government institution) somewhere in Q1/Q2 of 2006. I''m
investigating the technological possibilities and Rails is certainly a
candidate. The survey application will have to perform under very high
peak load, and the exact specifications of the hardware are not known
at this point. I''m assuming