similar to: Change global env variables from within a function

Displaying 20 results from an estimated 1000 matches similar to: "Change global env variables from within a function"

2010 Oct 15
0
nomianl response model
Is there a way to estimate a nominal response model? To be more specific let's say I want to calibrate: \pi_{v}(\theta_j)=\frac{e^{\xi_{v}+\lambda_{v}\theta_j}}{\sum_{h=1}^m e^{\xi_{h}+\lambda_{h}\theta_j}} Where $\theta_j$ is a the dependent variable and I need to estimate $\xi_{h}$ and $\lambda_{h}$ for $h \in {1...,m}$. Thank you, Mauricio Romero Quantil S.A.S. Cel: 3112231150
2011 Nov 09
2
plot separate groups with plotmeans()
Hi, I often use plotmeans() from the gplots package to quickly visualize a pattern of change. I would like to be able to plot separate lines for different groups, but the function gives an error when a grouping variable is included in the formula argument. For instance, > require(gplots) > x <- data.frame(Score=rnorm(100), Time=rep(1:10, 10),
2000 Jun 25
1
renaming columns
I frequently get data sets with cryptically-named variables. The datasets are more useful to me with informative variable names. I know that I can rename variables using the following command: dimname(dataset[[2]][index.of.variable.to.be.renamed]<-new.variable.name If I want to do this inside a function (say something I call RenameCol) what is the best way to communicate the
2008 Nov 25
1
Strange seq() behavior
Hi, This is really strange. Can anyone help explain what's going on here (on 3 and 7)? > targets <- seq(from=.1, to=.9, by=.1) > targets[1]==.1 [1] TRUE > targets[2]==.2 [1] TRUE > targets[3]==.3 [1] FALSE > targets[4]==.4 [1] TRUE > targets[5]==.5 [1] TRUE > targets[6]==.6 [1] TRUE > targets[7]==.7 [1] FALSE > targets[8]==.8 [1] TRUE >
2023 Jul 26
2
Rename Computer on Domain
I can report that the computer renaming worked. As it turned out, only the cn was incorrect ... ldbsearch -H ldap://DC1 -UAdministrator 'CN=DT06' dn: CN=DT06,OU=Desktops,OU=Computers,DC=domain,DC=com objectClass: computer cn: DT06 operatingSystem: Windows 10 Pro displayName: WH23$ sAMAccountName: WH23$ ... so a simple LDAP rename worked ... ldbrename -H ldap://DC1 -UAdministrator
2008 Jul 07
2
A shorter version of ".Last.value"?
Hi, There is an object, ".Last.value" to which the result of the most recent evaluation is assigned. This is similar to "ans" in Matlab. In Matlab "ans" can be very useful and time-saving, but typing the larger R version is somewhat clunky and takes away from the usefulness. Is it possible to reassign '.Last.value' to something simpler, like
2009 Aug 11
1
Prevent sequential repeated values in data frame column
Hi, I'm trying to randomize a sequence of trials for an experimental design. The trials consist of values for each of two factors. As is there are 30 combinations of the two factors, and I want them to be ordered randomly but with the requirement that for one of the factors, the value can never be the same as the previous value. I'm currently randomizing my dataframe by using:
2010 Apr 21
1
Adding error bars to xyplot()
Hi, I want to add error bars to a plot generated with xyplot. I've tried both errbar() and plotCI(), but in both cases the points are not in the same place. It's as if the two functions are using a different frame of reference for the plotting area. for example: means <- c(92.5, 92.25, 90.9, 91.0, 94.15, 90.05) #means time <- c(1,1,2,2,3,3) #occasion variable group <-
2004 May 31
1
Old domain name an't delete record with tdbtool
Samba V3, tdbsam backend. I've had to change the workgroup name in smb.conf on a Samba PDC (ie, I've changed the domain name). However, the old domain name still shows up in Windows PCs' "Microsoft Windows Network" (together with the new name, which works just fine). I want to remove the old domain name, and I assume it is still showing because it is still present in
2014 Jan 29
2
Rename computer, but still shows up as old name
Samba Version 4.1.4-SerNet-RedHat-7.el6 Using RSAT via Windows 8.1 -- For a computer that is on the domain, I rename it from the client, then reboot. This renames the computer as expected. The common name in AD, however, is not affected. Is there a way to do this? Am I missing a step? Details: Using RSAT, I see the old computer name, not the new computer name. If I double click on the entity,
2011 Jun 28
1
lattice multiple y-scale possible?
Hi I am attempting to use the lattice bwplot function to generate boxplots of numerous parameters (1-panel/parameter) by site (x-axis). The parameters have quite different ranges of values, so it would be best to have a separate y-axis range for each panel. Below is a basic example of what I am trying to do. As is seen, the y-axes need to be scaled individually to make this useful. Any
2011 May 19
1
Creating a "shifted" month (one that starts not on the first of each month but on another date)
Hello! I have a data frame with dates. I need to create a new "month" that starts on the 20th of each month - because I'll need to aggregate my data later by that "shifted" month. I wrote the code below and it works. However, I was wondering if there is some ready-made function in some package - that makes it easier/more elegant? Thanks a lot! # Example data:
2007 Aug 03
2
change the names of all listed objects
Dear list members, I have created seven objects, from a to g, so that ls() gives me [1] "a" "b" "c" "d" "e" "f" "g" how can I automatically change their names in "a1" "b1" "c1" "d1" "e1" "f1" "g1" It seems simple, ut it is driving me mad. Thank you very
2013 Mar 13
2
Extract letters from a column
Dear list: I would like to extract three letters from first and second elements in one column and make a new column. For example below, > tempdf = read.table("clipboard", header=T, sep='\t') > tempdf name var1 var2 abb 1 Tom Cruiser 1 6 TomCru 2 Bread Pett 2 5 BrePet 3 Arnold Schwiezer 3 7 ArnSch > (p1 =
2007 May 12
1
function similar to "get" that works for both an object, and elements of an object?
#Is there a single function similar to "get" that works for both an object, and elements of an object ? #(I want the function to be able to return objects, and/or the deeper elements of an object.) #(i.e. elements of a dataframe and/or list)? #e.g. tempdf = data.frame(a=c(4,5,6) , b=c(10,11,12) ) templist= list(x=tempdf, y=c(1,2)) get('tempdf') #works as desired
2002 Oct 18
4
code to turn T into TRUE
Does anyone have code that will methodically process R sourcecode, turning T's into TRUE and F's into FALSE? I got bored doing this by hand, after the first 30-odd functions-- there are hundreds left to do. I don't want to simply deparse everything, because that would destroy my beautiful formatting. The reason it's not trivial, is that comment lines, quotes, and split lines need
2008 Nov 25
1
Efficient passing through big data.frame and modifying select
> -----Original Message----- > From: William Dunlap > Sent: Tuesday, November 25, 2008 9:16 AM > To: 'johannes_graumann at web.de' > Subject: Re: [R] Efficient passing through big data.frame and > modifying select fields > > > Johannes Graumann johannes_graumann at web.de > > Tue Nov 25 15:16:01 CET 2008 > > > > Hi all, > > > >
2008 Dec 23
1
quotation problem/dataframe names as function input argument.
Dear R friends: Can someone help me with the following problem? Many thanks in advance. # Problem Description: # I want to write functions which take a (character) vector of dataframe names as input argument. # For example, I want to extract the number of observations from a number of dataframes. # I tried the following: nobs.fun <- function (dframe.vec) { nobs.vec <-
2012 Mar 30
1
How to use access results of gregexpr in data frames
Hello, I'm trying to figure out how to find the index of the second occurrence of "/" in a string (which happens to represent a date) within a data frame column. I've used the following code successfully to find the first instance of "/". dframe <- data.frame(date=c("5/14/2011", "4/7/2011")) dframe$x1 <- regexpr("/", dframe[, 1])
2011 Jun 09
3
How to subset based on column name that is a number ?
Hi, I have a data frame with column names "1", "2", "3", ... and I'd like to extract a subset based on the values in the first column. None of the methods I tried worked (below). x <- subset(dframe, 1 = = "My Text") x <- subset(dframe, "1" = = "My Text") x <- subset(dframe, names(dframe)[1] = = "My Text") Q