similar to: How to pass objects from local() to GlobalEnv

Displaying 20 results from an estimated 40000 matches similar to: "How to pass objects from local() to GlobalEnv"

2010 Apr 08
1
how to manipulate object in specific environment?
Hi I want to simplify my problem into a prototype, how to write a function to get all the object in your current environment, e.g. .GlobalEnv, and print their mode? For example, if I have object a,b,c... in my environment, a=1;b='test';c=matrix(0,3,3)..... I want to write a function myfun(), when I run myfun(), this retrieve all the objects in my environment automatically and print
2008 Mar 04
3
creating a matrix subset based on a threshold cutoff
Hi, I have a table of x rows and y columns. The table is huge and so i'd like to create a subset of the data containing rows where any of the y values are below a threshold, say 1e-4. Is there a simple way of doing this in R? thanks Rich
2009 Sep 28
4
How to assess object names within a function in lapply or l_ply?
Dear All, to produce output of several columns of a data frame, I tried to use lapply and also l_ply. In both cases, I would like to print a header line containing also the name of the respective column in the data frame. For example, I would like the following lapply(data.frame(a=1:3, b=2:4), function(x) print(deparse(substitute(x)))) to produce: [1] "a" [1] "b" and
2008 Feb 22
3
Problem with cut
Hi All, I might misunderstood how cut works. But following behaviour surprises me. vv <- seq(150, 346, by= 4) cc <- cut(vv, 12) cc[vv == 330] Results [1] (330,346] I would have expected 330 to fall into (313,330] category. Can you please advice what do I do wrong? Many Thanks, Jussi Lehto -------------- next part -------------- Visit our website at http://www.ubs.com This message
2008 Feb 29
4
help
Dear Sir/Madam, I got some problem about using R. I am a student, and need to use R a lot. But sometimes when I am working in computer lab, we can not install some particular pacakges by ourselves because of the previliges. Can the folder of Librabry of R, move to, for instance the personal folder, my documents... then we can install any specified package? Best regards,
2008 Mar 07
3
Combine two columns
Is there a way to combine two columns within a data frame? Example data: id snp AL1 AL2 1500 30 A B 1510 30 A A 1520 30 A B This is what I would like: indv snp AL1AL2 1500 30 AB 1510 30 AA 1520 30 AB Any help is greatly appreciated. Alysta
2010 Mar 22
2
Factors attribute?
I noticed that when I fit a linear model using 'lm' there is an attribute called "factors" that is added to the "term". It doesn't seem to appear for 'model.matrix', just 'lm'. I have been unable to find where it gets constructed or what it means? It looks like a two dimensional array that I may be able to use so I would just like to get some
2008 Jan 14
2
Permutations of variables in a dataframe
Hallo All, I would like to apply a function to all permutations of variables in a dataframe (except the first). What is the best way to achieve this? I produce the permutations using: nvar <- ncol(dat) - 1 perms <- as.matrix( expand.grid(rep( list(1:0) , nvar ))[ , nvar:1] ) Thanks in advance Serguei Test-dataframe, comma-delimited: code,wav,w,area,gdp,def,pop,coast,milspend,agr
2011 Mar 15
5
Does R have a "const object"?
Hi, all, Does R have a "const object" concept like which is in C++ language? I want to set some data frames as constant to avoid being modified unintentionally. Thanks! xiagao1982 2011-03-15 [[alternative HTML version deleted]]
2009 Sep 28
2
creating vectors from a list
Hi guys, I have a list of 250 numbers as a result of using the ?by function! List of 246  $ 0   : num [1:28] 22 11 31...  $ 1   : num [1:15] 12 14 9 ... .. .. ..  - attr(*, "dim")= int 250  - attr(*, "dimnames")=List of 1 The problem is that each list of 250 has different length! I would like to get the values of each list in a vector like vector_0 = (22,11,31,..), is this
2008 Aug 07
3
Downloading Yahoo data
Hi R, I am trying to download the data from R. I give the below command. > library(fImport) > yahooSeries("IBM") trying URL 'http://chart.yahoo.com/table.csv?s=IBM&a=7&b=08&c=2007&d=7&e=07&f=2008& g=d&x=.csv' Error in download.file(url = url, destfile = file, method = method) : cannot open URL
2010 Nov 07
2
stupid R tricks
Hi all, Just thought I'd post this (maybe) helpful tool I wrote. For people like me who are bad at keeping a clean environment, it's a time-saver. #simple command to get only one type of object in current environment lstype<-function(type='closure'){ inlist<-ls(.GlobalEnv) if (type=='function') type <-'closure'
2008 May 14
2
Dividing Two Dataframes
Hi, I have two dataframes one with 144 rows and 160 columns (SDF1) and one with 12 rows and 160 columns (SDF2). Now I'm trying to divide rows 1:12 with SDF2, rows 13:24 with SDF2, rows 25:36 with SDF 2, . In S-Plus the following code works fine: DFS = SDF1[1:144,1:60] / as.vector(SDF2[1:12,1:160]) but in R when I try to implement the formula I get the following error: "/
2008 Mar 24
6
vlookup in R
Hi, Is there are function similar to excel vlookup in R. Please let me know. Thanks, Sachin ____________________________________________________________________________________ [[alternative HTML version deleted]]
2008 Feb 06
1
filling data into objects
I am trying to generate artificial data for feature selection. Basically trying to generate a total of 1000 features with 100 that are informative and rest are uninformative. Informative.data.class1<-rnorm(100,0.25,1) Uninformative.data.class1<-rnorm(900,0,1) Informative.data.class2<-rnorm(100, -0.25,1) Uninformative.data.class2<-rnorm(900,0,1) The above will give me one set of data
2010 Jan 11
5
R for windows 64 bit
Dear all, do you know if there is any particular version of R to implement with windows 64 bit, in such a way to increase the amount of memory it can use? How should I increase the memory, and more importantly to set a higher max vector size? It still stops me saying "Could not allocate vector of size 145" thanks to all alessia
2011 Feb 02
1
Flexibly Retrieving Objects with an Index
Greetings, I would like to flexibly combine several data frames objects without specifying the exact names of the objects in memory. Should I use indexing to call those objects out of memory? I regularly use indexes to flexibly extract parts of data frames and lists and to read files from my hard drive, but I can't figure out how to do so with stored objects. In my case, all of the data
2009 Oct 08
4
external variable by inside-function routines modifications
Dear all, could you please advice whether it is possible somehow to modify an external (from the point of some function view) variable by some function-internal operators. For example > var=1 > foo<-function(var){var=var+1} > foo(var) > var [1] 1 but the goal is to get the var equal to 2 in this specific case. Thanks! -- View this message in context:
2011 Apr 07
2
Regrouping data
Dear R forum I have just started my venture with R. While I am trying to learn R through the tutorials, I think the current problem I need to address to is beyond my knowledge about R. I have a dataframe as defined below - rat_dat = data.frame(name = c("A", "A", "A", "B", "B", "B", "C", "C", "C",
2008 Apr 08
3
simple graphing question
#copy and paste this into R f <- (structure(list(TKN = c(0.103011025, 0.018633208, 0.104235702, 0.074537363, 0.138286096), RM = c(215, 198, 148, 119, 61)), .Names = c("TKN", "RM"), class = "data.frame", row.names = 25:29)) plot(f$TKN~f$RM, type="b") I would like to reverse the X-Axis. How do I do this? -- Let's not spend our time and resources