0

I have txt file on which the results of a research are saved.

I called it SPD this way:

SPD<-read.table("C:\\Users\\Inhib\\OneDrive\\documents\\mydata.FromR.txt", header=TRUE)

when I write then SPD it presents all columns and everything is fine.

Now, I want to perform elastic net analysis and I need lambda values, so I tried to use SPD in cv.glmnet for that using data(SPD) but it didn't work.

Then I tried to create new data from SPD, doing this:

myvars <- c("Age", "Uniqgenver","Elgenver", "Flowgenver", "Gender", "Resilience")
newdata<-SPD[myvars]
newdata

When I do below, it doesn't work.

data(newdata) 

I really need to do lambda estimation using cv.glmnet or any other method, would be happy if anyone could explain me how to do it step by step using my file.

zx8754
  • 52,746
  • 12
  • 114
  • 209
Gilad Sabo
  • 41
  • 1
  • 5
  • 1
    what are you trying to achieve with the line `data(newdata)` ? This function is used to load example datasets from the R packages. – agenis Jul 11 '16 at 09:27
  • Ok..So do I load my data set and define x and y for glmnet..Or, more precisely, how I make glmnet to find lambda for my data? I just started with R yesterday – Gilad Sabo Jul 11 '16 at 18:45
  • OK, you probably meant `attach(newdata)` instead of `data(newdata)`? Anyway It seems like your question is more about learning how to use R than fixing a specific problem of code (see this help http://stackoverflow.com/q/5963269/3871924). If you need a step-by-step tutorial for glmnet, you might refer to the author's one here, which is very good: https://web.stanford.edu/~hastie/glmnet/glmnet_alpha.html – agenis Jul 12 '16 at 08:04

0 Answers0