similar to: why does this simple example NOT work?

Displaying 20 results from an estimated 10000 matches similar to: "why does this simple example NOT work?"

2007 Oct 11
5
rearrange data columns
Dear R users, I need to to the the following. Let a= 1 2 3 4 5 6 and b= -1 -2 -3 be (2x3) matrices. -4 -5 -6 I need to combine the two matrices into a new (2x6) matrix like this: ab = ( 1 -1 2 -2 3 -3 ) 4 -4 5 -5 6 -6 How can this be done in R? ----------------------------------------------------------------- ?????? ???
2018 Apr 10
1
Fail to save an object using name as string
Dear list member, I think that I have detected a strange behavior of the save() command: > year <- "2000" > assign(paste0("Var_", year), list(A=10, B=20)) > get(paste0("Var_", year)) $A [1] 10 $B [1] 20 # At this point all is ok, I have created a list of name Var_2000 > save(paste0("Var_", year), file=paste0("Var_", year,
2007 Oct 13
2
a question on impulse responses
Dear R users, I am using the vars package to calculate the impulse response functions and the forecast error variance decomposition of a VAR model. Unfortunately I do not know whether these functions assume unit or one standard deviation shocks. I tried to look into the code of these functions, but in vain: neither irf, nor vars::irf, nor vars:::irf output the code of the functions. Does someone
2014 Apr 30
2
Problem with Renaming R object
Hi, I have a problem in renaming R object and saving them within a loop. For ex: for (i in 1:length(all_files)) { uncov_GR <- "variable created in loop" filename <- paste0(sample_name[[i]],"_uncov", ".Rdata")) save(uncov_GR,file=filename) } Within the above short code (out of a long program), I want to
2007 Oct 12
1
calculate impulse responses
Dear R users, I need perform structural analysis on a no intercept VAR model. Unfortunately the functions irf.VAR and dfev that come with the MSBVAR package only work with objects output by the reduced.form.var function, which seems to only evaluate VAR models with intercept. Is there a way to suppress the estimation of intercept term in reduced.form.var? Do I need to modify the code, and if I
2009 May 24
2
A question on type="h" plot lines
Dear R users, I need a produce a plot with a single panel and a few lines on it. Each line represents a different data set. The line types must be "h", i.e. ?histogram? like (or ?high-density?) vertical lines. The problem is that the vertical lines comprising a plot line of type="h" are drawn from the y=0 line to the (x, y) locations. What I need is vertical lines drawn from
2006 Aug 17
2
powercom UPS shoutdown discussion
Thank you for your response. The point is that I have configured my system to shut down at the event "upsc Inform@localhost ups.status"!="OL", not at "LB". So there will be no /etc/killpower file created. At an ups.status != "OL" event, the following script named "notifyme" is run: echo `date` >> /root/upsLog echo " No power, shutting
2006 Aug 16
5
Master privileges unavailable on UPS, no access :(
Hello! After I type "upsmon", in syslog the following message appears: Aug 16 14:11:09 marto upsmon[7731]: Master privileges unavailable on UPS [Inform@localhost] Aug 16 14:11:09 marto upsmon[7731]: Reason: Access denied Can you tell me where my error is, my configuration files are: ups.conf: [Inform] driver = powercom port = /dev/ttyS0 desc = "inform guard" linevoltage = 220
2011 Jun 29
1
tcgetattr: Inappropriate ioctl for device
Dear nut users, I am running nut-2.6.0 on Slackware-Linux-13.37.0 with kernel 2.6.37.6. I am trying to get the software work for a repotec UPS with model name: RPT-1003AU. The UPS communicates with the computer via USB. I know that the model is not officially supported but I want to try out whether it will work with some of the repotec drivers. Here is the result with the genericups upstype=13
2012 Jul 12
2
trellis margin sizes in absolute units
Dear R users, I have a lot of experience with traditional R graphics, but I decided to turn to trellis as it was recommended for spatial graphs by the sp package. In traditional R graphics I always first set the size of the device region absolute units (e.g. mm) and then I firmly fix the inner margins with mai and the outer margins with oma also in absolute units. What is left from the device
2010 Mar 22
2
problem with abline and lines
Dear R users, I need to plot to perpendicular straight lines. However, although I set the coefficients so that the lines are perpendicular, they do not look to be so in the plot. Here is a minimal working example: plot(x=c(-1, 1), y=c(-1, 1)); abline(a=0, b=1/sqrt(2)); abline(a=0, b=-1/sqrt(2)) Please tell me if the same problem is valid by you. I am running R-2.10.1 on Linux. Is there a way
2007 Jan 18
1
weighted MDS, alscal
Hello! I need to perform weighted multidimensional scaling analysis(WMDS). I did rsitesearch, googled, but I could find no info on how to perform WMDS using R. In several places they say it is possible with the ALSCAL algorithm, but I could not find the relevant function to carry it out. ----------------------------------------------------------------- ???????? ?? ??????? ?? ??? ???????????!
2010 Jan 27
1
biplot from stats: 0.8 ?
Dear forum, I need to create biplot graphic. I took a look at the code of the biplot.default function from the stats package and I found that the arrows for the variables are multiplied by a coefficient of 0.8 before plotting: ... if (var.axes) arrows(0, 0, y[, 1L] * 0.8, y[, 2L] * 0.8, col = col[2L], length = arrow.len) ... I have no idea why this is done. Could somebody
2017 Nov 30
2
Help avoiding setting column type two times
Hi, I think and hope this a good place to ask for code review for a R beginners? I have made a R script which generates a dataset based on 2009 danish referendum and it does work. But I think the code could be better and I would any comments how the code can be improved. At least I would like to know how I avoid converting several of the columns to factors in the end of the code?
2012 Oct 07
3
get: problem with environments
Dear R users, I am running R-2.15.1 in Linux Slackware64-14.0. Here is my minimal working example: testfun <- function (x) { a <- 0; sapply(X="a", FUN=get, envir=sys.frame(which=x)); } Inside R, that is R called from within a Linux terminal, the following code works: testfun(x=5) print(testfun(x=6)) But within rkward the above code fails and the following works: testfun(x=1)
2013 Feb 26
1
Light Libraries
Dear R-Help group: I have been tinkering with how I want my personal standard library functions to look like. They are not designed to be professional and heavyweight, but lightweight. There are probably dozens of little bugs, because I don't know or have not properly taken care of a variety of internal R code issues. still, I like how this ended up, and there is no learning curve, so I
2014 May 22
1
Excluding objects from save.image
When dealing with object holding pointers that are only valid during a single session, it would be convenient to exclude them from being saved with the session image. (I am assuming that `quit` calls `save.image` before quitting or is it internal?) Currently they are saved with the pointer converted to NULL. Its a bit surprising for users not realizing the object is no longer valid. My thought is
2016 Apr 27
0
R Script Template
The subject of your email is missing. Perhaps you need to read the Posting Guide (again?) about attachments. Embedding your example directly in the body of the email is generally more accessible in archives than attaching it. -- Sent from my phone. Please excuse my brevity. On April 27, 2016 1:14:17 PM GMT+01:00, G.Maubach at gmx.de wrote: >Hi All, > >I am addressing this post to all
2016 Apr 27
2
R Script Template
Hi All, I am addressing this post to all who are new to R. When learing R in the last weeks I took some notes for myself to have code snippets ready for the data analysis process. I put these snippets together as a script template for future use. Almost all of the given command prototypes are tested. The template script contains snippets for best practices and leaves out the commands that
2012 Dec 10
3
use variable in for loop to name output files
Hi, This question should be simple to answer. I am a new R user. I have a data.frame called appended. I would like to break it into 7 smaller datasets based on the value of a categorical variable dp (which has values 1:7). I would like to name the smaller datasets set1, set2, set3,....,set7. I don't know how to refer to the variable in the for loop, when naming the output datasets. In STATA