similar to: how to make list() return a list of *named* elements

Displaying 20 results from an estimated 600 matches similar to: "how to make list() return a list of *named* elements"

2012 Feb 25
5
which is the fastest way to make data.frame out of a three-dimensional array?
foo <- rnorm(30*34*12) dim(foo) <- c(30, 34, 12) I want to make a data.frame out of this three-dimensional array. Each dimension will be a variabel (column) in the data.frame. I know how this can be done in a very slow way using for loops, like this: x <- rep(seq(from = 1, to = 30), 34) y <- as.vector(sapply(1:34, function(x) {rep(x, 30)})) month <- as.vector(sapply(1:12,
2007 Nov 01
2
ploting a comparison of two scores, including the labels in the plot
Hello r-help! I have data with two kind of ratings on status of 100 occupations. The first kind of rating is on the percieved "objective" status that these occupations have in society at large, and the second kind or rating is on the status that the respondents think that these occuption *should* have. The ratings were originally integer values in the rage 1-9, but in the current data,
2009 Apr 29
3
how to word-wrap text in labels in plots?
c <- structure(c(2L, 2L, 1L, 3L, 4L, 2L, 3L, 2L, 3L, 2L, 5L), .Label = c("foo", + "bar", "a really really long variable label mostly here to show the need of word-wrapping text in labels", + "a not so important value", "baz"), class = "factor") plot(c) Is there a way to get the long variable labels to automatically wrap so that all
2010 Apr 29
2
getting random integers
I want 100 integers. Each integer, x, can be in the range 1 =< x => 10. Does the following code give 1 and 10 the same chances to be selected as 2:8? round(runif(100, min = 1, max = 10)) -- Hans Ekbrand -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 197 bytes Desc: Digital signature URL:
2009 Apr 08
1
Student
Hi, I have problem. In the function below (test and test2) i want the function test not to print the variable data but i want the function test2 to use the variable test$data. This is the creation of the variable data: > matrice=c(1:10) > matrice=matrix(matrice,nrow=5,ncol=2) This is the function test: > test=function(data){ + return(list(x=5,data=data)) + } This is the function
2008 Mar 03
3
Plot using colors
Dear R users, I have a problem since I try to plot my datas with different colors. plot(tvar, var, xlab="zeit [s]",ylab="Variation [%]", col = ifelse(var <= varstability, 'green','red')) this works well! But since I add a type="l" to my plot, it will color all the plot with green!!! Is there any solution? I avoid to use teachingDemos. Thanks. --
2012 Mar 10
3
function input as variable name (deparse/quote/paste) ??
Hi all Say I have a function: myname=function(dat,x=5,y=6){ res<<-x+y-dat } for various input such as myname(dat1) myname(dat2) myname(dat3) myname(dat4) myname(dat5) how should I modify the 'res' line, to have new informative variable name correspondingly, such as dat1.res dat2.res dat3.res dat4.res dat5.res stored in the workspace. This is only an example of a complex
2012 Mar 10
2
Issues in installing rgl in Mac OS 10.6.8
Dear All, I am trying to install rgl on my mac notebook from the source file. I tried using: /usr/bin/R64 CMD INSTALL rgl_0.92.798.tar.gz and get the following error message: checking for X... no configure: error: X11 not found but required, configure aborted. ERROR: configuration failed for package ?rgl? * removing ?/Library/Frameworks/R.framework/Versions/2.14/Resources/library/rgl? *
2012 Mar 02
3
speed up merge
Hello, I have a nasty loop that I have to do 11877 times. The only thing that slows it down really is this merge: xx1 = merge(dt,ua_rd,by.x=1,by.y= 'rt_date',all.x=T) Any ideas on how to speed it up? The output can't change materially (it works), but I'd like it to go faster. I'm looking at getting around the loop (not shown), but I'm trying to speed up the merge first.
2008 Feb 19
3
simple usage of "for"
Hi list I have a data frame I would like to loop over. To begin with I would like crosstabulations using the first variabel in the data frame, which is called "meriter". > table(meriter[[1]], meriter[[3]]) ja nej Annan 0
2009 Feb 17
1
frequency table for multiple variables
Hi r-help! Consider the following data-frame: var1 var2 var3 1 3 1 4 2 2 2 3 3 2 2 3 4 4 4 NA 5 4 3 5 6 2 2 3 7 3 4 3 How can I get R to convert this into the following? Value 1 2 3 4 5 var1 0 3 2 2 0 var2 1 3 1 2 0 var3 0 0 4 1 1 TIA, -- Hans Ekbrand (http://sociologi.cjb.net) <hans at
2009 Apr 08
1
read.spss, locale and encodings
I must be missing something obvious here: According to the help page for read.spss, the reencode option is only active when R is run under a UTF-8 locale. read.spss can only import the SPSS file when run under a iso88591(5) locale, under a UTF-8 locale I get: Error in read.spss("wo.sav") : error reading system-file header In addition: Warning message: In read.spss("wo.sav")
2011 Mar 31
1
Cluster analysis, factor variables, large data set
Dear R helpers, I have a large data set with 36 variables and about 50.000 cases. The variabels represent labour market status during 36 months, there are 8 different variable values (e.g. Full-time Employment, Student,...) Only cases with at least one change in labour market status is included in the data set. To analyse sub sets of the data, I have used daisy in the cluster-package to create
2011 Aug 09
1
need your consult
Dear Sir/Madam Hi. I am a general paediatrician, and I have read *some* chapters of the following books(1-3). I think SPSS lacks some features that may be important in data analysis (for example: interval of correlation coefficient in bivariate normal distribution, PRESS, and MSPR in cross-validation). I am thinking about changing SPSS to R: 1. SPSS is very expensive for me to update.
2012 Mar 09
2
How do I force confint() for glm() to be quiet?
I need confint() for glm() to supress the messages "Waiting for profiling to be done..." because they mess up the caching mechanism of pgfSweave (see https://github.com/cameronbracken/pgfSweave/issues/40). I have read the help page of confint(), but I do not know how to get the help page for the glm() version, if any such help page exists. Is there a general way of turning of output
2009 Apr 07
0
Converting a whole dataframe (including attributes) from latin1 to UTF-8
Hi list! Short version: How do I convert a whole data.frame from latin1 encoding to utf8? I get SPSS files with latin1 encoding. My OS is GNU/Linux and the locale sv_SE.utf8, and I normally interface R with Emacs/ESS. I have used the following hack to convert a data.frame in latin1 to utf8: > Sys.setlocale(category = "LC_ALL", locale = "sv_SE.iso88591") > foo <-
2010 Aug 16
1
need of elegant data manipulation
Dear R users, I seek for a more elegant manner to manipulate my data that that I produced so far. Data is in a data frame THC515.DATA -sample at the end of this mail- of 5 variables, a string and 4 continuous numeric variables. I need to get the mean of two variables "Q" and "T" at the levels of a third one "dP", individually for each level of "n". I
2006 Jan 28
4
Unspecified error in prototype.js
Hi, 1. I have 2 panes, each having approximately 45-50 slides, all the slide images are 110x82 pixels in size, enclosed in their respective div''s. 2. These divs are further enclosed in a parent div, which is defined as a Sortable on page load. 3. There is a destination div on the RHS also. Sortable.create("div_leftDiv", {ghosting:true, revert: true, dropOnEmpty:true,
2006 Feb 01
2
IE memory fix leak.
By default the prototype.js gives us the function /* prevent memory leaks in IE */ Event.observe(window, ''unload'', Event.unloadCache, false); But there is no unload event in out application as the content of the div keeps changing using the Ajax.Updater function. To handle such a scenario, we''ve added the following lines of code to prototype.js /* prevent
2007 Nov 28
6
How to create data frame from data with unequal length
Hi, I have two sets of data that I would like to put into a data frame. But since they have different length, I am not sure how to do this. Here is an example of my data: data set one: date growth 1/1/2007 10 1/2/2007 10.2 1/3/2007 10.4 1/4/2007 10.6 data set two: date growth 1/1/2007 22 1/2/2007 22.5 1/4/2007 22.4 I would like to combine the two data sets and