similar to: macro in a loop

Displaying 20 results from an estimated 20000 matches similar to: "macro in a loop"

2008 Nov 04
1
perform Kruskal-Wallis test without using the built-in command in R
Hi, again i am stuck in my presentation, and i have never learn R before in my life but need this to be done, so please help me out for a favour: http://www.nabble.com/file/p20333155/kew.dat kew.dat run this in R and these comes up: Month Year Rain 1 Jan 1900 74.400000 2 Feb 1900 80.500000 3 Mar 1900 23.600000 4 Apr 1900 23.600000 5 May 1900 25.100000 6
2019 May 04
2
read.table() fails with https in R 3.6 but not in R 3.5
In versions of R prior to 3.6.0 the following invocation succeeds, returning the data frame shown: > read.table("https://www.dwds.de/r/stat?corpus=kern&cnt=tokens&date=decade&format=text", header=TRUE) Dekade Anzahl 1 1900 11467254 2 1910 13023370 3 1920 13434601 4 1930 13296355 5 1940 12121250 6 1950 13191131 7 1960 10587420 8 1970 10944129 9
2012 Nov 01
2
Subsetting year range
Hi, I have a panel data set that I am trying to subset. I am trying to keep values for years >=1960. The full set is from 1940 to 2000. I tried a few things, but none worked. Here are a couple that I am trying to use. TableAPS1 <- subset(TableAP, year => 1959) TableAPS1 <- TableAP[ which(year > 1959),] It would be really nice if someone can point out what I am doing wrong
2012 Feb 14
1
cumsum function to determine plankton phenology
Apologies for the empty email earlier! I have species abundance data sampled at a weekly frequency or sometimes monthly depending on the year. The goal is to identify the dates in an annual cycle in which the cumulative abundance of a species reaches some threshold. Here's an example of the data for 1 species over an annual period: "mc_pheno" is the object created from this data:
2012 Jun 18
1
Changing many csv files using apply?
Dear all, I have many csv files whose contents I want to change a bit en masse. So far, I've written code that can change them in a for loop, like so: # Subset of files in the folder I want to change subset = "somestring" # Retrieve list of files to change filelist=list.files() filelist = filelist[grep(subset, filelist)] for(i in 1:length(filelist)){ setwd(readdir)
2009 Dec 21
2
Reading multiple Input Files
Dear R helpers,   Suppose I am dealing with no of interest rates at a time and the no of interest rates I am selecting for my analysis is random i.e. it can be 2, can be 10 or even higher. The R-code I had written (with the guidance of R helpers obviously and I am really grateful to all of you) as of now is sort of hard coding when it comes to reading interest rates as an input e.g.   ## INPUT  
2011 Aug 25
2
how to read a group of files into one dataset?
for example : I have files with the name "ma01.dat","ma02.dat","ma03.dat","ma04.dat",I want to read the data in these files into one data.frame flnm<-paste("obs",101:114,"_err.dat",sep="") newdata<-read.table(flnm,skip=2) data<-(flnm,skip=2) but the data only contains data from the flnm[1] I also tried as below : for
2013 Mar 13
2
merge datas
Hello all! I have a problem with R. I try to merge data like this: structure(c(2.1785, 1.868, 2.1855, 2.5175, 2.025, 2.435, 1.809, 1.628, 1.327, 1.3485, 1.4335, 2.052, 2.2465, 2.151, 1.7945, 1.79, 1.6055, 1.616, 1.633, 1.665, 2.002, 2.152, 1.736, 1.7985, 1.9155, 1.7135, 1.548, 1.568, 1.713, 2.079, 1.875, 2.12, 2.072, 1.906, 1.4645, 1.3025, 1.407, 1.5445, 1.437, 1.463, 1.5235, 1.609, 1.738, 1.478,
2013 Mar 12
5
extract values
Hello all! I have a problem to extract values greater that for example 1820. I try this code: x[x[,1]>1820,]->x1 Please help me! Thank you! The data structure is: structure(c(2.576, 1.728, 3.434, 2.187, 1.928, 1.886, 1.2425, 1.23, 1.075, 1.1785, 1.186, 1.165, 1.732, 1.517, 1.4095, 1.074, 1.618, 1.677, 1.845, 1.594, 1.6655, 1.1605, 1.425, 1.099, 1.007, 1.1795, 1.3855, 1.4065, 1.138, 1.514,
2013 Apr 07
2
group data in classes
Hello all! I have a problem to group my data (years) in 10 years classes. For example for year year decade 1598 1590-1600 1599 1590-1600 1600 1590-1600 1601 1600-1610 --- my is like this> [1] 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 [16] 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 [31] 1628 1629 1630 1631 1632 1633
2009 Jun 08
6
Strange indices of support verctors from e1071
Hello, In the attached file training.csv (I apologize for the large file) I have 238 objects belonging to 13 classes, which are described by 183 properties. I would like to find a svm model for these objects. I tried the following R statements. library('e1071') datatraining <- read.csv("training.csv",head=TRUE) names<-names(datatraining) print("before
2009 Jun 08
3
caret package
Hi all I am using the caret package and having difficulty in obtaining the results using regression, I used the glmnet to model and trying to get the coefficients and the model parameters I am trying to use the extractPrediction to obtain a confusion matrix and it seems to be giving me errors. x<-read.csv("x.csv", header=TRUE); y<-read.csv("y.csv", header=TRUE);
2007 Sep 13
2
handle dates in R?
Dear Rusers, I have some data in .csv file like "2004-8-1" and "2004-10-1", and i need to convert them into days from the origin (January 1, 1960). I have tried the function date.mmddyyyy(), but cannot get it. Anybody can show me how to handle the date data? Thanks very much! My dataset like: time 2004-8-1 2004-10-1 2001-9-1 2002-9-1 -- With Kind Regards,
2013 Mar 29
1
problem with data
Hello all! I have a problem with my data in R. When I want to plot the following data, I have a problem with y scale. The maximum value is cc. 10 degrees and in R is about 100. I use this code: fasy<-read.table("gridd1.txt",sep="\t",dec=",",header=T,row.names=1) # here are the years: x <- as.numeric(rownames(fasy)) # extract a series that you want to plot: y
2010 Jun 17
1
Multiple ecdf plots?
I have a csv file that has approximately 50k rows. In the first value of each row, a file name is listed, and there are 162 different file names. At the end of each row, there is a number value. What I would like to be able to do is for the 162 different files (or we could call them categories), is compute the ecdf for the values within that category. Then plot the ecdf for each file on the
2012 Dec 17
1
subset handling
Dear Rui and UseRs,[a text file has also been attached, in case the format of my email is difficult to get]I am extremely sorry that I am bothering you once again, but I?ll have to get to the bottom of it. The following command sp <- lapply(split(agg, agg$st), function(x) x[order(x$year, x$month), ]) gave me an output with monthly mean of population(as under). i am not able to apply
2012 Jan 17
2
How to loop on file names
Dear all, I need to do the same procedure on several files. But I don't know how to refer to the file name. Here is an example of what I am trying to do. List of files: file1(A,B,C, D1...Dn), file2(A,B,C,E1,...,En), file3(A,B,C,F1,...,Fn) Procedure I want to apply on each file: dft <- melt(df,id=c('A','B','C')) dft$X <- substr(dft$variable,1,3) dft$Y <-
2007 Jun 29
1
Assign name to a name
I would like to know how I can assign a name to a name. I have a dataset that has different years in it. I am writing scripts using R and I would like to give a month a generic name and then use the generic name to do different analysis. The reason for the generic name would be so that I only have to change one thing if I wanted to change the year. For example. Year1 = 1999 datayear <-
2011 Dec 13
2
Plotting a date variable after GAM
Dear All, I am fitting a simple GAM model using the "gam" function in the "mgcv" package. The only independent variable is a continuous variable representing the time of the event (in year and month) coded so that "0" represents January 1960, "1" represents February 1960, etc. Now when I try to plot the results, my x-axis ranges from "-200" to
2009 Mar 23
2
Looping of read.table and assignment
Dear all, I am trying to read in and assign data from 50 tables in an automated fashion. I have the following code, which I created with the help of textbooks and the internet, but it only seems to read in the final data file over and over again. For example, when I type:> table_1951 I get the same values in the table as when I type> table_2000 despite the values in the source tables